MCP & A2A
Use any agent as an MCP server or an A2A agent, and give your agents tools from external MCP servers and remote A2A agents.
Overview
ArcanFlows speaks two agent protocols, in both directions:
- Inbound. Every agent is an MCP server (Model Context Protocol) and an A2A agent (Agent-to-Agent, JSON-RPC, protocol 0.3). Claude Desktop, Claude Code, Cursor, VS Code or any A2A orchestrator can call it.
- Outbound. A workspace registers external MCP servers and remote A2A agents. Their tools become ordinary tools that you attach to your agents.
Inbound calls run the agent exactly like the public chat API: same instructions, tools, knowledge, guardrails, quotas and conversation memory. The conversations are saved with the agent's other embed conversations, under the key that made the call.
bashBASE=https://api.arcanflows.com # API host, without /api/v1 API=$BASE/api/v1 EMBED_KEY=emb_... # an Embed API key of the agent AGENT_ID=... TOKEN=... TENANT=... # user session, for the /api/v1/mcp and /api/v1/a2a management routes
Agents as MCP servers
Authentication
There is no separate switch: an agent answers MCP as soon as it has an Embed API key (agent → Embed → API Keys, or POST /api/v1/embed/api-keys, see Embed API keys). The key is the bearer token. To disconnect a client, deactivate or delete its key; give each client its own key so you can revoke them separately.
The key must be active, not expired and belong to the agent in the URL, and the workspace must be active. Each tools/call uses the workspace's monthly token quota.
Endpoint
| Method | Path | Behaviour |
|---|---|---|
POST | /mcp/agents/:id/mcp | JSON-RPC 2.0 over Streamable HTTP. Short URL for client configs. |
POST | /api/v1/public/agents/:id/mcp | Same handler |
GET | either path | 405 with Allow: POST, DELETE — the server never pushes messages on its own |
DELETE | either path | 204. Sessions are stateless, so there is nothing to end. |
- Protocol versions:
2025-06-18(preferred),2025-03-26,2024-11-05. The server answers with your version when it supports it, otherwise with2025-06-18. initializereturns anMcp-Session-Idheader. The server accepts it on later requests but never requires it.- One JSON-RPC request per POST, body up to 1 MiB; batches are not supported. A notification (a message without
id) gets202. - Methods:
initialize,ping,tools/list,tools/call,resources/listandprompts/list(both always empty). Anything else returns-32601.
The ask_<slug> tool
tools/list returns one tool, ask_<agent slug>: the agent's slug (or name), lower-cased, with every character outside [a-z0-9_-] replaced by _, cut to 56 characters.
json{ "name": "ask_support_bot", "title": "Support Bot", "inputSchema": { "type": "object", "properties": { "message": {"type": "string"}, "conversation_id": {"type": "string"} }, "required": ["message"] } }
A tools/call result:
json{ "content": [{"type": "text", "text": "...the agent's answer..."}], "structuredContent": {"conversation_id": "mcp-5b0e...", "finish_reason": "stop", "model": "...", "handoff": false} }
- Continue a conversation by passing
structuredContent.conversation_idback asarguments.conversation_id. A call without it starts a new conversation (mcp-<uuid>). Any string works as a conversation id. - An empty
messageor a failed turn returns a normal result withisError: trueand an explanation. An unknown tool name returns-32602. - Long turns. A turn may run up to 12 minutes and is completed and saved even if the client gives up. If your request sends
Accept: text/event-stream, the answer comes as SSE (event: message); every 10 s the server sendsnotifications/progress(when you passed_meta.progressToken) or a: keepalivecomment until the result arrives. Without SSE the POST blocks until the answer is ready.
Errors before the call runs
| HTTP | JSON-RPC code | Cause |
|---|---|---|
400 | -32600 | The agent id is not a UUID, or the request is not JSON-RPC 2.0 |
400 | -32700 | Empty or unparsable body |
401 | -32001 | No key (WWW-Authenticate: Bearer realm="arcanflows-mcp") |
403 | -32001 | Invalid key, or the workspace is not available |
404 | -32001 | Agent not found |
403 | — | Token quota used up. The body is the plain usage-limit JSON ("code":"USAGE_LIMIT_EXCEEDED"), not JSON-RPC. |
Client configuration
The console shows these snippets, already filled in, in the agent's Embed tab ("Connect from MCP clients").
Claude Desktop (claude_desktop_config.json) and other clients that support remote HTTP servers:
json{ "mcpServers": { "arcanflows-support-bot": { "type": "http", "url": "https://api.arcanflows.com/mcp/agents/AGENT_ID/mcp", "headers": { "Authorization": "Bearer emb_..." } } } }
Cursor (.cursor/mcp.json):
json{ "mcpServers": { "arcanflows-support-bot": { "url": "https://api.arcanflows.com/mcp/agents/AGENT_ID/mcp", "headers": { "Authorization": "Bearer emb_..." } } } }
VS Code (.vscode/mcp.json):
json{ "servers": { "arcanflows-support-bot": { "type": "http", "url": "https://api.arcanflows.com/mcp/agents/AGENT_ID/mcp", "headers": { "Authorization": "Bearer emb_..." } } } }
Claude Code:
bashclaude mcp add --transport http arcanflows-agent "$BASE/mcp/agents/$AGENT_ID/mcp" \ --header "Authorization: Bearer $EMBED_KEY"
curl:
bash# 1. initialize curl -s "$BASE/mcp/agents/$AGENT_ID/mcp" \ -H "Authorization: Bearer $EMBED_KEY" -H "Content-Type: application/json" \ -d '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2025-06-18","capabilities":{},"clientInfo":{"name":"curl","version":"1"}}}' # 2. list the tool curl -s "$BASE/mcp/agents/$AGENT_ID/mcp" \ -H "Authorization: Bearer $EMBED_KEY" -H "Content-Type: application/json" \ -d '{"jsonrpc":"2.0","id":2,"method":"tools/list"}' # 3. ask the agent curl -s "$BASE/mcp/agents/$AGENT_ID/mcp" \ -H "Authorization: Bearer $EMBED_KEY" -H "Content-Type: application/json" \ -d '{"jsonrpc":"2.0","id":3,"method":"tools/call","params":{"name":"ask_support_bot","arguments":{"message":"What can you do?"}}}'
Agents as A2A agents
Agent card
The card is public (no key). Any of these paths returns it:
| Method | Path |
|---|---|
GET | /a2a/agents/:id/.well-known/agent.json |
GET | /a2a/agents/:id |
GET | /api/v1/public/agents/:id/.well-known/agent.json |
GET | /api/v1/public/agents/:id/a2a/.well-known/agent.json |
GET | /api/v1/public/agents/:id/a2a |
bashcurl -s "$BASE/a2a/agents/$AGENT_ID/.well-known/agent.json"
json{ "protocolVersion": "0.3.0", "name": "Support Bot", "description": "...", "url": "https://api.arcanflows.com/api/v1/public/agents/AGENT_ID/a2a", "preferredTransport": "JSONRPC", "version": "...", "provider": {"organization": "ArcanFlows", "url": "https://arcanflows.com"}, "capabilities": {"streaming": true, "pushNotifications": false, "stateTransitionHistory": false}, "securitySchemes": {"bearer": {"type": "http", "scheme": "bearer", "description": "An embed API key of this agent"}}, "security": [{"bearer": []}], "defaultInputModes": ["text/plain"], "defaultOutputModes": ["text/plain"], "skills": [{"id": "chat", "...": "..."}, {"id": "tool:<slug>", "...": "..."}] }
The card is served for any agent of an active workspace. skills lists a chat skill plus one tool:<slug> skill for each enabled tool of the agent (up to 40). Responses are cacheable for 5 minutes.
JSON-RPC endpoint
POST /api/v1/public/agents/:id/a2a (the card's url) or POST /a2a/agents/:id, with Authorization: Bearer <Embed API key of this agent>. The same key checks as MCP apply, and each message uses the token quota.
| Method | Behaviour |
|---|---|
message/send | Runs a turn. Blocks until the task finishes, unless params.configuration.blocking is false: then it returns the working task at once and you follow it with tasks/get. |
message/stream | SSE of JSON-RPC responses: the task snapshot, a status-update (working) every 10 s, one artifact-update per artifact, then a final status-update with final: true |
tasks/get | params.id: the stored task with status, artifacts and history |
tasks/cancel | Cancels a task in submitted or input-required. A running turn cannot be interrupted (-32002). |
agent/authenticatedExtendedCard | The same card |
tasks/pushNotificationConfig/set, .../get, tasks/resubscribe | -32003 (push notifications are not supported) |
Semantics:
- Parts. Only
textparts are accepted (several are joined with newlines). Any other kind returns-32005; an empty text returns-32602. - Context.
message.contextIdis the conversation. Send the samecontextIdto continue it. Without one, the server createsa2a-<uuid>and returns it on the task. - Task states.
submittedwhen accepted,workingwhile the turn runs;completedwith ananswerartifact holding the reply text;failedwith a status message;input-requiredwhen a human operator took over the conversation (handoff);canceledaftertasks/cancel. A message withtaskIdcontinues a task only while it is not finished; a finished task returns-32602— send a new message with the samecontextIdinstead. - Turns may run up to 12 minutes and are saved even if the client disconnects.
- Errors:
-32001(no key, bad key, agent unavailable, or task not found),-32600(invalid request),-32601(unknown method).
bash# Send a message and wait for the answer curl -s "$API/public/agents/$AGENT_ID/a2a" \ -H "Authorization: Bearer $EMBED_KEY" -H "Content-Type: application/json" \ -d '{"jsonrpc":"2.0","id":1,"method":"message/send","params":{"message":{"role":"user","kind":"message","messageId":"m1","parts":[{"kind":"text","text":"What can you do?"}]}}}' # Continue the same conversation curl -s "$API/public/agents/$AGENT_ID/a2a" \ -H "Authorization: Bearer $EMBED_KEY" -H "Content-Type: application/json" \ -d '{"jsonrpc":"2.0","id":2,"method":"message/send","params":{"message":{"role":"user","kind":"message","messageId":"m2","contextId":"a2a-...","parts":[{"kind":"text","text":"And on weekends?"}]}}}' # Fetch a task curl -s "$API/public/agents/$AGENT_ID/a2a" \ -H "Authorization: Bearer $EMBED_KEY" -H "Content-Type: application/json" \ -d '{"jsonrpc":"2.0","id":3,"method":"tasks/get","params":{"id":"TASK_ID"}}'
The agent's Embed tab has a "Connect from A2A clients" card with these URLs and calls.
External MCP servers as tools
Register an MCP server in your workspace and Connect it: ArcanFlows runs initialize and tools/list, and each remote tool becomes a tool (tool_type mcp, slug mcp-<server slug>-<tool name>, input schema copied as is). Attach those tools to agents like any other tool (POST /api/v1/agents/:id/tools, see Agent tools). Connecting again updates the tools and disables the ones that disappeared from the server.
| Method | Path | Permission |
|---|---|---|
GET | /api/v1/mcp/servers | tools.read |
POST | /api/v1/mcp/servers | tools.create |
GET | /api/v1/mcp/servers/:id | tools.read |
PUT | /api/v1/mcp/servers/:id | tools.update |
DELETE | /api/v1/mcp/servers/:id | tools.delete (also removes its tools) |
POST | /api/v1/mcp/servers/:id/connect | tools.update |
POST | /api/v1/mcp/servers/:id/call | tools.execute — test one tool with {"tool":"name","arguments":{...}}; returns {text, is_error, structured, content} |
Create and update body:
| Field | Notes |
|---|---|
name | Required. Unique in the workspace; the slug is derived from it. |
url | Required. https (http only for localhost) |
auth_mode | none (default), bearer or header |
credential_id | Required unless auth_mode is none: a credential from your vault (Credentials API). The secret is read from its first non-empty field among token, api_key, access_token, value, password. |
header_name | Required for auth_mode header: the header that carries the secret |
headers | Extra static headers. Authorization is not allowed here; keep it in the vault. |
timeout_seconds | Default 60, max 300 |
description, enabled | Optional |
The server is called over Streamable HTTP and may answer with plain JSON or SSE. Enabled servers are probed about once a day; the result is shown as health (healthy, unhealthy) with last_error.
bashcurl -s -X POST "$API/mcp/servers" \ -H "Authorization: Bearer $TOKEN" -H "X-Active-Tenant: $TENANT" -H "Content-Type: application/json" \ -d '{"name":"Docs search","url":"https://mcp.example.com/mcp","auth_mode":"bearer","credential_id":"CREDENTIAL_ID"}' curl -s -X POST "$API/mcp/servers/$SERVER_ID/connect" \ -H "Authorization: Bearer $TOKEN" -H "X-Active-Tenant: $TENANT"
Remote A2A agents as tools
Register another A2A agent and Connect it: ArcanFlows fetches its card, takes the endpoint from the card's url (must be https), and creates one tool, a2a-<slug>-ask (tool_type a2a, input message plus optional context_id). When an agent calls that tool, ArcanFlows sends message/send and follows the task until it ends or the timeout passes.
| Method | Path | Permission |
|---|---|---|
GET | /api/v1/a2a/remote-agents | tools.read |
POST | /api/v1/a2a/remote-agents | tools.create |
GET | /api/v1/a2a/remote-agents/:id | tools.read |
PUT | /api/v1/a2a/remote-agents/:id | tools.update |
DELETE | /api/v1/a2a/remote-agents/:id | tools.delete (also removes its tool) |
POST | /api/v1/a2a/remote-agents/:id/connect | tools.update |
POST | /api/v1/a2a/remote-agents/:id/call | tools.execute — {"message":"...","context_id":"..."}; returns {state, text, task_id, context_id} |
The body is the same as for MCP servers, except that the URL field is card_url: the agent's base URL or its .../agent.json (when it does not end in /agent.json, /.well-known/agent.json is appended). The default timeout is 120 s (max 300). Leave name empty to take it from the card. Enabled remote agents are re-checked about once a day and show their health.
bashcurl -s -X POST "$API/a2a/remote-agents" \ -H "Authorization: Bearer $TOKEN" -H "X-Active-Tenant: $TENANT" -H "Content-Type: application/json" \ -d '{"card_url":"https://agents.example.com/research","auth_mode":"bearer","credential_id":"CREDENTIAL_ID"}'
Outbound network policy
Outbound requests to MCP servers and remote A2A agents (like REST tools, webhooks and workflow HTTP steps) follow your workspace's network policy: public internet hosts are reachable by default and private networks are not. If a server must be reached on a private network, contact support.