MCP Worker MCP Server

1

Add it to Claude Code

Run this in a terminal.

Run in terminal
claude mcp add mcp-worker -- npx -y mcp-worker
README.md

A lightweight template for deploying stateless MCP servers on Cloudflare Workers

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 an McpServer into a Worker-compatible fetch handler
  • Minimal setup — define tools on an McpServer, pass it to createMcpHandler, done
  • Stateless — no Durable Objects, no persistent state, each request is independent

Running

npm install
npm run dev

Open 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

Tools (1)

helloReturns a greeting

Configuration

claude_desktop_config.json
{"mcpServers": {"mcp-worker": {"command": "npx", "args": ["-y", "mcp-worker"]}}}

Try it

Call the hello tool to get a greeting for the name 'Claude'.
Use the hello tool without providing a name to see the default greeting.
Test the hello tool functionality on the local worker instance.

Frequently Asked Questions

What are the key features of MCP Worker?

Wraps McpServer into a Worker-compatible fetch handler. Enables stateless MCP server deployment. Minimal setup using Agents SDK. Built-in tool tester for local development.

What can I use MCP Worker for?

Deploying lightweight MCP tools to the edge. Creating serverless tool-calling capabilities for AI agents. Rapid prototyping of stateless MCP server logic.

How do I install MCP Worker?

Install MCP Worker by running: npm install && npm run dev

What MCP clients work with MCP Worker?

MCP Worker works with any MCP-compatible client including Claude Desktop, Claude Code, Cursor, and other editors with MCP support.

Turn this server into reusable context

Keep MCP Worker docs, env vars, and workflow notes in Conare so your agent carries them across sessions.

Need the old visual installer? Open Conare IDE.
Open Conare