mcp-relay-1.0.0 is not a library.
mcp-relay
A lightweight MCP (Model Context Protocol) stdio-to-HTTP relay written in Rust.
Why?
I wanted to use O'Reilly's MCP server in Claude Desktop. The problem: Claude Desktop only supports stdio-based MCP servers, but O'Reilly's server uses Streamable HTTP with Bearer token authentication.
The existing Node.js solution (mcp-remote) works, but consumes ~70MB of RAM just to sit there and proxy JSON. That felt wrong for what is essentially "read stdin, POST it, write response to stdout."
So I built mcp-relay in Rust. It does the same job in ~2.6MB of RAM with a ~1.9MB binary.
Features
- Bridges MCP stdio transport to remote Streamable HTTP servers
- Custom HTTP headers via
-Hflag (for Bearer tokens, API keys, etc.) - Async handling of JSON-RPC notifications (fire-and-forget) and requests (wait for response)
- Tiny footprint: ~1.9MB binary, ~2.6MB RAM at runtime
Install
Usage
Options
| Flag | Description |
|---|---|
-H <KEY> <VALUE> |
Add custom HTTP header (can be repeated) |
-h, --help |
Print help |
Example
Claude Desktop Configuration
Add to your claude_desktop_config.json:
If
cargo installputs the binary in a path Claude Desktop can't find, use the full path (e.g.,/Users/you/.cargo/bin/mcp-relay).
Comparison
| mcp-relay (Rust) | mcp-remote (Node.js) | |
|---|---|---|
| Binary size | ~1.9 MB | ~70 MB (node_modules) |
| RAM usage | ~2.6 MB | ~70 MB |
| Dependencies | 4 crates | npm ecosystem |
| Startup | Instant | ~2s (npx download) |
License
MIT