MCP Worker Server
Servidor MCP (createMcpHandler)
La forma más sencilla de ejecutar un servidor MCP sin estado en Cloudflare Workers. Usa createMcpHandler del SDK de Agents para manejar todos los detalles del protocolo MCP en una sola línea.
Lo que demuestra
createMcpHandler— el helper del SDK de Agents que convierte una fábrica deMcpServeren un manejador fetch compatible con WorkersConfiguración mínima — define herramientas en una fábrica, pasa la fábrica a
createMcpHandler, listoSin estado — sin Durable Objects, sin estado persistente, cada solicitud es independiente
Related MCP server: createMcpHandler MCP Server
Ejecución
pnpm install
pnpm startAbre el navegador para ver el probador de herramientas integrado, o conéctate con el MCP Inspector en http://localhost:5173/mcp.
Cómo funciona
import { McpServer } from "@modelcontextprotocol/server";
import { createMcpHandler } from "agents/mcp/server";
import { z } from "zod";
function createServer() {
const server = new McpServer({ name: "Hello MCP Server", version: "1.0.0" });
server.registerTool(
"hello",
{
description: "Returns a greeting",
inputSchema: { name: z.string().optional() }
},
async ({ name }) => ({
content: [{ type: "text", text: `Hello, ${name ?? "World"}!` }]
})
);
return server;
}
export default {
fetch(request, env, ctx) {
return createMcpHandler(createServer)(request, env, ctx);
}
} satisfies ExportedHandler;Ejemplos relacionados
mcp— servidor MCP con estado usandoMcpAgenty Durable Objectsmcp-worker-authenticated— añadiendo autenticación OAuthmcp-client— conectándose a servidores MCP como cliente
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- Flicense-qualityCmaintenanceRun a stateless MCP server on Cloudflare Workers using createMcpHandler.
- Alicense-qualityCmaintenanceSimplest way to run a stateless MCP server on Cloudflare Workers, using createMcpHandler from the Agents SDK to handle MCP protocol details in one line.10MIT
- Flicense-qualityCmaintenanceDeploy a stateless remote MCP server on Cloudflare Workers without authentication, with custom tool support and compatibility for MCP clients.
- Flicense-qualityCmaintenanceDeploys a stateless remote MCP server on Cloudflare Workers without authentication, supporting the MCP 2026-07-28 specification and custom tool registration.
Related MCP Connectors
MCP server for AI agents to plan, verify, and deploy Cloudflare-native apps.
Cloudflare Workers MCP server: crypto-signal
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/Indxxr/mcp-worker'
If you have feedback or need assistance with the MCP directory API, please join our Discord server