https://github.com/stephenlacy/mcp-proxy
Fast rust MCP proxy between stdio and SSE
https://github.com/stephenlacy/mcp-proxy
agents mcp mcp-client mcp-server proxy
Last synced: 6 months ago
JSON representation
Fast rust MCP proxy between stdio and SSE
- Host: GitHub
- URL: https://github.com/stephenlacy/mcp-proxy
- Owner: stephenlacy
- License: mit
- Created: 2025-04-15T06:25:21.000Z (6 months ago)
- Default Branch: main
- Last Pushed: 2025-04-24T15:24:44.000Z (6 months ago)
- Last Synced: 2025-04-24T16:28:38.906Z (6 months ago)
- Topics: agents, mcp, mcp-client, mcp-server, proxy
- Language: Rust
- Homepage:
- Size: 13.7 KB
- Stars: 5
- Watchers: 1
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-mcp-servers - stephenlacy/mcp-proxy - based proxy facilitating bidirectional communication between stdio and SSE for MCP servers. (☁️ Cloud Platforms & Services)
- awesome-mcp-servers - **mcp-proxy** - Fast rust MCP proxy between stdio and SSE `http` `git` `github` `rust` `agents` `cargo install --git https://github.com/stephenlacy/mcp-proxy` (Other)
- awesome-mcp-servers - **mcp-proxy** - Fast rust MCP proxy between stdio and SSE `http` `git` `github` `rust` `agents` `cargo install --git https://github.com/stephenlacy/mcp-proxy` (Other)
README
# mcp-proxy
> A Rust bidirectional MCP proxy between stdio and SSE. Based initially on [sparfenyuk/mcp-proxy](https://github.com/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
```bash
# from crates.io
cargo install rmcp-proxycargo install --git https://github.com/stephenlacy/mcp-proxy
```### Building
```bash
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
```bash
mcp-proxy http://localhost:8080/sse
mcp-proxy --headers Authorization 'Bearer YOUR_TOKEN' http://localhost:8080/sse
```##### Using with Claude or Cursor
```json
{
"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.
```bash
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
```rust
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