How valesh-gosats/sofi-remote-mcp-server works
Project type and purpose
• This is a small, serverless “Remote MCP Server” demo built on Cloudflare Workers. It implements a Model Context Protocol (MCP) server without authentication, exposing an SSE endpoint (/sse) that clients (e.g. Cloudflare AI Playground or Claude Desktop via mcp-remote) can connect to.
File structure
• Top-level files:
– package.json / package-lock.json: Node build & dependency management
– wrangler.jsonc: Cloudflare Workers deployment config
– tsconfig.json + worker-configuration.d.ts + biome.json: TypeScript and linting setup
– src/index.ts: Core Worker code where the MCP server and tools are registered
• No separate frontend or backend directories: it’s a single serverless function
Key README insights
• Describes how to deploy to Workers and how to register custom tools in src/index.ts via this.server.tool(...)
• Shows two clients: the web-based Playground (connect via URL) and Claude Desktop (via mcp-remote proxy)
Main components
A. Developer & Build Pipeline
• Git repo (with src/ + config files)
• npm build step (tsc → Worker bundle)
• wrangler CLI → Cloudflare Workers
B. Cloudflare Workers Runtime
• MCP Server instance
– init() method: registers Tools
– Event handler for HTTP/SSE connections at /sse
C. Tools Module(s)
• Each tool added via this.server.tool(name, handler)
• Can invoke external APIs or perform compute
D. SSE Endpoint & Streaming
• /sse path streams MCP events to connected clients
E. Clients
1. Cloudflare AI Playground (browser)
2. Local MCP Client (e.g. Claude Desktop via mcp-remote)
Relationships & Interactions
• Developer pushes code → CI / local wrangler publish → deploy Worker
• Worker bundle runs in Cloudflare’s edge network
• Client initiates HTTP GET to /sse → Worker sets up SSE stream
• Worker dispatches incoming MCP messages to registered Tools → Tools return responses → Worker writes events to SSE stream → client UI renders results
Architectural patterns & principles
• Serverless / Functions-as-a-Service (FaaS) at the edge
• Event-driven (SSE stream)
• Pluggable “tools” as handlers (inversion of control)
• Single responsibility: Worker only hosts MCP server and delegates logic to tools
Technologies & frameworks
– Cloudflare Workers (Runtime)
– Wrangler (CLI & deployment)
– TypeScript (src/index.ts, tsconfig.json)
– MCP (Model Context Protocol) library in src
– SSE (Server-Sent Events) for streaming
– mcp-remote (optional proxy for local clients)