Skip to content

πŸš€ The fast, Pythonic way to build MCP servers and clients.

Unpack tuple properly

Jeremiah Lowin573479df4230
diff --git a/src/fastmcp/client/transports.py b/src/fastmcp/client/transports.py
index 5e4908f6c..9f12f9ae9 100644
--- a/src/fastmcp/client/transports.py
+++ b/src/fastmcp/client/transports.py
@@ -18,8 +18,8 @@ from mcp.client.session import (
)
from mcp.client.sse import sse_client
from mcp.client.stdio import stdio_client
-from mcp.client.websocket import websocket_client
from mcp.client.streamable_http import streamablehttp_client
+from mcp.client.websocket import websocket_client
from mcp.shared.memory import create_connected_server_and_client_session
from pydantic import AnyUrl
from typing_extensions import Unpack
@@ -125,6 +125,7 @@ class SSETransport(ClientTransport):
def __repr__(self) -> str:
return f"<SSE(url='{self.url}')>"
+
class StreamableHttpTransport(ClientTransport):
"""Transport implementation that connects to an MCP server via Streamable HTTP Requests."""
@@ -141,7 +142,7 @@ class StreamableHttpTransport(ClientTransport):
self, **session_kwargs: Unpack[SessionKwargs]
) -> AsyncIterator[ClientSession]:
async with streamablehttp_client(self.url, headers=self.headers) as transport:
- read_stream, write_stream = transport
+ read_stream, write_stream, _ = transport
async with ClientSession(
read_stream, write_stream, **session_kwargs
) as session:
@@ -152,7 +153,6 @@ class StreamableHttpTransport(ClientTransport):
return f"<StreamableHttp(url='{self.url}')>"
-
class StdioTransport(ClientTransport):
"""
Base transport for connecting to an MCP server via subprocess with stdio.