You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -68,6 +69,18 @@ If you can programmatically determine whether a tool call is safe, you can use t
68
69
title="Human in the loop with hosted MCP tools"
69
70
/>
70
71
72
+
### Connector-backed hosted servers
73
+
74
+
Hosted MCP also supports OpenAI connectors. Instead of providing a `serverUrl`, pass the connector's `connectorId` and an `authorization` token. The Responses API then handles authentication and exposes the connector's tools through the hosted MCP interface.
75
+
76
+
<Code
77
+
lang="typescript"
78
+
code={hostedConnectorExample}
79
+
title="Connector-backed hosted MCP tool"
80
+
/>
81
+
82
+
In this example the `GOOGLE_CALENDAR_AUTHORIZATION` environment variable holds an OAuth token obtained from the Google OAuth Playground, which authorizes the connector-backed server to call the Calendar API. For a runnable sample that also demonstrates streaming, see [`examples/connectors`](https://github.com/openai/openai-agents-js/tree/main/examples/connectors).
83
+
71
84
Fully working samples (Hosted tools/Streamable HTTP/stdio + Streaming, HITL, onApproval) are [examples/mcp](https://github.com/openai/openai-agents-js/tree/main/examples/mcp) in our GitHub repository.
72
85
73
86
## 2. Streamable HTTP MCP servers
@@ -102,11 +115,7 @@ Only enable this if you're confident the tool list won't change. To invalidate t
102
115
103
116
You can restrict which tools are exposed from each server by passing either a static filter via `createMCPToolStaticFilter` or a custom function. Here’s a combined example showing both approaches:
0 commit comments