MCP Proxy provides a flexible bridge between different Model Context Protocol (MCP) transport mechanisms. It enables seamless communication between stdio-based MCP servers and HTTP/SSE clients, allowing developers to connect tools that use different transport protocols. The proxy supports bidirectional conversion, working as both a stdio-to-HTTP bridge and an HTTP-to-stdio bridge.
MCP Proxy is a versatile tool that bridges different Model Context Protocol (MCP) transport mechanisms. It solves the compatibility problem between MCP servers that use stdio and clients that expect HTTP/SSE connections, or vice versa.
The proxy operates in two primary modes:
pip install mcp-proxy
pip install git+https://github.com/sparfenyuk/mcp-proxy.git
docker pull ghcr.io/sparfenyuk/mcp-proxy:latest
This mode allows you to expose a stdio-based MCP server as an HTTP endpoint:
mcp-proxy stdio-to-sse --command "python -m your_mcp_server" --port 8000
--command
: The command to start your stdio MCP server--port
: HTTP port to listen on (default: 8000)--host
: Host to bind to (default: 127.0.0.1)--env
: Environment variables to pass to the MCP server--cwd
: Working directory for the MCP server--stateless
: Run in stateless mode (no session persistence)--debug
: Enable verbose loggingThis mode connects to an HTTP/SSE MCP server and exposes it as a stdio interface:
mcp-proxy sse-to-stdio --url http://localhost:8000
--url
: URL of the HTTP/SSE MCP server--debug
: Enable verbose loggingYou can pass environment variables to the underlying MCP server:
mcp-proxy stdio-to-sse --command "python -m your_server" --env "API_KEY SECRET_TOKEN"
Specify a custom working directory for the MCP server:
mcp-proxy stdio-to-sse --command "python -m your_server" --cwd "/path/to/directory"
For containerized deployments, you can use Docker Compose:
version: '3'
services:
mcp-proxy:
image: ghcr.io/sparfenyuk/mcp-proxy:latest
ports:
- "8000:8000"
command: stdio-to-sse --command "python -m your_server" --host 0.0.0.0 --port 8000
volumes:
- ./your_server:/app/your_server
You can create a custom Docker image that includes both mcp-proxy and your MCP server:
FROM ghcr.io/sparfenyuk/mcp-proxy:latest
# Install your MCP server
COPY your_server /app/your_server
RUN pip install -r /app/your_server/requirements.txt
# Configure the proxy to run your server
ENTRYPOINT ["mcp-proxy", "stdio-to-sse", "--command", "python -m your_server", "--host", "0.0.0.0"]
If you encounter issues:
--debug
to see detailed logsFor more information and updates, visit the GitHub repository.