Skip to content

Multi-Server MCPConfigTransport fails entire session if any server is unreachable #3633

@rishid

Description

@rishid

What happened?

Problem

When using MCPConfigTransport with a multi-server MCPConfig, if any single server in
mcpServers is unreachable at connection time, the entire session fails and the client
receives 0 tools — even if every other server is healthy.

Concrete use case

We run a proxy aggregating 6 upstream RemoteMCPServer entries. In production, servers go
down independently for maintenance. Currently, 1 unreachable server takes down all 6. In CI,
we often start only a subset of servers; we have to generate a trimmed MCPConfig dynamically
to work around this.

Expected behavior

Servers that fail to connect are skipped (with a warning); the session continues with whichever
servers connected successfully. The session only fails if all servers are unreachable.

Actual behavior

connect_session iterates mcpServers and calls _create_proxy() for each, which eagerly
connects via await client.__aenter__(). The first connection failure raises immediately,
cleaning up all transports:

# from MCPConfigTransport.connect_session()
try:
    for name, server_config in self.config.mcpServers.items():
        transport, _client, proxy = await self._create_proxy(
            name, server_config, timeout, stack
        )
except Exception:
    for t in self._transports:
        await t.close()
    self._transports = []
    raise  # one unreachable server kills everything

Investigation

We worked around this by overriding connect_session to duplicate the parent's loop with
per-server try/except, rebuilding the MCPRouter composite manually. The workaround is
functional but breaks on any upstream refactor of connect_session.

Example Code

Version Information

FastMCP version:                                                               3.1.1
MCP version:                                                                  1.26.0
Python version:                                                               3.14.3
Platform:                              Linux-6.8.0-101-generic-x86_64-with-glibc2.35
FastMCP root path: /home/rdhupar/w/mcp/mcp-server/.venv/lib/python3.14/site-packages

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working. Reports of errors, unexpected behavior, or broken functionality.clientRelated to the FastMCP client SDK or client-side functionality.potential-duplicateBot-suggested duplicate awaiting human review. Auto-closes after 3 days if unchallenged.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions