Skip to main content

MCP Configuration

Attach Model Context Protocol (MCP) servers to a registered agent so it can call external tools (ZeroDB, Strapi, memory, and more) at runtime. You can attach MCP servers either at registration time (via the mcp_servers field on POST /register) or afterwards through the runtime endpoints below.

Base path: /api/v1/cloud/agents/{agent_id}/mcp

You must be the agent's owner. Environment variable values are always redacted in responses — only the key names are returned.

The MCP server config object

FieldTypeRequiredDescription
server_namestringyesUnique name for this server on the agent (1–100 chars).
server_typestringyesOne of zerodb, strapi, memory, design, gtm, browser, custom.
envobjectnoEnvironment variables (string → string) for the MCP server, e.g. credentials or endpoints.

POST /servers

Attach an MCP server to the agent.

curl -X POST https://api.ainative.studio/api/v1/cloud/agents/agent-a1b2c3d4e5f6/mcp/servers \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{
"server_name": "my-zerodb",
"server_type": "zerodb",
"env": {
"ZERODB_API_KEY": "sk-...",
"ZERODB_PROJECT_ID": "proj-123"
}
}'

Response (201):

{
"server_name": "my-zerodb",
"server_type": "zerodb",
"env_keys": ["ZERODB_API_KEY", "ZERODB_PROJECT_ID"]
}

GET /servers

List the MCP servers attached to the agent (env values redacted).

curl https://api.ainative.studio/api/v1/cloud/agents/agent-a1b2c3d4e5f6/mcp/servers \
-H "Authorization: Bearer $TOKEN"

Response (200):

{
"agent_id": "agent-a1b2c3d4e5f6",
"servers": [
{ "server_name": "my-zerodb", "server_type": "zerodb", "env_keys": ["ZERODB_API_KEY", "ZERODB_PROJECT_ID"] }
],
"total": 1
}

POST /servers/{server_name}/test

Test an attached MCP server's connectivity and configuration.

curl -X POST https://api.ainative.studio/api/v1/cloud/agents/agent-a1b2c3d4e5f6/mcp/servers/my-zerodb/test \
-H "Authorization: Bearer $TOKEN"

Response (200):

{
"agent_id": "agent-a1b2c3d4e5f6",
"server_name": "my-zerodb",
"server_type": "zerodb",
"reachable": true,
"detail": "Connection succeeded"
}

DELETE /servers/{server_name}

Detach a named MCP server from the agent. Returns 204 No Content.

curl -X DELETE https://api.ainative.studio/api/v1/cloud/agents/agent-a1b2c3d4e5f6/mcp/servers/my-zerodb \
-H "Authorization: Bearer $TOKEN"

Attaching at registration

You can bundle MCP servers when you register the agent:

{
"agent_type": "researcher",
"capabilities": ["web_search"],
"mcp_servers": [
{ "server_name": "my-zerodb", "server_type": "zerodb", "env": {"ZERODB_API_KEY": "sk-..."} }
]
}