mcp-on-workers
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
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.
Responses are always a single JSON object (no SSE), GET returns 405, and sessions are stateless HMAC-signed ids, so any Worker instance can verify them without storage.
Spec compliance
Requirement (2025-11-25, basic/transports) | Behaviour |
"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, such as the caller from the Authorization header.
Throw from it to reject the call.
example/worker.ts is a complete server with one tool.
Test
npm install
npm testLicence
MIT. See LICENSE.
This server cannot be deployed
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,834 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