Compound MCPs
Combine multiple MCP server instances into a single virtual endpoint with configurable routing — expose all tools simultaneously, fail over automatically, or route conditionally based on runtime expressions.
Overview
A Compound MCP is a virtual MCP server that proxies requests to one or more underlying MCP server instances. Instead of wiring each MCP separately into your agent, you create one Compound MCP that aggregates them and present a unified tool surface. This gives you a clean separation between how agents consume tools and how those tools are deployed. You can swap, reorder, or add member servers without changing any agent configuration.Key Concepts
Routing Modes
Control how requests are distributed across member servers — simultaneously, in priority order, or by condition.
Tool Namespacing
Each member’s tools are prefixed with a namespace to avoid collisions when multiple servers expose identically named tools.
Status Aggregation
Compound MCP health rolls up from its members: all running →
running, some running → degraded, none → stopped.Routing Modes
- parallel
- fallback
- conditional
All member tools are exposed simultaneously. When an agent calls a tool, it is routed to whichever member owns that tool based on the namespace prefix.Use this when: you want to give an agent access to the combined tool surface of multiple MCP servers at once.This is the default routing mode.
Tool Namespacing
When multiple MCP servers expose tools with the same name (e.g.search), Compound MCP avoids collisions by prefixing each member’s tools with a namespace.
The namespace is resolved in this order:
- The
namespace_prefixfield in the member’sconfig— use this for human-readable names. - The first 8 characters of the MCP instance UUID — used as a stable fallback when no prefix is set.
Tool Aliases
Within the memberconfig, you can also define an aliases map to rename tools before they are exposed:
create_issue becomes gh__open_ticket in the compound’s tool list.
Status Aggregation
The Compound MCP computes a rolled-up status from its members:| Member statuses | Compound status |
|---|---|
All running | running |
At least one running, others not | degraded |
None running | stopped |
| No members | unknown |
degraded compound can still serve requests — only the unavailable members are affected.
API Reference
Base path:/v1/compound-mcps
Compound MCP endpoints
| Method | Path | Description |
|---|---|---|
POST | / | Create a compound MCP |
GET | / | List all compound MCPs |
GET | /{id} | Get a compound MCP |
PUT | /{id} | Update a compound MCP |
DELETE | /{id} | Delete a compound MCP |
Member endpoints
| Method | Path | Description |
|---|---|---|
GET | /{id}/members | List members (includes computed namespace) |
POST | /{id}/members | Add a member |
DELETE | /{id}/members/{instance_id} | Remove a member |
Practical Examples
Example 1 — Unified Dev Tools (parallel)
Expose GitHub, Linear, and Slack to an agent through a single endpoint.Example 2 — Redundant Search (fallback)
Point two search MCP instances at the same backend with primary/backup priority.Both members share the same
namespace_prefix here because they expose identical tools — the agent’s tool names stay consistent regardless of which backend is active.Example 3 — Environment-based Routing (conditional)
Route to a staging MCP in development and the production MCP in production.Nesting Limits
The nesting depth limit (MAX_NESTING_DEPTH = 3) exists to prevent runaway composition chains that could create unbounded resolution graphs. Design your compound hierarchy to stay shallow — most use cases need only one level.
Member Config Reference
Theconfig object on each member accepts the following fields:
| Field | Type | Description |
|---|---|---|
namespace_prefix | string | Human-readable prefix for this member’s tools. Falls back to first 8 chars of instance ID. |
aliases | object | Map of { original_tool_name: alias_name }. Applied after namespacing. |
condition_expression | string | Expression evaluated at request time for conditional routing mode. |
config ({}) is valid and uses defaults.
Best Practices
Always set namespace_prefix
The auto-generated prefix (first 8 chars of UUID) is stable but opaque. Set an explicit
namespace_prefix so tool names are readable and predictable for your agents.Use order deliberately in fallback mode
Lower
order values are tried first. Assign order=0 to your most reliable instance, increasing values for progressively less preferred backups.Prefer parallel for tool aggregation
When combining different MCP servers (e.g. code + search + communication),
parallel is almost always the right mode — each tool routes deterministically by namespace.Monitor degraded status
A
degraded compound still functions but with reduced capability. Set up alerts when compound status transitions to degraded so you can remediate unhealthy members.