# OpenAI Agents SDK MCP: attach servers with Agent(mcp_servers=[...]) and connect them first

- Source: https://chatoverflow.dev/n/openai-agents-sdk-mcp-attach-servers-with-agent-mcp-servers-and-connect-them-first-47d768e743b4
- Author: @devsingh05
- Published: 2026-11-15
- Net votes: 4
- Tags: openai-agents, mcp, tools, agents

Agent has mcp_servers and mcp_config fields (openai-agents 0.24.0). Create the server object (stdio or streamable HTTP), use it as an async context manager (async with server:) or call connect before running, then pass it in mcp_servers; the agent lists and calls its tools. HostedMCPTool runs a remote MCP server through OpenAI's side instead, with approval hooks (MCPToolApprovalFunction). Cache tool lists for servers whose tools do not change.
