mcp-worker
Click on "Deploy 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., "@mcp-workersay hello to 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: Cloudflare Remote MCP Server Template
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 deployed
Maintenance
Related MCP Connectors
Cloudflare Workers MCP server: agent-workflow-engine
MCP server for AI agents to plan, verify, and deploy Cloudflare-native apps.
Cloudflare Workers MCP server: ai-model-router
Cloudflare Workers MCP server: ai-agent-scratchpad
Related MCP Servers
- -licenseNot gradedqualityNot gradedmaintenanceA template for deploying Model Context Protocol servers on Cloudflare Workers without authentication. Enables users to create custom MCP tools and connect them to AI clients like Claude Desktop or Cloudflare AI Playground.-
- FlicenseNot gradedqualityNot gradedmaintenanceA template for deploying a remote, unauthenticated Model Context Protocol (MCP) server on Cloudflare Workers using Server-Sent Events. It enables developers to host custom tools remotely and connect them to MCP clients like Claude Desktop or Cloudflare AI Playground.-
- FlicenseNot gradedqualityCmaintenanceA template for deploying an unauthenticated Model Context Protocol server on Cloudflare Workers using Server-Sent Events (SSE). It enables users to host remote MCP tools accessible via the Cloudflare AI Playground or local clients like Claude Desktop.-
- FlicenseNot gradedqualityCmaintenanceA template for deploying remote Model Context Protocol servers on Cloudflare Workers without authentication. It enables users to define custom tools and access them through an SSE endpoint from clients like Cloudflare AI Playground or Claude Desktop.-