AutoGen
Use AllMCP tools in Microsoft AutoGen agents via autogen-ext[mcp].
Install
Section titled “Install”pip install 'autogen-ext[mcp]' 'autogen-ext[anthropic]' autogen-agentchatMinimal example
Section titled “Minimal example”import asynciofrom autogen_ext.tools.mcp import StreamableHttpServerParams, mcp_server_toolsfrom autogen_agentchat.agents import AssistantAgentfrom autogen_agentchat.ui import Consolefrom autogen_ext.models.anthropic import AnthropicChatCompletionClient
async def main(): params = StreamableHttpServerParams( url="https://go.allmcp.co/mcp/", headers={"X-API-Key": "YOUR_API_KEY"}, ) tools = await mcp_server_tools(params)
agent = AssistantAgent( name="crm_agent", model_client=AnthropicChatCompletionClient(model="claude-sonnet-4-6"), tools=tools, system_message="You are a CRM assistant. Use AllMCP tools to manage the user's data.", )
await Console(agent.run_stream(task="List the top 5 contacts in my CRM"))
asyncio.run(main())Multi-agent setup
Section titled “Multi-agent setup”import asynciofrom autogen_agentchat.agents import AssistantAgentfrom autogen_agentchat.teams import RoundRobinGroupChatfrom autogen_agentchat.ui import Consolefrom autogen_ext.tools.mcp import StreamableHttpServerParams, mcp_server_toolsfrom autogen_ext.models.anthropic import AnthropicChatCompletionClient
async def main(): params = StreamableHttpServerParams( url="https://go.allmcp.co/mcp/", headers={"X-API-Key": "YOUR_API_KEY"}, ) tools = await mcp_server_tools(params) model = AnthropicChatCompletionClient(model="claude-sonnet-4-6")
data_agent = AssistantAgent( name="DataFetcher", model_client=model, tools=tools, system_message="Fetch raw data from the CRM. Do not analyze — just retrieve.", )
analyst_agent = AssistantAgent( name="Analyst", model_client=model, system_message="Analyze data provided by DataFetcher and produce insights.", )
team = RoundRobinGroupChat([data_agent, analyst_agent], max_turns=4) await Console(team.run_stream(task="Summarize this week's new leads by source"))
asyncio.run(main())Multi-user setup
Section titled “Multi-user setup”def make_params(user_id: str) -> StreamableHttpServerParams: return StreamableHttpServerParams( url=f"https://go.allmcp.co/mcp/?user_id={user_id}", headers={"X-API-Key": "YOUR_API_KEY"}, )
async def run_for_user(user_id: str, task: str): params = make_params(user_id) tools = await mcp_server_tools(params) agent = AssistantAgent( name="agent", model_client=AnthropicChatCompletionClient(model="claude-sonnet-4-6"), tools=tools, ) await Console(agent.run_stream(task=task))See also
Section titled “See also” Browse providers See every provider you can connect and the tools each one offers.