AI assistants can now call outside tools through MCP. I wanted Claude and ChatGPT to check crypto signal calls and leverage against real prices, so I put an MCP server on the same Cloudflare Pages site, as one Function file.
What a stateless MCP server needs
- One route that takes POST JSON-RPC and answers JSON (the Streamable HTTP transport allows plain JSON answers; you don't need SSE).
-
initialize: return protocolVersion,capabilities: {tools: {}}and serverInfo. -
tools/list: your tools with a JSON Schema for the inputs. -
tools/call: run the tool and return{content: [{type: "text", text}]}. - Notifications (no id): answer 202 with no body.
- GET with
Accept: text/event-stream: 405 is fine when you don't stream.
export async function onRequestPost({ request }) { const m = await request.json(); if (m.method === "initialize") return json({ jsonrpc: "2.0", id: m.id, result: { protocolVersion: "2025-06-18", capabilities: { tools: {} }, serverInfo: { name: "signalcheckerhq", version: "1.0.0" } } }); if (m.method === "tools/list") return json({ jsonrpc: "2.0", id: m.id, result: { tools: TOOLS } }); if (m.method === "tools/call") return json({ jsonrpc: "2.0", id: m.id, result: await callTool(m.params) }); if (m.id === undefined) return new Response(null, { status: 202 }); return json({ jsonrpc: "2.0", id: m.id, error: { code: -32601, message: "Method not found" } }); } Lessons
- Mark read-only tools with
annotations: { readOnlyHint: true }, so clients can run them without asking every time. - Write tool descriptions for the model: say when to use the tool, not only what it does.
- Cloudflare limits outgoing requests per call, so give each tool a request budget.
- To list it in the official MCP Registry without a GitHub login, you can prove you own the domain with a public key file at
/.well-known/mcp-registry-auth.
The full code is open source (MIT): https://github.com/signalcheckerhq/mcp-server
I run SignalCheckerHQ, where this server lives. Drafted by Claude (AI); I checked the code and the steps. Not financial advice.