Skip to content

MCP

When connected to a swarm, the Swarm Worker exposes cross-project MCP tools through a Streamable HTTP endpoint. Any AI agent that supports MCP can connect — the same clients that work with the Team MCP work here too.

After deploying the swarm Worker (oak swarm deploy -n <name>), you need two values:

  • MCP Server URL: https://<swarm-worker>.workers.dev/mcp
  • Agent Token: Stored in the swarm config file (~/.oak/swarms/<name>/config.json)

The Worker scaffold is stored under ~/.oak/swarms/<name>/worker/ (including wrangler.toml).

Many MCP-compatible clients read project MCP configuration files (JSON or TOML):

{
"mcpServers": {
"oak-swarm": {
"url": "https://<swarm-worker>.workers.dev/mcp",
"headers": {
"Authorization": "Bearer <swarm_agent_token>"
}
}
}
}

Use project-scoped config so Team and Swarm server entries stay tied to this repository.

ClientConfig File Location
Claude Code.mcp.json
Cursor.cursor/mcp.json
Codex.codex/config.toml
Gemini CLI.gemini/settings.json
OpenCodeopencode.json
VS Code Copilot.vscode/mcp.json

The setup process is the same as for Team MCP — add the swarm URL and token to your cloud agent’s MCP configuration. See Team MCP for step-by-step instructions per client (Claude.ai, ChatGPT, mcp.json, etc.).

The agent token authenticates cloud AI agents to the Swarm Worker’s MCP endpoint.

  • Generated automatically during swarm deployment (oak swarm deploy -n <name>)
  • Stored in ~/.oak/swarms/<name>/config.json and the Worker’s secrets (encrypted at rest on Cloudflare)
  • Requires Authorization: Bearer <token>

To rotate the token, re-deploy: oak swarm deploy -n <name> --force

Terminal window
# List available tools
curl -X POST https://<swarm-worker>.workers.dev/mcp \
-H "Authorization: Bearer <agent_token>" \
-H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0","method":"tools/list","id":1}'
Terminal window
# Search across all connected projects
curl -X POST https://<swarm-worker>.workers.dev/mcp \
-H "Authorization: Bearer <agent_token>" \
-H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0","method":"tools/call","params":{"name":"swarm_search","arguments":{"query":"retry backoff"}},"id":2}'

The Swarm MCP server exposes the following tools for cross-project queries. While Team tools fan out to nodes on the same project, Swarm tools fan out to different projects connected to the same swarm.

ToolPurpose
swarm_searchSearch across all swarm-connected projects
swarm_fetchFetch full details for items found via swarm_search
swarm_nodesList swarm teams and their status
swarm_statusShow swarm connection status

Search across all connected projects in the swarm. Returns results from multiple codebases with project attribution.

ParameterTypeRequiredDefaultDescription
querystringYesNatural language search query
search_typestringNo"all"Search scope: "all", "memory", "sessions", or "plans"
limitintegerNo10Maximum results to return (1–50)

Returns ranked results from all connected projects. Each result includes project attribution (project slug) so you can identify which project the result came from.

{
"query": "retry backoff pattern",
"search_type": "memory",
"limit": 10
}

Fetch full details for items found via swarm_search. Pass the chunk IDs and project slug from search results to retrieve complete content.

ParameterTypeRequiredDefaultDescription
idsarray of stringsYesChunk IDs from swarm_search results
project_slugstringNoProject slug from search results. If omitted, broadcasts to all projects.

Returns full content for each requested chunk, including file path, line range, and complete code text, attributed to the source project.

{
"ids": ["chunk_abc123", "chunk_def456"],
"project_slug": "my-api-service"
}

List all projects currently connected to the swarm. Returns project slugs, connection status, and capabilities.

This tool takes no parameters.

Returns a list of connected projects with:

  • Project slug
  • Connection status
  • Capabilities
  • Node count
  • OAK version
{}

Check the current swarm connectivity status. Returns whether this node is connected, the swarm ID, and the number of peer nodes.

This tool takes no parameters.

Returns swarm connection information:

  • Connected status
  • Swarm ID
  • Swarm URL
  • Number of peer nodes
{}