Skip to main content

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-token flag or MCP_BEARER_TOKEN env var
  • Custom headers — pass any header with -H (workaround for #28293)
  • Graceful shutdown — handles SIGTERM/SIGINT
  • Minimal dependencies — only httpx

How It Works

  1. Reads JSON-RPC messages from stdin (sent by Claude Desktop/Code)
  2. Forwards each message as HTTP POST to the remote MCP server
  3. Parses the response (JSON or SSE) and writes it to stdout
  4. Maintains the Mcp-Session-Id header across requests

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mcp_stdio-0.1.0.tar.gz (9.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mcp_stdio-0.1.0-py3-none-any.whl (6.6 kB view details)

Uploaded Python 3

File details

Details for the file mcp_stdio-0.1.0.tar.gz.

File metadata

  • Download URL: mcp_stdio-0.1.0.tar.gz
  • Upload date:
  • Size: 9.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for mcp_stdio-0.1.0.tar.gz
Algorithm Hash digest
SHA256 df6a72083394745e39ca5c4086a2f0470ce4ff4ac4e4316feb4a7ea2de00c8ca
MD5 96ff6916ef501e09522e7118c96fc0fe
BLAKE2b-256 23ce7d790a4f55926b795cf070d485d2704970d2d1b2b94baf971b25c7eb7233

See more details on using hashes here.

Provenance

The following attestation bundles were made for mcp_stdio-0.1.0.tar.gz:

Publisher: release.yml on shigechika/mcp-stdio

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file mcp_stdio-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: mcp_stdio-0.1.0-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

Hashes for mcp_stdio-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 673cb49e11b09990c473ddbe1f23b11d370fa2bd145536ed0c7b72d406faee64
MD5 4e6d7d8a2e710bf5fbff7e78af8035fd
BLAKE2b-256 111dcba8a9c14c5c8c88f0b193c7b4f73d5e723c341ee8eeb90821410a70e1c6

See more details on using hashes here.

Provenance

The following attestation bundles were made for mcp_stdio-0.1.0-py3-none-any.whl:

Publisher: release.yml on shigechika/mcp-stdio

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page