概览
What is MCP Proxy?
MCP Proxy is a TypeScript streamable HTTP and SSE proxy for MCP servers that use stdio transport. It enables remote access to local stdio-based MCP servers over HTTP or SSE, intended for developers who need to expose such servers.
How to use MCP Proxy?
Install via npm install mcp-proxy and run from the command line with npx mcp-proxy followed by the stdio server command. Options include --port, --apiKey, --tunnel, and transport selection. Programmatic use is available via startHTTPServer from the Node.js SDK.
Key features of MCP Proxy
- Streamable HTTP and SSE transport for stdio MCP servers
- CORS enabled by default with configurable options
- Optional API key authentication
- Public tunnel support for exposing local servers
- Stateless mode for serverless deployments
- Configurable timeouts and debug logging
Use cases of MCP Proxy
- Hosting a stdio MCP server remotely for browser-based clients
- Testing MCP servers over HTTP without modifying the server
- Sharing a local MCP server via a public tunnel for webhook testing
- Deploying MCP servers in serverless environments using stateless mode
FAQ from MCP Proxy
Does MCP Proxy require changes to the stdio server?
No, it works with any stdio-based MCP server without modifications. The proxy handles the protocol translation.
What transport protocols does MCP Proxy support?
It supports both streamable HTTP (default endpoint /mcp) and SSE (default endpoint /sse). Both are enabled by default but can be toggled individually.
How do I enable authentication?
Pass --apiKey "your-secret-key" on the command line or set the MCP_PROXY_API_KEY environment variable. Clients must then include the X-API-Key header.
Can I use MCP Proxy with Python MCP servers?
Yes, but ensure Python is run in unbuffered mode (e.g., python -u) or set PYTHONUNBUFFERED=1 to prevent timeouts.
How does stateless mode differ from the default?
Default mode maintains persistent sessions per client. Stateless mode (--stateless) creates a new server instance per request, useful for serverless or memory-constrained environments.