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.2.0.tar.gz (11.8 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.2.0-py3-none-any.whl (6.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: mcp_stdio-0.2.0.tar.gz
  • Upload date:
  • Size: 11.8 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.2.0.tar.gz
Algorithm Hash digest
SHA256 c5d0b5591a3b7bb2721f7c51229fbaac1db7c8673c55bfc54a3129998a8436e4
MD5 d5f543bd05bb23dd185a8e12d4db964e
BLAKE2b-256 836c928982a7c3fab554dabf7f786aaddc9046400b744d17977ec52bd4fda519

See more details on using hashes here.

Provenance

The following attestation bundles were made for mcp_stdio-0.2.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.2.0-py3-none-any.whl.

File metadata

  • Download URL: mcp_stdio-0.2.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.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5ccd8cef499364f64570af7844c1caf0e51e9ddee85ef0a5cdac4a6d16f21f9c
MD5 8c9fc8bc4c558d9ceebda1adbe96c5bf
BLAKE2b-256 a7912cba4e8e2719d056939074079e067e1db60a1e1dde1e58dcdb664e839992

See more details on using hashes here.

Provenance

The following attestation bundles were made for mcp_stdio-0.2.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