Stdio-to-HTTP relay for MCP servers
Project description
mcp-stdio
English | 日本語
Stdio-to-HTTP relay for MCP servers — bridges Claude Desktop/Code to remote Streamable HTTP endpoints.
Why?
MCP clients like Claude Desktop and Claude Code see mcp-stdio as a locally running self-hosted MCP server, while it relays all requests to a remote MCP server over Streamable HTTP:
graph LR
A[Claude Desktop / Code] -- stdio --> B[mcp-stdio]
B -- HTTPS --> C[Remote MCP Server]
It also works around known issues with HTTP transport in Claude Code (#28293) where custom headers are not forwarded on tool calls.
Install
pip install mcp-stdio
Or with uv:
uv tool install mcp-stdio
Or run directly without installing:
uvx mcp-stdio https://your-server.example.com:8080/mcp
Quick Start
mcp-stdio https://your-server.example.com:8080/mcp
With Bearer token authentication:
mcp-stdio https://your-server.example.com:8080/mcp --bearer-token YOUR_TOKEN
With custom headers:
mcp-stdio https://your-server.example.com:8080/mcp -H "X-API-Key: YOUR_KEY"
Claude Desktop Configuration
Add to claude_desktop_config.json:
{
"mcpServers": {
"my-remote-server": {
"command": "mcp-stdio",
"args": [
"https://your-server.example.com:8080/mcp",
"--bearer-token", "YOUR_TOKEN"
]
}
}
}
Config file locations:
- macOS:
~/Library/Application Support/Claude/claude_desktop_config.json - Windows:
%APPDATA%\Claude\claude_desktop_config.json - Linux:
~/.config/Claude/claude_desktop_config.json
Claude Code Configuration
claude mcp add my-remote-server -- \
mcp-stdio https://your-server.example.com:8080/mcp \
--bearer-token YOUR_TOKEN
Usage
mcp-stdio [OPTIONS] URL
Arguments:
URL Remote MCP server URL
Options:
--bearer-token TOKEN Bearer token (or set MCP_BEARER_TOKEN env var)
-H 'Key: Value' Custom header (can be repeated)
--timeout-connect SEC Connection timeout (default: 10)
--timeout-read SEC Read timeout (default: 120)
-V, --version Show version
-h, --help Show help
Features
- Retry with backoff — retries up to 3 times on connection errors
- Session recovery — resets MCP session ID on 404 and retries
- Bearer token auth — via
--bearer-tokenflag orMCP_BEARER_TOKENenv var - Custom headers — pass any header with
-H(workaround for #28293) - Graceful shutdown — handles SIGTERM/SIGINT
- Minimal dependencies — only httpx
How It Works
- Reads JSON-RPC messages from stdin (sent by Claude Desktop/Code)
- Forwards each message as HTTP POST to the remote MCP server
- Parses the response (JSON or SSE) and writes it to stdout
- Maintains the
Mcp-Session-Idheader across requests
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file mcp_stdio-0.2.1.tar.gz.
File metadata
- Download URL: mcp_stdio-0.2.1.tar.gz
- Upload date:
- Size: 12.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
004c60afe33551b402d168fecfd9fcd740ba4a03bd924fd59eb69520978af10a
|
|
| MD5 |
df5fd0147766f73a875bd179eb160a26
|
|
| BLAKE2b-256 |
e049aa658aea5488f709404cc380a91d197f7282403a56737dc6bfb7a19edef2
|
Provenance
The following attestation bundles were made for mcp_stdio-0.2.1.tar.gz:
Publisher:
release.yml on shigechika/mcp-stdio
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
mcp_stdio-0.2.1.tar.gz -
Subject digest:
004c60afe33551b402d168fecfd9fcd740ba4a03bd924fd59eb69520978af10a - Sigstore transparency entry: 1202022889
- Sigstore integration time:
-
Permalink:
shigechika/mcp-stdio@48b3e1d7c4ca8b08fe1d2687f9ee0292f9dfd48a -
Branch / Tag:
refs/tags/v0.2.1 - Owner: https://github.com/shigechika
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@48b3e1d7c4ca8b08fe1d2687f9ee0292f9dfd48a -
Trigger Event:
push
-
Statement type:
File details
Details for the file mcp_stdio-0.2.1-py3-none-any.whl.
File metadata
- Download URL: mcp_stdio-0.2.1-py3-none-any.whl
- Upload date:
- Size: 6.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
34404b01baf237a0edbe20217f0e848421a63148ed2e708c57c2c53b308ba160
|
|
| MD5 |
82adafee56edc688b1304ff21ee8ad6f
|
|
| BLAKE2b-256 |
11354513092d96673d47f48dabda88d62cbf0fc544ccce73ce3ec15ede2a269f
|
Provenance
The following attestation bundles were made for mcp_stdio-0.2.1-py3-none-any.whl:
Publisher:
release.yml on shigechika/mcp-stdio
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
mcp_stdio-0.2.1-py3-none-any.whl -
Subject digest:
34404b01baf237a0edbe20217f0e848421a63148ed2e708c57c2c53b308ba160 - Sigstore transparency entry: 1202022892
- Sigstore integration time:
-
Permalink:
shigechika/mcp-stdio@48b3e1d7c4ca8b08fe1d2687f9ee0292f9dfd48a -
Branch / Tag:
refs/tags/v0.2.1 - Owner: https://github.com/shigechika
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@48b3e1d7c4ca8b08fe1d2687f9ee0292f9dfd48a -
Trigger Event:
push
-
Statement type: