MCP server
Connect an AI agent or assistant to your tracking data through the read-only Model Context Protocol server at /api/mcp, authenticated with an API key.
Last updated 4 min read
TrackCrown exposes a read-only Model Context Protocol server so AI agents and assistants (Claude, ChatGPT connectors, IDE agents, your own tools) can answer questions about your tracking data: "Which offers made the most profit yesterday?", "Find the click for this gclid", "Build a tracking link for partner Acme".
Every tool calls the same code as the matching REST endpoint, so the key's workspace, role (partner and advertiser restrictions), IP allowlist and rate limit (600 requests per minute, shared with the REST API) apply unchanged. Each tool call is written to the workspace audit log.
Connect a client#
- Create a key for the agent: Settings → API keys → Create API key, access Analyst (read-only is all the server needs). For a partner's or advertiser's own assistant, use their portal key instead.
- Optional: restrict the key with an IP allowlist if the agent runs from fixed addresses.
- Add the server to your client as a remote (HTTP) MCP server with the URL and an
Authorizationheader.
Example client configuration (format varies by client):
{
"mcpServers": {
"TrackCrown": {
"type": "http",
"url": "https://app.trackcrown.com/api/mcp",
"headers": { "Authorization": "Bearer atk_AbCd1234_…" }
}
}
}Tools#
params is an object of extra REST query parameters (string values) for anything the tool does not list, for
example {"filters": "country:in:US|CA"} on run_report or {"sub3": "x"} on tracking_link. Arrays such as
group_by are sent comma-separated.
Tool results contain the REST response twice: as structuredContent (JSON) and as one text block. Errors come back
as a tool result with isError: true and text such as invalid_parameter: … — the REST error codes from
Rate limits & errors. Money is returned as decimal strings in the workspace
currency unless noted.
Protocol details#
Send JSON-RPC 2.0 messages with POST. A batch (JSON array) may hold up to 20 messages; the body may be at most
1 MB.
curl -s https://app.trackcrown.com/api/mcp \
-H "Authorization: Bearer $ATK" -H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"run_report","arguments":{"preset":"yesterday","group_by":["offer"],"metrics":["clicks","conversions","profit"],"sort":"-profit","limit":5}}}'HTTP-level errors:
JSON-RPC errors in a 200 answer: -32600 invalid request, -32601 unknown method, -32602 unknown tool.
In-panel assistant#
Staff can also ask questions in Assistant (/app/assistant), which uses the same read-only tools with the
signed-in user's role. It is available when the platform has an AI provider key configured.
See also: API overview · Authentication & API keys.