what is mcp-proxy?
mcp-proxy is a Rust-based bidirectional proxy that connects standard input/output (stdio) to Server-Sent Events (SSE), allowing seamless communication between local and remote servers.
how to use mcp-proxy?
To use mcp-proxy, install it via Cargo, build it, and run it in either SSE Client Mode or Stdio Client Mode, depending on your needs.
key features of mcp-proxy?
- Connects to remote servers over SSE and exposes them as stdio servers.
- Connects local stdio servers and exposes them as SSE servers.
- Fast startup with minimal memory usage.
use cases of mcp-proxy?
- Connecting local applications to remote servers using SSE.
- Exposing local command-line tools as SSE services.
- Facilitating communication between different server types in a microservices architecture.
FAQ from mcp-proxy?
- What programming language is mcp-proxy written in?
mcp-proxy is written in Rust.
- How do I install mcp-proxy?
You can install it using Cargo with the command:
cargo install mcp-proxy
.
- Can I use mcp-proxy with any command-line tool?
Yes, mcp-proxy can expose any command-line tool as an SSE server.
mcp-proxy
A Rust bidirectional MCP proxy between stdio and SSE. Based initially on sparfenyuk/mcp-proxy
Features
- Connect to a remote server over SSE and expose it as a stdio server
- Connect to a local server using stdio and expose it as an SSE server
- Fast startup with minimal memory usage
Usage
Installing
# from crates.io
cargo install rmcp-proxy
cargo install --git https://github.com/stephenlacy/mcp-proxy
Building
cargo build --release
Running
The proxy can operate in two modes:
1. SSE Client Mode
Connect to a remote MCP server over SSE and expose it as a stdio server.
This allows a local client such as Claude or Cursor connect to a remote server running on SSE.
Example
mcp-proxy http://localhost:8080/sse
mcp-proxy --headers Authorization 'Bearer YOUR_TOKEN' http://localhost:8080/sse
Using with Claude or Cursor
{
"mcpServers": {
"mcp-proxy": {
"command": "mcp-proxy",
"args": ["http://example.com/sse"]
}
}
}
2. Stdio Client Mode
Connect to a local command using stdio and expose it as an SSE server.
This allows remote SSE connections to a local stdio server.
mcp-proxy --sse-port 8080 -- your-command --arg1 value1 --arg2 value2
mcp-proxy --sse-port 8080 -e KEY VALUE -e ANOTHER_KEY ANOTHER_VALUE -- your-command --arg1 value1 --arg2 value2
mcp-proxy --sse-port 8080 python mcp_server.py
mcp-proxy --sse-port 8080 -- npx -y @modelcontextprotocol/server-everything
Using as a library
use rmcp::{
ServiceExt,
model::{ClientCapabilities, ClientInfo},
transport::{sse::SseTransport, stdio},
};
use rmcp_proxy::proxy_handler::ProxyHandler;
// Create SSE transport
let transport = SseTransport::start(&config.url).await?;
let client_info = ClientInfo {
protocol_version: Default::default(),
capabilities: ClientCapabilities::builder()
.enable_experimental()
.enable_roots()
.enable_roots_list_changed()
.enable_sampling()
.build(),
..Default::default()
};
// Create client service with transport
let client = client_info.serve(transport).await?;
// Get server info
let server_info = client.peer_info();
info!("Connected to server: {}", server_info.server_info.name);
// Create proxy handler
let proxy_handler = ProxyHandler::new(client);
// Create stdio transport
let stdio_transport = stdio();
// Create server with proxy handler and stdio transport
let server = proxy_handler.serve(stdio_transport).await?;
License
MIT