Expand description
A minimal MCP gateway: one endpoint in front of several upstream MCP servers.
McpGateway::build connects to each Upstream, lists its tools and
registers each one as <prefix>__<tool> on an ordinary McpServer;
calling it forwards the call to that upstream. The gateway’s caller
authenticates to the gateway (put McpServer::require_bearer_tokens or
[McpServer::require_oauth] on the server build returns); upstreams
get only the headers configured for them — the caller’s token is never
passed on. McpGateway::allow decides which caller (the sub of
McpContext::auth_claims) sees which tools, and nothing is allowed
unless a rule says so.
Minimal on purpose: tools are listed once, at build; upstream resources,
prompts and notifications are not federated; each upstream speaks the
protocol version it negotiated with the gateway.
Structs§
- McpGateway
- Builds a gateway
McpServer; see the module docs. - Upstream
- An upstream MCP server (Streamable HTTP).
Constants§
- SEPARATOR
- Separates an upstream’s prefix from its tool names.