Back to blog

MCP Server Composition: Diagramming Server-to-Server Agent Architectures (2026)

How to diagram MCP server composition — the pattern where an MCP server acts as a client to other MCP servers. Covers gateway/aggregator patterns, auth passthrough, and recursive tool routing, with prompt templates.

R
Ryan·Senior AI Engineer
·

Early Model Context Protocol architectures were single-hop: one host application, one MCP client, talking to one or more MCP servers that each expose their own tools directly. As MCP deployments matured through 2026, a recursive pattern became common — MCP server composition, where a server is itself a client to one or more downstream MCP servers, re-exposing (or transforming) their tools as its own. This is architecturally different enough from the basic MCP pattern that it deserves its own diagram conventions.

This guide covers the two dominant composition shapes — the gateway pattern and the aggregator pattern — and how to diagram the auth, routing, and failure-handling concerns that only appear once you have more than one hop.

Why compose MCP servers at all

Composition solves problems that a single-hop architecture can't: centralizing auth for a fleet of internal MCP servers behind one gateway, presenting a unified tool surface to the host application from several specialized backend servers, or wrapping a third-party MCP server to add caching, rate limiting, or policy enforcement without modifying it. In each case, the composing server holds both an MCP server role (toward the host application) and an MCP client role (toward the downstream servers) simultaneously — this dual role is the detail most diagrams get wrong by drawing it as a single arrow passing straight through.

Pattern 1: the gateway (auth and policy consolidation)

A gateway server sits between the host application and a set of internal MCP servers, terminating the host's authentication and re-authenticating to each downstream server with its own service-level credentials. This lets you enforce a single policy layer — rate limiting, audit logging, tool allow-listing — in one place instead of in every backend server. In your diagram, show the gateway with two distinct credential boundaries: the inbound boundary (host-to-gateway, typically OAuth with user-level scopes) and the outbound boundary (gateway-to-backend, typically a service credential with broader or differently-scoped permissions). Never draw these as the same trust boundary — a common security mistake in practice is silently forwarding the user's original token downstream without re-scoping it.

Pattern 2: the aggregator (unified tool surface)

An aggregator server queries several downstream MCP servers' tool lists at startup (or on a refresh interval), merges them into a single namespace, and routes each incoming tool call to the correct backend server based on the tool name. This is the pattern behind "MCP marketplace" or "MCP hub" products that let a host application connect to one endpoint and get access to dozens of underlying integrations. In your diagram, show the aggregator's tool registry as a stateful component refreshed on an interval (not real-time — tool lists can go stale between refreshes), and show the routing table that maps each aggregated tool name back to its originating backend server and that server's own auth context.

Failure handling across multiple hops

Composition introduces a failure mode that single-hop MCP doesn't have: a downstream server can be unreachable, slow, or return an error, and the composing server must decide whether to fail the whole request, return a partial tool list, or fall back to a cached response. Your diagram should show this decision point explicitly — label it with the composing server's actual policy (fail-fast, degrade gracefully, or serve stale cache) rather than leaving it implicit. This is also where timeout budgets matter: a gateway aggregating five backend servers with a 10-second host-facing SLA needs an explicit per-backend timeout budget, not just "call them all and see what happens."

Prompt templates for MCP server composition diagrams

Auth gateway in front of internal MCP servers

"A coding agent host authenticates to an internal MCP gateway using OAuth with user-scoped permissions. The gateway validates the token, applies a tool allow-list policy per user role, and re-authenticates to three internal MCP servers (a Jira server, a Postgres server, and an internal deploy-tooling server) using separate service credentials with broader backend permissions. The gateway logs every tool call with the originating user identity for audit purposes. Show the gateway holding both an MCP server role (toward the host) and an MCP client role (toward each backend), with distinct credential boundaries on each side and the audit log as a side-effect of every routed call."

Aggregator exposing a unified tool surface

"An MCP aggregator server connects to six third-party MCP servers (Slack, GitHub, Notion, Linear, Google Drive, and a custom internal server) at startup, fetches each one's tool list, and merges them into a single namespaced tool registry refreshed every five minutes. A host application connects only to the aggregator and sees one combined tool list. When a tool call arrives, the aggregator's routing table maps it back to the correct backend server and its own stored credential for that service. If a backend server is unreachable, the aggregator serves its last cached tool list for that server and marks its tools as degraded rather than failing the whole request. Show the per-backend credential store, the refresh interval, and the degraded-mode fallback path explicitly."

MCP composition component reference

ComponentRoleKey diagram annotation
Composing serverDual role: MCP server upstream, MCP client downstreamLabel both roles separately
Inbound credentialHost application's auth to the composing serverScope, token type, expiry
Outbound credential(s)Composing server's own auth to each backendPer-backend scope, rotation policy
Tool registryMerged/routed tool namespaceRefresh interval, staleness handling
Fallback policyBehavior when a backend is unreachableFail-fast / degrade / stale cache

Frequently asked questions about MCP server composition

What is MCP server composition?

MCP server composition is the pattern where an MCP server acts as a client to one or more other MCP servers, rather than only exposing its own tools directly to a host application. The composing server holds both a server role (toward whatever connects to it) and a client role (toward the servers it connects to downstream), enabling gateway, aggregator, and proxy-style architectures.

How do I diagram credential passthrough safely?

Never draw a single arrow implying the host's original credential passes unchanged all the way to a backend server. Show two distinct credential boundaries: the inbound one (host to composing server) and the outbound one (composing server to each backend), each with its own scope and lifetime. If the composing server does forward the original user token unmodified, label that explicitly — it's a legitimate pattern in some designs, but it must be a visible, deliberate decision in the diagram, not an implicit default.

Is an MCP aggregator the same as an API gateway?

Conceptually similar, but not identical. A traditional API gateway routes based on URL paths or headers over HTTP. An MCP aggregator routes based on tool names within the MCP protocol's own message format, and must additionally maintain a live (or periodically refreshed) picture of which tools each backend currently exposes, since MCP servers can add or remove tools dynamically. See the API gateway architecture diagram guide for the closest traditional analog.

Related guides: MCP architecture diagrams, agent skills architecture, AI gateway architecture, and zero-trust architecture.

Ready to try it yourself?

Start Creating - Free