From ccf67012552cc47dcee773133f9c18bb37c083d1 Mon Sep 17 00:00:00 2001 From: Sharath Prakash Date: Mon, 16 Mar 2026 10:42:07 +0530 Subject: [PATCH] fix(mcpplugin): use create_mcp_http_client for streamable HTTP transport MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When headers are provided (e.g. Authorization: Bearer), the transport was creating a bare httpx.AsyncClient with the default 5s timeout, causing MCP tool calls to silently time out on slow backends. Use create_mcp_http_client() which sets a 30s connect timeout and 300s read timeout — the same defaults the MCP SDK uses when no http_client is provided. --- .../src/microsoft_teams/mcpplugin/transport.py | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/packages/mcpplugin/src/microsoft_teams/mcpplugin/transport.py b/packages/mcpplugin/src/microsoft_teams/mcpplugin/transport.py index 83ece8d8..d7736b9b 100644 --- a/packages/mcpplugin/src/microsoft_teams/mcpplugin/transport.py +++ b/packages/mcpplugin/src/microsoft_teams/mcpplugin/transport.py @@ -9,7 +9,7 @@ import httpx from mcp.client.sse import sse_client -from mcp.client.streamable_http import streamable_http_client +from mcp.client.streamable_http import create_mcp_http_client, streamable_http_client ValueOrFactory = Union[str, Callable[[], Union[str, Awaitable[str]]]] @@ -31,12 +31,8 @@ async def create_streamable_http_transport( else: resolved_headers[key] = str(value) - if resolved_headers: - async with httpx.AsyncClient(headers=resolved_headers) as http_client: - async with streamable_http_client(url, http_client=http_client) as (read_stream, write_stream, _): - yield read_stream, write_stream - else: - async with streamable_http_client(url) as (read_stream, write_stream, _): + async with create_mcp_http_client(headers=resolved_headers or None) as http_client: + async with streamable_http_client(url, http_client=http_client) as (read_stream, write_stream, _): yield read_stream, write_stream