Skip to main content
Glama

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

Related MCP server: Cloudflare Remote MCP Server Template

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);
  }
};
F
license - not found
-
quality - not tested
D
maintenance

Maintenance

Maintainers
Response time
Release cycle
Releases (12mo)
Commit activity

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

  • F
    license
    -
    quality
    C
    maintenance
    A 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.
  • F
    license
    -
    quality
    C
    maintenance
    A 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.

View all related MCP servers

Related MCP Connectors

  • MCP server for AI agents to plan, verify, and deploy Cloudflare-native apps.

  • Free public MCP for AI agents — 193 tools, 44 workflows. No API key.

  • MCP (Model Context Protocol) server for Appwrite

View all MCP Connectors

Latest Blog Posts

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/aryankeluskar/mcp-worker'

If you have feedback or need assistance with the MCP directory API, please join our Discord server