MCP server proxy
@12beam
Extend MCP server functionality to work as a worker
Overview
What is MCP server proxy?
MCP server proxy is a lightweight utility that provides the proxyMessage function to forward messages to an existing MCP server. It is designed for developers using MCP in serverless environments, such as Cloudflare Workers, and works with standard MCP Server instances from the Model Context Protocol SDK.
How to use MCP server proxy?
Install the @contextdepot/mcp-proxy package, import the proxyMessage function, create an MCP Server instance, then call proxyMessage(server, requestMessage) inside a message handler. Configuration follows the usual MCP server setup; the example shows a Cloudflare Worker entrypoint that delegates incoming requests to the proxy.
Key features of MCP server proxy
- Provides the
proxyMessagefunction for forwarding MCP messages. - Integrates seamlessly with standard MCP Server instances.
- Shown in a Cloudflare Worker (WorkerEntrypoint) example.
- Lightweight and focused solely on message proxying.
Use cases of MCP server proxy
- Forwarding MCP messages from a serverless endpoint to an existing MCP server.
- Adding a proxy layer to inspect, log, or route MCP requests.
- Running MCP servers behind Cloudflare Workers for edge-based logic.
FAQ from MCP server proxy
What dependencies does MCP server proxy require?
It expects an MCP Server instance (from the @modelcontextprotocol/sdk) and is used with the @contextdepot/mcp-proxy package.
What runtime environment does it target?
The example uses WorkerEntrypoint from Cloudflare Workers, but the proxyMessage function itself may work in any JavaScript runtime that supports the SDK.
Does it modify or validate the forwarded message?
No—the README only describes passing the message unchanged via proxyMessage. Any custom logic must be added before or after the call.