mcp-proxy
Fast rust MCP proxy between stdio and SSE
claude mcp add --transport stdio stephenlacy-mcp-proxy mcp-proxy http://example.com/mcp/instances_abc123
How to use
mcp-proxy is a Rust-based bidirectional MCP proxy that supports both SSE and Streamable HTTP transports, with built-in OAuth authentication and automatic token refresh. It can operate either as a remote client that exposes a remote MCP server as a local stdio server, or as a local server that exposes a local MCP server remotely. The proxy automatically detects transport type (SSE when the URL contains /sse, otherwise Streamable HTTP) but can be overridden with the --transport flag. This makes it easy to connect to remote MCP servers or to expose local MCP servers behind firewalls or NATs. You can run the proxy in remote client mode by pointing it at a remote MCP endpoint, or in local server mode by binding to a local port and launching your MCP server locally, with the proxy forwarding requests in either direction. Configuration examples show how to compose multiple MCP endpoints under a single mcp-proxy configuration, enabling you to manage several remote or local servers from one place.
How to install
Prerequisites:
- Rust and Cargo installed on your system
- Optional: Git if you want to install from a Git repository
Install from crates.io (stable):
# from crates.io
cargo install rmcp-proxy
Install from GitHub (latest/dev):
# from github
cargo install --git https://github.com/stephenlacy/mcp-proxy
Build (if you prefer building from source after cloning):
cargo build --release
Run (example usage):
# Remote client mode example
# Connect to a remote MCP server and expose as a local stdio server
mcp-proxy http://example.com/mcp/instances_abc123
# Or force a transport and endpoint
mcp-proxy --transport sse http://example.com/sse
Note: The binary is named mcp-proxy when installed via cargo, so using the command mcp-proxy in your shell is expected after installation.
Additional notes
Tips and caveats:
- Authentication data can be cleared with: mcp-proxy reset or by removing the auth directory (e.g., rm -rf ~/.mcp-auth).
- You can adjust log verbosity with the RUST_LOG environment variable (e.g., RUST_LOG=info mcp-proxy ...).
- Transport auto-detection covers common scenarios; specify --transport to lock to SSE or Streamable HTTP when needed.
- For local server mode, you can pass environment variables to the spawned process with -e KEY VALUE and expose or forward them to the remote server as needed.
- When exposing a local server, ensure the port you bind to is open and not blocked by firewalls.
- If you encounter authentication issues, check token refreshing behavior and ensure your OAuth credentials are up to date.
Related MCP Servers
sample-agentic-ai-demos
Collection of examples of how to use Model Context Protocol with AWS.
mcp-discovery
A command-line tool written in Rust for discovering and documenting MCP Server capabilities.
turbomcp
A full featured, enterprise grade rust MCP SDK
mcpx-py
Python client library for https://mcp.run - call portable & secure tools for your AI Agents and Apps
mcp-framework
Rust MCP framework for building AI agents
ia-na-pratica
IA na Prática: LLM, RAG, MCP, Agents, Function Calling, Multimodal, TTS/STT e mais