What is Mcp Broker?
Mcp Broker is a local Model Context Protocol process broker that sits as a facade in front of many upstream MCP servers. It manages upstream startup, reuse, cleanup, profile exposure, status, and safe tool routing — analogous to PgBouncer for MCP. It is designed for developers using MCP clients (Codex, Claude Code, Gemini CLI) who have more tools than they want in every session and need a single stable local endpoint.
How to use Mcp Broker?
Install via pipx install mcp-broker, uv tool install mcp-broker, or brew install mcp-broker. After installation, run make setup to create a local venv, then make config-init to create a private config from the public template. Edit config/broker.private.yaml for local upstreams, then make config-validate to validate the YAML contract. Start the broker with make broker-start and check status with make broker-status. Wire MCP clients using make config-render CLIENT=<client> (e.g., codex, claude, gemini) after reviewing rendered files.
Key features of Mcp Broker
- Runs one local broker daemon over a Unix socket.
- Starts upstream MCP servers on demand and reuses shared upstreams across sessions.
- Maps upstream tools into stable namespaces exposed via compact broker facade tools.
- Enforces profile-level tool budgets and exposure gates.
- Blocks mutating upstream exposure unless a profile allowlist grants it.
- Provides cross-platform daemon management: LaunchAgent, systemd, and Windows Scheduled Task.
- Includes dry‑run, backup, and rollback for client config rendering.
Use cases of Mcp Broker
- Reduce context window bloat by replacing many raw tool definitions with a single broker facade (measured 93% reduction in tool definitions, 84% in tokens).
- Share upstream MCP servers (OAuth, browser state, databases) across different client sessions without duplicate processes.
- Apply per‑client profiles so each session sees only the tools relevant to the task.
- Centralize lifecycle cleanup to avoid orphaned MCP processes after client sessions exit.
评论