Skip to main content
Before copying a curl example, choose your Cloud region. For authenticated calls, it must be the same region as your key. The examples below use MIROBODY_API_BASE:
For SDK examples with a literal Global URL, use the matching China URL when your account is in China. See Regions. The agent ships with built-in tools over the Subject’s health data (Function calling → Built-in server tools). Attaching a remote MCP server adds your own tools to that set: the platform connects, lists the server’s tools, and lets the agent call them alongside the built-ins during the turn.
This is not “Mirobody as an MCP server.” It’s the reverse: you bring external MCP tools into the agent’s reasoning. The platform executes the calls server-side — unlike client function tools, there is no handoff back to you.

Attach a server

Use the OpenAI Responses protocol’s own tools entry, on the Agent API:
Mix freely with your type: "function" client tools in the same tools array. Limits: ≤ 8 servers per request, ≤ 64 tools total.

The response

MCP calls are server-side tool steps — they appear in the response’s top-level tool_steps (name mcp__{label}__{tool}, with arguments and result) and stream as response.mirobody_tool_call events. The output array stays pure OpenAI item types; there is no function_call handoff for MCP tools.

Errors

In the web app

End users of Mirobody Chat, the consumer app on this same backend, can attach their own MCP servers under Settings → MCP, and its agent picks them up automatically each turn. That is the outbound direction, the same as this endpoint. (A self-hosted engine also serves the opposite direction: it mints a personal MCP URL so external clients can call into that instance; see MCP Integration.) A misconfigured or down server is skipped there (chat never fails because of it); on the API surface the same problem is an explicit 400, because you asked for that server in this request.

When to prefer client function tools

If your tool needs to run inside your own process (private network, local state, human confirmation), use client function tools instead: the model hands off with function_call, you execute, and you resume the run — the openai-agents SDK automates that loop.

See also