Tools and state
openai_mcp_connector
Discovers and executes MCP tools for the Responses API agentic loop.
On this page
Discovers and executes MCP tools for the Responses API agentic loop.
Configuration Notes
Configure once inside the inference step, before openai_agentic_loop and openai_responses_proxy. Keep openai_stream_events ahead of the connector for streamed requests. Request parsing and rehydration run before the IRR.
The first inference round expands eager declarations into admitted functions and records an mcp_list_tools item for each resolved server. Deferred connectors keep a sanitized declaration until the model emits a tool_search_call. The agentic loop uses the resolved map to assign work and decide whether inference continues. The connector executes its assignments on re-entry and appends each result using the original call ID.
For approval resumes, include the MCP declaration alongside the approval response and configure openai_responses_store and openai_responses_rehydrate. The connector reapplies current operator policy and matches the approval against the target and caller identity.
Results with structuredContent use a compact JSON object containing both content and structuredContent in the model-facing function_call_output and public mcp_call.output strings. This preserves structured-only results and distinct text or media blocks. Without structured content, text blocks remain newline-joined and non-text results remain JSON content arrays. The combined serialized output is subject to the existing result-byte limits.
Configuration
| Field | Type | Required | Description |
|---|---|---|---|
user_credential | string | no | Optional per-user bearer slot from callout_credentials. |
authorization_assertion | string | no | Optional opaque assertion slot from callout_credentials.assertions. |
require_connector | bool | no | Require MCP tool entries to reference an operator-configured connector. When false, client-selected direct server_url entries remain allowed for deployments that intentionally mix public direct servers with scoped connector traffic. |
forward_headers | string[] | no | Trusted request headers forwarded to connector-backed MCP initialize and tool requests. No request headers are forwarded by default. Credential headers such as authorization are rejected because MCP destinations are client-selected; use the MCP tool entry’s dedicated authorization field instead. Direct, client-selected server_url targets never receive ambient request headers. |
max_rewritten_body_bytes | integer | no | Maximum size in bytes of the request body this filter produces after expanding mcp tool entries into function entries. Raw request body size is governed by the pipeline’s body_limits, not this field. This bounds only the post-expansion body, which can grow larger than the raw input. |
discovery_timeout_ms | integer | no | Per-server timeout in milliseconds for tools/list calls (default: 5000). Inside an iterative request router, initialize and listing exchanges are capped by the router’s remaining deadline. |
max_servers | integer | no | Maximum number of distinct MCP servers per request. |
max_tools | integer | no | Maximum number of tools returned by a single MCP server. |
outbound_chain | string | object | no | Outbound filter chain shared by eager discovery, deferred discovery, and execution. Accepts an inline chain or a reference to a top-level filter_chains entry. A named chain must start with an unconditional openai_mcp_streaming_selector. The connector supplies the selector for inline or omitted chains. The transport stages and validates the destination before the exchange. Private upstreams are governed by the global insecure options. |
connectors | object[] | no | Named connectors mapping connector IDs to server URLs. |
connectors[].id | string | yes | Connector identifier referenced in requests. |
connectors[].server_url | string | yes | MCP server URL for this connector. |
connectors[].tool_policy | deny | allow_all | read_only | no | Operator policy for tools from this connector. Defaults to deny and is enforced in protected mode: allow_all admits every tool, while read_only admits only tools the service affirmatively classifies as read-only. This classification does not itself prevent side effects; enforce write restrictions at the service or with scoped credentials. |
tool_admission | object | no | Operator metadata-admission policy. Defaults to advisory (unchanged behavior), so existing non-protected deployments are not affected. |
tool_admission.mode | advisory | protected | no | Admission mode (advisory default, or protected). |
minimum_approval | always | no | Operator approval floor applied to every MCP call in this pipeline, combined monotonically with each tool’s client require_approval: approval_required = operator_floor || client_requires_approval. Set always to require approval for every MCP call regardless of the client’s request — a client "never" or a server-supplied readOnlyHint can never suppress it. Pending approvals are correlated through previous_response_id, so the pipeline needs openai_responses_store and openai_responses_rehydrate; without persistence the request fails closed (store: false → 400, no store → 500). Omit to preserve the client-driven behavior (the default). |
call_timeout_ms | integer | no | Timeout in milliseconds for each tools/call exchange (default: 30000). Inside an iterative request router, every MCP exchange is capped by the router’s remaining deadline. |
max_calls_per_round | integer | no | Hard cap on MCP calls processed from one model response, and the maximum number of mcp_approval_response items accepted from a single resume request — a resume batch cannot exceed what one round could have emitted (1..=1024; default: 32). |
max_parallel_calls | integer | no | Maximum concurrent MCP calls when parallel_tool_calls is enabled (1..=64; default: 8). |
max_result_bytes | integer | no | Maximum retained bytes for one MCP result (minimum: 1 KiB; default: 1 MiB). |
max_total_result_bytes | integer | no | Maximum retained bytes across one MCP result batch (default: 8 MiB). |
Examples
Example 1
filter: openai_mcp_connector
Example 2
filter: openai_mcp_connector
connectors:
- id: corp_drive
server_url: https://drive-mcp.internal/mcp
tool_policy: read_only
require_connector: true
tool_admission:
mode: protected
minimum_approval: always
user_credential: mcp_gateway
authorization_assertion: mcp_gateway
forward_headers: [x-tenant-id]
outbound_chain:
name: mcp-egress
filters:
- filter: request_id
discovery_timeout_ms: 5000
max_servers: 10
max_tools: 128
max_rewritten_body_bytes: 67108864
call_timeout_ms: 30000
max_calls_per_round: 32
max_parallel_calls: 8
max_result_bytes: 1048576
max_total_result_bytes: 8388608