---
type: email
from: lrlthink <notifications@github.com>
subject: Re: [openai/openai-agents-python] How to add multiple MCP servers in

 an Agent? (Issue #954)
received: 2026-03-05 10:02:14
date_header: Mon, 11 Aug 2025 21:11:39 -0700
priority: normal
status: awaiting_approval
uid: 27254
---

## Email Content

**From:** lrlthink <notifications@github.com>
**Subject:** Re: [openai/openai-agents-python] How to add multiple MCP servers in

 an Agent? (Issue #954)
**Date:** Mon, 11 Aug 2025 21:11:39 -0700

### Body (preview)

lrlthink left a comment (openai/openai-agents-python#954)



@Mitty-ZH try this

from contextlib import AsyncExitStack



async with AsyncExitStack() as stack:

    servers = [

        MCPServerStreamableHttp(

            name=name,

            cache_tools_list=True,

            params={

                "url": mcp_config_list[name].get('url'),

                "headers": mcp_config_list[name].get('headers')

            }

        )

        for name in mcp_config_list]

    server_list = [await stack.enter_async_context(s) for s in servers]

    agent = Agent(

            name="chat_test",

            instructions="You are an AI assistant that can perform math calculations and check weather. Use tools when needed.",

            mcp_servers=server_list

        )



-- 

Reply to this email directly or view it on GitHub:

https://github.com/openai/openai-agents-python/issues/954#issuecomment-3177629593

You are receiving this because you are subscribed to this thread.



Message ID: <openai/openai-agents-python/issues/954/3177629593@github.com>

---

## Suggested Actions
- [ ] Reply
- [ ] Archive
- [ ] Escalate
