mcp-proxy supervises local stdio MCP servers and exposes them over HTTP while
providing an interactive debug TUI.
Core runtime flow:
- Load JSON config.
- Construct
proxy.Managerfor configured processes. - Start auto-start processes.
- Start HTTP servers:
- main control-plane (
listenAddr) - optional per-process listeners (
port)
- main control-plane (
- Start TUI (unless
-no-tui).
Parses and validates runtime configuration.
Responsibilities:
- normalize defaults (
listenAddr, processtransport) - validate required process fields (
name,command)
Process supervision and JSON-RPC routing layer.
Responsibilities:
- spawn/stop/restart child MCP processes
- stdio framing (
content-lengthornewline) - correlate request IDs to responses
- expose process status snapshots and event history
HTTP frontends for manager operations.
Main server:
- health/status/events
- lifecycle operations
- RPC forwarding by process name
Per-process server:
- dedicated
POST /rpcendpoint for one process
Bubble Tea/Bubbles operator console.
Responsibilities:
- process table
- debug log viewport + selected-line inspector
- keyboard/mouse control for focus, navigation, lifecycle actions
- resizable split panes
RPC path:
- HTTP request reaches control or per-process endpoint.
- Handler forwards payload to
Manager.DoRPC. - Managed process writes request to stdio transport.
- Response is parsed from stdio and matched by JSON-RPC
id. - HTTP handler returns response payload to caller.
Observability path:
- Runtime emits lifecycle/request/response/error events.
- Manager stores a bounded in-memory event ring.
- Events are surfaced through:
GET /v1/events- TUI log viewport
- One
managedProcessper configured MCP. - Each process uses dedicated goroutines for:
- stdout read loop
- stderr read loop
- process wait/exit monitoring
- Manager/state synchronization uses mutexes and atomic counters.
- Some MCP servers require
transport: "newline"instead ofcontent-length. - Per-process
portendpoints simplify client configuration and debugging. - TUI is optional for headless operation via
-no-tui.