π The fast, Pythonic way to build MCP servers and clients.
Fix static analysis issues
Sandipan Haldar29141cef883d
diff --git a/src/fastmcp/client/transports.py b/src/fastmcp/client/transports.pyindex c8dc0d4cc..4f73e7c80 100644--- a/src/fastmcp/client/transports.py+++ b/src/fastmcp/client/transports.py@@ -6,10 +6,8 @@ import shutilimport sysfrom collections.abc import AsyncIteratorfrom pathlib import Path-from typing import (- TypedDict,-)-from typing import Any+from typing import Any, TypedDict+from exceptiongroup import BaseExceptionGroup, catchfrom mcp import ClientSession, McpError, StdioServerParametersfrom mcp.client.session import (@@ -449,7 +447,7 @@ def infer_transport(# the transport is a websocket URLelif isinstance(transport, AnyUrl | str) and str(transport).startswith("ws"):return WSTransport(url=transport)-+## if the transport is a config dictelif isinstance(transport, dict):if "mcpServers" not in transport:@@ -457,9 +455,11 @@ def infer_transport(else:server = transport["mcpServers"]if len(list(server.keys())) > 1:- raise ValueError("Invalid transport dictionary: multiple servers found - only one expected")+ raise ValueError(+ "Invalid transport dictionary: multiple servers found - only one expected"+ )server_name = list(server.keys())[0]- # Stdio transport+ # Stdio transportif "command" in server[server_name] and "args" in server[server_name]:return StdioTransport(command=server[server_name]["command"],@@ -482,7 +482,7 @@ def infer_transport()raise ValueError("Cannot determine transport type from dictionary")-+# the transport is an unknown typeelse:raise ValueError(f"Could not infer a valid transport from: {transport}")