Attach an MCP server to an agent
Attaches a connected MCP server to an agent: its tools become
callable the next time that agent’s session is built (existing live
sessions are unaffected until they reconnect/rebuild). By default every
tool the server exposes is available; pass enabled_tools to restrict
this agent to a subset (see V1AttachMcpServerRequest) — a tool left out
is never declared to the model at all, not merely discouraged. Calling
this again on an already-attached server updates its tool selection
(updated) rather than being a no-op — the way to change which tools
are enabled without detaching and reattaching.
Authorizations
A long-lived, privileged API key (ek_... prefix), minted once from the dashboard. Intended for trusted server-side use only; never expose it in client-side code. Send as Authorization: Bearer ek_.... Required by every Calls, Batches, Agents, Tools, MCP Servers, Documents, and Realtime route.
Body
Body is entirely optional — an empty/absent body means every tool the server exposes is available to this agent (the pre-existing behavior). Calling attach again on an already-attached server updates its tool selection rather than being a no-op, so a dev can change which tools are enabled without detaching and reattaching.