Topic 4 of 5 · 5 min read
Hosted MCP connectors in model provider APIs
Goal: Decide between a provider-hosted MCP connector and your own client for a described app and name the trade-off that decides it.
A hosted connector lets the model provider's servers talk to a remote MCP server for you; it saves client code and costs you control over each call.
Check yourself · 1 of 3
What does a provider-hosted MCP connector remove from your application?
Why it matters
Both Anthropic and OpenAI let you pass an MCP server URL in the API request. The provider connects, lists the tools, lets the model call them and returns the result in the same response. For a prototype that is far less code. But the provider, not you, now opens the connection, so some designs cannot use it.
How to do it
- Pass the server. In the Claude API you add the server's URL and name to the request, and the model's output may contain MCP tool-use blocks. In OpenAI's API you add an MCP entry to the tools list with a
server_urlor a connector id. Check each provider's current docs for the exact field names and the required beta flags. - Restrict the tools. Both APIs let you allow only a named subset of the server's tools. Use it, for the same context reasons as before.
- Handle authorization. If the server needs a token, you pass it in the request, so the provider's servers see it. OpenAI's docs also describe approval settings for tool calls.
- Check the requirements. The server must be reachable from the provider's network, on a public HTTPS address. A server on your laptop, behind a VPN or on a private network cannot be reached.
- Decide. Ask what you need to control. If you need to log or rewrite each call, apply your own approval step, reach private servers, use stdio servers, or mix tools from several providers, run your own client.
Before and after
# Before: your own client runs the loop for one public server
session = await connect(url)
tools = await session.list_tools()
# ... convert, call, return results, handle errors ...
# After: the provider's API does the MCP part
response = client.responses.create(
model="gpt-5",
tools=[{
"type": "mcp",
"server_label": "docs",
"server_url": "https://docs.example.com/mcp",
"allowed_tools": ["search"],
"require_approval": "never",
}],
input="Find our refund policy.",
)
What goes wrong
- Unreachable server. The connector works in the docs and fails with the server on
localhost. - Token exposure. Giving the provider a broad token for a server you trust less than the provider.
- Lost audit trail. Calls happen inside the provider's request, so your logs show no
tools/callunless you read the response items.
Examples
A good fit for a connector
A help-centre chatbot reads one public, read-only docs server over HTTPS. One tool, no secrets, no need to inspect calls. A hosted connector with allowed_tools set to the search tool is about ten lines and works.
A bad fit for a connector
A finance assistant must reach an internal ledger server on a private network and log every call for audit before it runs. The provider cannot reach the server and the app cannot intercept calls. It needs its own client.
Key points
- A hosted connector makes the provider's servers the MCP client, so your application writes no protocol code.
- The MCP server must be reachable by the provider, which usually means a public HTTPS URL.
- Restrict the allowed tools in the request, as you would in your own client.
- Tokens you pass to a connector are seen by the provider, so scope them narrowly.
- Run your own client when you need per-call control, private networks, stdio servers or your own logging.
Common mistakes
- Assuming a connector can reach a server on localhost or a private network.
- Sending a broad access token to a hosted connector.
- Leaving every tool open when the task needs one.
- Expecting your own logs to record calls the provider's servers made.
Check yourself · 2 of 3
Your MCP server runs on a developer laptop at localhost:8000. Can a hosted connector use it?
Check yourself · 3 of 3
Which requirement most clearly points to running your own MCP client?
Practice items, not counted towards your mastery.
Start here
- Build an MCP client (official tutorial) (opens in a new tab)DocsFree
A working client that connects, lists tools and runs the tool-call loop with a model.
- MCP connector (Claude API docs) (opens in a new tab)DocsFree
How the Claude API connects to remote MCP servers for you, and the limits of that mode.
- Connectors and MCP servers (OpenAI API docs) (opens in a new tab)DocsFree
The OpenAI side of hosted MCP: server config, approvals and tool filtering.