Skip to content

Commit 4d2a334

Browse files
authored
Merge pull request #2 from sandipan1/feature/load-server-config-client
2 parents b9ff33b + 29141ce commit 4d2a334

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

src/fastmcp/client/transports.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,8 @@
66
import sys
77
from collections.abc import AsyncIterator
88
from pathlib import Path
9-
from typing import (
10-
TypedDict,
11-
)
12-
from typing import Any
9+
from typing import Any, TypedDict
10+
1311
from exceptiongroup import BaseExceptionGroup, catch
1412
from mcp import ClientSession, McpError, StdioServerParameters
1513
from mcp.client.session import (
@@ -449,17 +447,19 @@ def infer_transport(
449447
# the transport is a websocket URL
450448
elif isinstance(transport, AnyUrl | str) and str(transport).startswith("ws"):
451449
return WSTransport(url=transport)
452-
450+
453451
## if the transport is a config dict
454452
elif isinstance(transport, dict):
455453
if "mcpServers" not in transport:
456454
raise ValueError("Invalid transport dictionary: missing 'mcpServers' key")
457455
else:
458456
server = transport["mcpServers"]
459457
if len(list(server.keys())) > 1:
460-
raise ValueError("Invalid transport dictionary: multiple servers found - only one expected")
458+
raise ValueError(
459+
"Invalid transport dictionary: multiple servers found - only one expected"
460+
)
461461
server_name = list(server.keys())[0]
462-
# Stdio transport
462+
# Stdio transport
463463
if "command" in server[server_name] and "args" in server[server_name]:
464464
return StdioTransport(
465465
command=server[server_name]["command"],
@@ -482,7 +482,7 @@ def infer_transport(
482482
)
483483

484484
raise ValueError("Cannot determine transport type from dictionary")
485-
485+
486486
# the transport is an unknown type
487487
else:
488488
raise ValueError(f"Could not infer a valid transport from: {transport}")

0 commit comments

Comments
 (0)