mcpr-proxy-0.4.42 is not a library.
mcpr (CLI binary)
Multi-process architecture:
- mcprd (daemon/supervisor):
mcpr start— no config needed, just manages proxy and relay lifecycles and monitors health. - proxy (standalone):
mcpr proxy run <config>— snapshots config, forks to background, runs the MCP gateway. Self-terminates if the daemon dies. - relay (singleton):
mcpr relay start <config>— tunnel relay server that accepts WebSocket connections and assigns subdomains. One per machine.
All state lives under ~/.mcpr/.
Module Structure
Three-layer architecture: render (terminal output), logic (data operations), cmd (thin command dispatch).
mcpr-cli/src/
+-- main.rs # Entry point, daemon bootstrap, gateway runtime
+-- state.rs # AppState (axum host container wrapping ProxyState)
+-- proxy.rs # Axum fallback handler → mcpr_core::proxy::pipeline::run
+-- config.rs # CLI args (clap), TOML config, subcommands
+-- render.rs # All terminal output — tables, colors, formatting
+-- admin.rs # Health/readiness admin server
+-- daemon.rs # mcprd supervisor (fork, PID file, health monitor)
+-- proxy_lock.rs # Per-proxy lockfiles under ~/.mcpr/proxies/
+-- relay_lock.rs # Singleton relay lockfile under ~/.mcpr/relay/
+-- logic/ # Core business logic (no printing)
| +-- daemon.rs # Daemon status queries
| +-- proxy.rs # Proxy lifecycle (start/stop/restart)
| +-- relay.rs # Relay lifecycle (stop/restart/status)
| +-- query.rs # DB engine, time parsing, threshold parsing
+-- cmd/ # Thin command handlers (logic → render)
+-- proxy.rs # Proxy lifecycle commands
+-- relay.rs # Relay lifecycle commands
+-- observe.rs # Observability commands (logs, stats, sessions, …)
+-- store.rs # Store maintenance commands
+-- setup.rs # Interactive setup wizard (mcpr proxy setup)
The proxy engine (pipeline, middleware, ProxyState, widgets,
forwarding, rewrite, SSE, health) lives in mcpr_core::proxy. This
binary assembles a ProxyState at boot, wires it into axum, and
delegates every request to pipeline::run.
The event bus (routes ProxyEvent to sinks) lives in mcpr_core::event;
sink implementations (stderr, sqlite, cloud) live in mcpr_integrations.
This binary just registers them via EventManager.