Skip to main content

fastmcp.client.group

Coordination of independent MCP client connections.

Classes

ToolRoute

The client and upstream name behind a public group tool name.

ClientGroup

Coordinate independent clients without introducing a proxy server. Each client retains its own transport, session, capabilities, and protocol version. The group only combines tool discovery and routes tool calls. Callers may manage the clients’ connections themselves or use the group as a convenience context manager. Entering an already-connected FastMCP client is safe because client contexts are reference counted. Methods:

clients

The group’s clients, keyed by server name. Read-only: membership is fixed at construction, since discovered routes hold the client that advertised each tool and would silently go stale if the mapping were swapped underneath them.

from_config

Create one independent client for each configured server. A server entry may include a FastMCP-specific mode field. It applies only to that server; entries without one use default_mode.

protocol_versions

list_tools

List tools from every client with namespaced names. An explicit call is the group’s catalog-refresh mechanism, so it defaults to cache_mode="refresh": a client-side response cache (SEP-2549) is repopulated rather than served, and the routes reflect what every server advertises now. Pass cache_mode="use" to allow cache hits when staleness within the server’s hint is acceptable.

resolve_tool

Resolve a public tool name to its client and upstream identity. A known route only requires its own client to be connected; one dead server does not couple failures onto calls routed to healthy servers. Loading the catalog (the first resolution, or after a refresh) still requires every client, since discovery queries them all.

call_tool_mcp

Call a namespaced tool and return its raw MCP result.

call_tool

Call a namespaced tool through the client that advertised it.