MCP Clients, Transports & Tool Discovery
Connect to local and remote MCP servers, discover tools safely and handle multiple servers without turning the client into spaghetti.
One desktop agent, two MCP servers
Suppose a developer assistant needs a local filesystem server and a remote issue-tracker server. The transport choice should match where the capability lives.
Desktop agent
├─ stdio → local-files MCP → ~/project
└─ HTTPS → issue-tracker MCP → company API
servers = {
"files": StdioServer(command="python", args=["files_server.py"]),
"issues": HttpServer(url="https://tools.example.com/mcp")
}
for name, server in servers.items():
tools = await server.list_tools()
registry.add(namespace=name, tools=tools)Name tools defensively
Expose them to the agent as files.read_file and issues.read_issue so identical tool names cannot collide.
Cache with intent
Cache stable tool lists, but refresh when the server version or capability set changes.
Trade-off: stdio is simple and private for local tools; remote HTTP is shareable and scalable but introduces authentication, network failures and latency.