createMcpHandler MCP Server
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@createMcpHandler MCP Servercall the hello tool with name Alice"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
MCP Server (createMcpHandler)
The simplest way to run a stateless MCP server on Cloudflare Workers. Uses createMcpHandler from the Agents SDK to handle all MCP protocol details in one line.
What it demonstrates
createMcpHandler— the Agents SDK helper that wraps anMcpServerinto a Worker-compatible fetch handlerMinimal setup — define tools on an
McpServer, pass it tocreateMcpHandler, doneStateless — no Durable Objects, no persistent state, each request is independent
Related MCP server: mcp-worker
Running
npm install
npm run devOpen the browser to see the built-in tool tester, or connect with the MCP Inspector at http://localhost:5173/mcp.
How it works
import { createMcpHandler } from "agents/mcp";
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
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: async (request, env, ctx) => {
const server = createServer();
return createMcpHandler(server)(request, env, ctx);
}
};Related examples
mcp— stateful MCP server withMcpAgentand Durable Objectsmcp-worker-authenticated— adding OAuth authenticationmcp-client— connecting to MCP servers as a client
This server cannot be installed
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
- Alicense-qualityCmaintenanceA minimal stateless MCP server for Cloudflare Workers that provides a greeting tool, demonstrating the use of createMcpHandler from the Agents SDK.270MIT
- Flicense-qualityCmaintenanceRun a stateless MCP server on Cloudflare Workers using createMcpHandler.
- Flicense-qualityCmaintenanceDeploys a stateless remote MCP server on Cloudflare Workers without authentication, supporting the MCP 2026-07-28 specification and custom tool registration.
- Flicense-qualityCmaintenanceA minimal, stateless MCP server that runs on Cloudflare Workers using createMcpHandler from the Agents SDK. It demonstrates a simple 'hello' tool and requires no Durable Objects or persistent state.
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/tarsemx15-lgtm/mcp-workers'
If you have feedback or need assistance with the MCP directory API, please join our Discord server