mcp-on-workers
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-on-workersadd a hello tool with JSON Schema validation"
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-on-workers
A small Model Context Protocol server for the Streamable HTTP transport (spec 2025-11-25), made for Cloudflare Workers
and any runtime with fetch, Request and Web Crypto. No dependencies. About 250 lines.
It answers every request with one JSON object (the spec allows application/json instead of an SSE stream), answers
GET with 405 (no server stream), and keeps sessions stateless: a session id is signed with HMAC, so any Worker instance
can check it without storage.
What the spec asks, and where it is done
The spec (2025-11-25, basic/transports) | Here |
"Servers MUST validate the Origin header"; a bad one answers 403 |
|
A notification or response "MUST return HTTP status code 202 Accepted with no body" | yes |
A session id of visible ASCII, sent in | signed, 24 hours |
Requests without the session id after initialize: 400; an ended session: 404 | yes; a forged or expired id is 404 |
An unsupported | supports 2025-11-25, 2025-06-18, 2025-03-26 |
Servers "MUST validate all tool inputs" (server/tools) | a small JSON Schema check before every tool runs; problems come back as a tool error |
JSON-RPC batches | refused with 400 (not part of this protocol version) |
Related MCP server: Cloudflare Remote MCP Server Template
Use
import { McpServer, type Tool } from 'mcp-on-workers'
const hello: Tool<null> = {
name: 'hello', title: 'Say hello', description: 'Greets someone.',
inputSchema: { type: 'object', properties: { name: { type: 'string', maxLength: 40 } }, required: ['name'], additionalProperties: false },
async run(args) { return { content: [{ type: 'text', text: `Hello, ${args.name}!` }] } },
}
export default {
async fetch(request: Request, env: { SESSION_SECRET: string }) {
return new McpServer<null>({
info: { name: 'hello', title: 'Hello', version: '1.0.0' },
tools: [hello],
secret: env.SESSION_SECRET,
allowOrigin: (origin) => origin === 'https://my-site.example',
context: async () => null,
}).handle(request)
},
}context(request) builds whatever your tools need per request (a user from the Authorization header, a storage
handle). Throw from it to refuse a call with a tool error.
example/worker.ts is a complete server with one tool.
Test
npm install
npm test # the protocol rules above, as unit testsLicence
MIT. See LICENSE.
This server cannot be deployed
Maintenance
Related MCP Connectors
Remote streamable-HTTP MCP server running on a single Cloudflare Worker. Your assistant gets live Airbnb, Amazon, Booking.com, Google Flights, Maps and Reddit data, social search on X, Instagram and TikTok, the Meta Ad Library, and image/video generation without any keys. Connect your own accounts to let it send WhatsApp or Telegram messages, work an IMAP inbox, manage Meta Ads campaigns and publish to X and LinkedIn. OAuth 2.1 with PKCE; stored credentials are AES-256-GCM encrypted.
A Model Context Protocol server for Wix AI tools
AI Reasoning Cache & Consensus Layer with 11 MCP tools via Streamable HTTP.
MCP server for your apps' tools and custom tools, plus hosted AI agents and approval-gated workflows
Related MCP Servers
- AlicenseNot gradedqualityCmaintenanceA deployable server implementation of the Model Context Protocol that allows you to run custom tools on Cloudflare Workers without authentication requirements.1,439 npmMIT
- FlicenseNot gradedqualityDmaintenanceEnables the deployment of remote Model Context Protocol servers on Cloudflare Workers without authentication. It allows users to host custom tools and connect them to AI clients using Server-Sent Events (SSE).-
- AlicenseNot gradedqualityCmaintenanceEnables developers to build and deploy secure, typed Model Context Protocol servers with tools, resources, prompts, bearer-token authentication, per-tool scopes, rate limiting, and health probes over Streamable HTTP.MIT
- AlicenseNot gradedqualityCmaintenanceEnables running a minimal, dependency-free Model Context Protocol server on Cloudflare Workers that exposes custom tools to MCP clients over plain POST, with optional token auth and rate limiting.MIT