Description
Describe the bug
When using multiple MCP servers with identically named tools (but potentially different behaviors or arguments) in OpenAI's Agents SDK, the SDK raises a Duplicate tool names found across MCP servers
error, preventing simultaneous usage.
This is particularly problematic when integrating with third-party MCP servers—name collisions might be unavoidable. For instance, both GitHub and Linear MCP servers might expose a tool called create_issue
, making it impossible to use both without tool name differentiation which the consumer has no control over.
Debug information
- Agents SDK version: v0.0.8
- Python version: Python 3.13.2
Repro steps
Run the following minimal Python script:
import json
from agents import Agent, Runner
from agents.mcp.server import MCPServerStdio
import asyncio
async def main():
async with MCPServerStdio(params={"command": "terminal-stdio", "args": []}) as server:
async with MCPServerStdio(params={"command": "some-other-stdio", "args": []}) as server2:
tools = await server.list_tools()
print("Tools: ", json.dumps(tools, indent=4, default=lambda o: o.__dict__))
agent = Agent(
name="Assistant",
instructions="Use the tools to achieve the task",
mcp_servers=[server, server2],
model="gpt-4o-mini"
)
result = await Runner.run(agent, "Hi there, how are you?")
print("Result: ", result.final_output)
if __name__ == "__main__":
asyncio.run(main())
Expected behavior
The SDK should either namespace or differentiate identically named tools from different MCP servers, allowing simultaneous and clear invocation of each distinct tool.
Crosslinks
Similar behavior observed in other MCP clients such as the VSCode where identically named tools across servers are de-duplicated or hidden from the UI, limiting usability in multi-server setups. Cursor on the other hand uses mcp_<server>_<tool_name>
to avoid collisions and doesn't run into this.
Activity
rm-openai commentedon Apr 11, 2025
It probably would not be correct to edit the tool name - among other reasons, tools often have a 64 max character limit, and their names are carefully chosen.
Perhaps we should add an optional
append_prefix
arg that lets the user specify a custom prefix or indicate that we should prefix the server name.PR welcome!
stevemadere commentedon May 17, 2025
Would a workaround for this problem be a general purpose tool prefixer decorator class?
yulong-CSAI commentedon Jun 20, 2025
It's not elegant to nest multiple MCP servers. Are there any non - nested implementation methods?