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

Uploaded Python 3

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

Hashes for mcp_stdio-0.2.1.tar.gz
Algorithm Hash digest
SHA256 004c60afe33551b402d168fecfd9fcd740ba4a03bd924fd59eb69520978af10a
MD5 df5fd0147766f73a875bd179eb160a26
BLAKE2b-256 e049aa658aea5488f709404cc380a91d197f7282403a56737dc6bfb7a19edef2

See more details on using hashes here.

Provenance

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

Hashes for mcp_stdio-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 34404b01baf237a0edbe20217f0e848421a63148ed2e708c57c2c53b308ba160
MD5 82adafee56edc688b1304ff21ee8ad6f
BLAKE2b-256 11354513092d96673d47f48dabda88d62cbf0fc544ccce73ce3ec15ede2a269f

See more details on using hashes here.

Provenance

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