Azure / Azure/azure-sdk-for-python

Cannot add multiple MCP servers to agent

Open
#42,694 6 comments 0 reactions 1 assignee Claimed by @glharper View on GitHub
AI AI Agents customer-reported needs-team-attention question Service Attention
Dominant language
Python
Stars
5.6k
Forks
3.4k
Avg merge
1d 21h
Merged PRs (30d)
193

Description

- **Package Name**: azure-ai-agents
- **Package Version**: 1.2.0b2
- **Operating System**: Windows
- **Python Version**: 3.11.9

**Describe the bug**
Can not connect to multiple MCP servers. According the document, https://learn.microsoft.com/en-us/azure/ai-foundry/agents/how-to/tools/model-context-protocol?utm_source=chatgpt.com, multiple MCP servers can be supported for an agent. But when create two McpTool objects with two different MCP server information and call ToolSet.add(), exception will be thrown.

**To Reproduce**
Below is the sample codes causing exception.

mcp_toolset = ToolSet()
mcp_tool1 = McpTool(server_label="label1",server_url="url1")
mcp_toolset.add(mcp_tool1)
mcp_tool2 = McpTool(server_label="label2",server_url="url2")
mcp_toolset.add(mcp_tool2) ------> Here exception will be thrown that not allow two tools with same type added to ToolSet(). Below is the exception information.

raise ValueError("Tool of type {type(tool).__name__} already exists in the ToolSet.")
ValueError: Tool of type {type(tool).__name__} already exists in the ToolSet.

**Expected behavior**
Multiple MCP servers should be configured with agent successfully

**Screenshots**
If applicable, add screenshots to help explain your problem.

**Additional context**
Add any other context about the problem here.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.