mcp-proxy is an MCP transport bridging tool used to convert between the two MCP transports: Streamable HTTP and stdio. It provides two working modes.
- stdio to SSE/StreamableHTTP This mode starts a proxy server from stdio and connects to a remote SSE server. It enables clients that do not natively support SSE, such as Claude Desktop, to communicate with remote servers via SSE. When using it, the SSE endpoint URL of the MCP server must be passed as the program's first argument; if the remote server uses the Streamable HTTP transport, --transport=streamablehttp must be passed on the mcp-proxy side to force use of that transport.
This mode preserves upstream MCP protocol errors, including error codes and data; for example, -32042 (URL elicitation required) will not lose the authorization URL; ordinary tool execution failures are still returned as isError tool results. The proxy does not retry failed tool calls. When acting as a Streamable HTTP client, session termination DELETE requests (including reading the response body) are limited to five seconds; after cancellation or timeout, closing the response has a cooperative grace period of at most one second. Graceful shutdown of the CLI requires Python 3.11+ after receiving SIGINT; on Python 3.10, SIGINT may interrupt the event loop before the final DELETE is sent. This limitation applies only to termination operations; normal GET streams and POST tool calls retain regular HTTP timeouts.
In reverse Streamable HTTP mode, an HTTP 404 received for a POST on an established upstream session indicates session loss, and the operation will not be retried; subsequent explicit requests may use a replacement session only if the complete initialization handshake matches the original. The proxy does not restore subscriptions, log levels, or other upstream session-local state; after stateful resource or logging operations, or when the handshake changes, the proxy will reject subsequent requests, and the MCP client must restart. Progress notifications are sent only to the currently healthy session and are neither buffered nor replayed.
Configuration is performed by the MCP client, for example by specifying the command and arguments in Claude Desktop's configuration entries. Closing the client's stdin disconnects the remote session and cancels connection establishment, initialization and activity requests; queued input is discarded. Each input frame is limited to 4 MiB of UTF-8 wire payload bytes (excluding CR/LF delimiters); at most 4 MiB and 128 frames may be accepted but unconsumed, and empty frames and malformed frames count toward the frame limit; exceeding the limit causes an error exit. The client must read or close stdout, otherwise an unread stdout pipe that is not fully read may prevent the process from exiting.
II. SSE to stdio This mode starts a proxy server that exposes an SSE service and connects to a local stdio server, so that remote connections can access the local stdio server. mcp-proxy opens a port to listen for SSE requests and starts the local stdio server to handle MCP requests.
The HTTP server is configured via --host and --port, defaulting to 127.0.0.1 and an available port. Wildcard bindings such as 0.0.0.0 require --allowed-host entries for the Host used by clients. Host checking and CORS settings do not authenticate callers by default; --headers and API_ACCESS_TOKEN are used to authenticate upstream client requests, not the callers of this server.
For inbound authentication, set MCP_PROXY_AUTH_TOKEN or pass --auth-bearer-token TOKEN; an explicit CLI value takes precedence over the environment variable; using the environment variable is recommended because local process tools may display command-line arguments. When neither is set, the server remains unauthenticated by default. Once enabled, every HTTP request requires Authorization: Bearer TOKEN, including /status, /healthz, SSE, StreamableHTTP, and named server routes; health probes must also send the token. Configured CORS preflight requests can still work without a token, while ordinary OPTIONS requests require a token. Host and Origin checks continue to apply.
When --pass-environment copies the proxy environment, MCP_PROXY_AUTH_TOKEN is removed from the child process; values explicitly passed via --env or named server configuration remain in that server's environment. This shared token does not provide user identity or roles, nor does it make the proxy compliant with MCP OAuth. When exposing the server beyond a trusted local network, use TLS or a trustednetwork/reverse proxy.
The deprecated --sse-host and --sse-port are still supported as aliases; explicitly provided --host or --port (including --port=0) take precedence. Additional environment variables can be passed to the local stdio server via --env; local server arguments go after the -- delimiter.
Named servers: NAME is used in the URL path /servers/NAME/. COMMAND_STRING is the command to start the server (e.g. 'uvx mcp-server-fetch') and can be used multiple times; if --named-server-config is used, this argument is ignored. FILE_PATH, if provided, serves as the sole source of named servers, and the --named-server CLI argument is ignored. The default server (the command_or_url argument when neither --named-server nor --named-server-config is used) is accessible via the root path (e.g. http://127.0.0.1:8080/sse)。命名服务器通过 /servers/<server-name>/ (e.g. http://127.0.0.1:8080/servers/fetch1/sse)。/status The endpoint provides global state.
--named-server-config JSON configuration file structure: mcpServers is a dictionary, the key is the server name (used for the URL path), and the value defines the server; command is the required execution command; args is an optional argument list, defaulting to an empty list; enabled is optional, and when false the server definition is skipped, defaulting to true; the timeout and transportType fields exist in standard MCP client configurations, but mcp-proxy currently ignores them when loading named servers, and the transport type is implicitly stdio.
Installation: the stable version can be installed via PyPI, and after installation run it with the mcp-proxy command; the latest version can be installed from the git repository; if installed, update it with uv tool upgrade --reinstall, and remove it with uv tool uninstall mcp-proxy. Starting from version 0.3.2, container images can be pulled and run; images are published to GHCR and Docker Hub, with multi-platform manifests for linux/amd64 and linux/arm64, and Docker automatically selects the image matching the host architecture. Runtime image variants include Alpine (the unsuffixed tag and the -alpine tag select Alpine) and Debian (vX.Y.Z-debian, vX.Y.Z-debian-node, etc.); choose Debian for Python packages that need glibc, and choose debian-node for MCP servers that need Node.js tooling (it can run npx packages, but does not bundle all server-specific system libraries, and installing uncached dependencies still requires network access).
Troubleshooting: when Claude Desktop cannot start the server and ENOENT appears, try using the full path to the binary; obtain the path via which mcp-proxy (macOS, Linux) or where.exe mcp-proxy (Windows) and fill it into the command property.
Extending the container image: the debian-node variant includes Node.js, npm, and npx; other OS packages can extend the variant using that distribution's package manager, and the Python virtual environment must remain in the same libc family as the build stage. First uvx or npx startup requires network access to download uncached packages. When exposing the proxy beyond local testing, continue to configure --allowed-host and allowed origins for client addresses; --pass-environment controls which host environment values reach the spawned server process, so use it only when needed. When using a custom Dockerfile, you can define the service in Docker Compose; you need to set the --pass-environment parameter, otherwise the error "No interpreter found in managed installations or search path" will occur; replace mcp.example.com:8096 with the hostname/IP and port that the client sends in the Host header.
For command-line arguments and example configuration files, refer to the project documentation; you can test mcp-proxy with the mcp-server-fetch server, and test the target server with the inspector tool.