MCP with OpenAI Agents SDK

The current Agents SDK supports three main modern MCP paths: hosted remote MCP through the Responses API, application-managed Streamable HTTP, and local stdio. Legacy SSE remains for compatibility but is deprecated by MCP for new work.

Choose by execution boundary

NeedOption
OpenAI-hosted call to public remote MCPHostedMCPTool
Your app owns HTTP connectionMCPServerStreamableHttp
Local subprocessMCPServerStdio

Production features

The SDK includes tool filtering, approval policies, tool-list caching, per-call metadata, pagination, multiple-server management, and tracing.

Security

Connect only trusted servers, use least-privilege credentials, keep tokens in headers/auth fields, and require approval for sensitive actions.