Skip to content

Commit 1e554cb

Browse files
committed
Fix MCPStreamableHTTPTool auth headers not being passed correctly
1 parent accc8a3 commit 1e554cb

File tree

1 file changed

+6
-2
lines changed
  • libraries/microsoft-agents-a365-tooling-extensions-agentframework/microsoft_agents_a365/tooling/extensions/agentframework/services

1 file changed

+6
-2
lines changed

libraries/microsoft-agents-a365-tooling-extensions-agentframework/microsoft_agents_a365/tooling/extensions/agentframework/services/mcp_tool_registration_service.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
from agent_framework import ChatAgent, ChatMessage, ChatMessageStoreProtocol, MCPStreamableHTTPTool
1010
from agent_framework.azure import AzureOpenAIChatClient
1111
from agent_framework.openai import OpenAIChatClient
12+
import httpx
1213

1314
from microsoft_agents.hosting.core import Authorization, TurnContext
1415

@@ -114,11 +115,14 @@ async def add_tool_servers_to_agent(
114115
self._orchestrator_name
115116
)
116117

117-
# Create and configure MCPStreamableHTTPTool
118+
# Create httpx client with auth headers configured
119+
http_client = httpx.AsyncClient(headers=headers, timeout=60.0)
120+
121+
# Create and configure MCPStreamableHTTPTool with http_client
118122
mcp_tools = MCPStreamableHTTPTool(
119123
name=server_name,
120124
url=config.url,
121-
headers=headers,
125+
http_client=http_client,
122126
description=f"MCP tools from {server_name}",
123127
)
124128

0 commit comments

Comments
 (0)