Recipe: query data via MCP
AGENTS rule 22: agents NEVER read Postgres or Iceberg directly.
Every catalog / dataset / entity / pipeline read goes through a
registered DataMCPTool. The bridge auto-installs every tool into
the agent TOOL_REGISTRY; the same tools are reachable externally
over HTTP at /mcp/data and via the alphaswarm-data-mcp stdio binary.
From inside an agent
from alphaswarm_agents.tools import TOOL_REGISTRY
tool = TOOL_REGISTRY["data.discovery.browse"]
result = tool.invoke({"namespace_prefix": "alphaswarm_silver_yfinance"})
print(result["entries"])
From outside the platform (HTTP)
curl -X POST http://localhost:8000/mcp/data/tools/data.discovery.browse/invoke `
-H "Content-Type: application/json" `
-H "Authorization: Bearer <m2m_token>" `
-d '{"namespace_prefix":"alphaswarm_silver_yfinance"}'
From a Cursor/Continue/Cline agent (stdio)
Register the stdio binary as an MCP server in the editor:
{
"mcpServers": {
"alphaswarm-data": {
"command": "alphaswarm-data-mcp",
"env": { "ALPHASWARM_MCP_DATA_CANONICAL_URI": "http://localhost:8000/mcp/data" }
}
}
}
Where to add a new tool
Subclass DataMCPTool
under alphaswarm/data/mcp/tools/, decorate with @register_data_mcp_tool,
and the bridge does the rest. See
Concept: data MCP.
RFC 9728 + 8707 conformance
Every AlphaSwarm MCP server publishes Protected Resource Metadata at
/.well-known/oauth-protected-resource[/...] and validates the
aud claim on incoming tokens against the deployment's canonical
URI. The docs site's own MCP server lives at
https://docs.alpha-swarm.ai/mcp.