Skip to content

feat: add stdio-proxy command for HTTP-to-stdio MCP bridging#14

Draft
wasaga wants to merge 2 commits into
mainfrom
feat/stdio-proxy
Draft

feat: add stdio-proxy command for HTTP-to-stdio MCP bridging#14
wasaga wants to merge 2 commits into
mainfrom
feat/stdio-proxy

Conversation

@wasaga

@wasaga wasaga commented Jan 22, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Add new stdio-proxy command that launches a stdio MCP server subprocess and exposes it via HTTP streaming
  • Subprocess lifecycle management with graceful shutdown and crash detection
  • Automatic capability discovery and forwarding (tools, prompts, resources, resource templates)
  • Request/response logging with terminal-aware formatting (text for TTY, JSON for daemon)
  • Concurrent request handling with shared subprocess model
  • Health checking with 503 responses when subprocess unavailable
  • Full bidirectional MCP support:
    • Notification handlers (logging, tool/prompt/resource list changes)
    • Sampling/CreateMessage (server can request LLM completions from client)
    • Elicitation (server can request user input from client)

Test plan

  • Unit tests for tools, prompts, resources (7 tests)
  • Unit tests for bidirectional features (5 tests):
    • Logging notifications
    • Sampling with and without handler
    • Elicitation with and without handler
  • Manual test with real stdio MCP server
  • Test subprocess crash handling

Usage

# Start proxy for a stdio MCP server
mcp-servers stdio-proxy -addr localhost:8080 -- /path/to/stdio-server

# With debug logging
mcp-servers stdio-proxy -addr localhost:8080 -log-level debug -- /path/to/stdio-server

Add a new `stdio-proxy` command that launches a stdio MCP server subprocess
and exposes it via HTTP streaming. This enables stdio-only MCP servers to be
accessed over HTTP.

Features:
- Subprocess lifecycle management with graceful shutdown
- Automatic capability discovery and forwarding (tools, prompts, resources)
- Request/response logging (summaries at info, full JSON-RPC at debug)
- Terminal-aware logging (text for TTY, JSON for daemon mode)
- Concurrent request handling with shared subprocess
- Health checking with 503 responses when subprocess is unavailable
- Support for notification handlers (tool/prompt/resource list changes)

The implementation uses the official MCP Go SDK's CommandTransport for
subprocess communication and StreamableHTTPHandler for HTTP serving.

Tests use in-memory transports for fast, reliable execution without
spawning actual subprocesses.
Add comprehensive tests for:
- Logging notifications (server -> client)
- Sampling/CreateMessage requests (server -> client -> server)
- Elicitation requests (server -> client -> server)
- Error handling when handlers are not configured

These tests verify that the ProcessManager correctly wires up
notification handlers and forwards bidirectional MCP messages.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant