Hosted MCP Tools with OpenAI

HostedMCPTool lets the Responses API handle the remote MCP tool round trip. Your code supplies the server configuration rather than manually listing and dispatching each tool.

from agents import Agent, HostedMCPTool

agent = Agent(
    name="Repo Assistant",
    tools=[HostedMCPTool(tool_config={
        "type":"mcp",
        "server_label":"docs",
        "server_url":"https://mcp.example.com/mcp",
        "require_approval":"never",
    })],
)

When hosted MCP fits

Use it when the server is publicly reachable from OpenAI infrastructure and you want the hosted model/tool path to own MCP discovery and execution.

Approvals still matter

For sensitive tools, set approval policies rather than using never. Hosted MCP supports approval callbacks and per-tool policies.

Connector-backed servers

The current SDK also documents hosted connector-backed MCP configurations where you provide a connector ID and authorization token.

Trust the server before connecting it. MCP tools may read data or perform actions using supplied credentials.