Add a managed MCP server to an agent
Add an MCP server to an agent and enable it. This introduces a command (stdio) or remote endpoint (http/sse) that will run in the agent’s environment, so a person approves it first at a card showing the exact command/args/url. Rejects the reserved name "dorkos" and any name the agent already uses. If the added entry comes back with connection.authKind "oauth2", the server needs a sign-in: call the MCP sign-in tool for it immediately, in the same turn, rather than asking permission first — the person already approved this endpoint at the card above, and nothing leaves this machine until they open the sign-in link. Its tools are live on the next turn once they finish.
Request Body
application/json
TypeScript Definitions
Use the request body type in TypeScript.
Response Body
application/json
curl -X POST "https://example.com/api/agents/{agentId}/mcp-servers" \ -H "Content-Type: application/json" \ -d '{ "agentId": "string", "name": "string", "connection": { "transport": "stdio", "command": "string" } }'[ { "name": "string", "enabled": false, "connection": { "transport": "stdio", "command": "string", "args": [], "env": {} }, "addedAt": "2019-08-24T14:15:22Z", "addedBy": "string" }]