Cairo is a headless, MCP-first customer data platform. Agents are the primary user. This document describes how to connect, authenticate, and call every available tool.
Also: /llms.txt (agent-readable summary) · /.well-known/mcp.json (machine-readable discovery) · /mcp (MCP JSON-RPC endpoint) · /health (health)
Cairo exposes its capabilities as an MCP (Model Context Protocol) server over HTTP. Agents send JSON-RPC requests to POST /mcp and receive structured JSON responses. The same capabilities are also exposed as REST endpoints for backward compatibility with existing tools (Segment-compatible event ingestion, REST CRUD for destinations, etc.).
There is no UI. Everything is done through MCP or REST.
All requests to /mcp require a write key. Pass it as one of:
X-Write-Key: your-key
Authorization: Bearer your-key
Any non-empty key is currently accepted. Fine-grained key validation (per-namespace scopes, rate limits) is on the roadmap.
Cairo implements MCP protocol version 2024-11-05 over the Streamable HTTP transport. All requests are JSON-RPC 2.0.
Handshake. Returns protocol version, server info, and capabilities.
curl -X POST https://cairo.ani.computer/mcp \
-H "Content-Type: application/json" \
-H "X-Write-Key: YOUR_KEY" \
-d '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{}}'
Response:
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"protocolVersion": "2024-11-05",
"serverInfo": { "name": "cairo-cdp", "version": "2.0.0" },
"capabilities": { "tools": {} }
}
}
Returns every available tool with its name, description, and input schema.
curl -X POST https://cairo.ani.computer/mcp \
-H "Content-Type: application/json" \
-H "X-Write-Key: YOUR_KEY" \
-d '{"jsonrpc":"2.0","id":2,"method":"tools/list"}'
Invoke a tool. The result is returned inside result.content as an array of MCP content blocks. Cairo always returns one text block containing the stringified JSON response.
curl -X POST https://cairo.ani.computer/mcp \
-H "Content-Type: application/json" \
-H "X-Write-Key: YOUR_KEY" \
-d '{"jsonrpc":"2.0","id":3,"method":"tools/call","params":{
"name":"track_event",
"arguments":{"event":"signup","user_email":"jane@example.com"}
}}'
Response:
{
"jsonrpc": "2.0",
"id": 3,
"result": {
"content": [
{ "type": "text", "text": "{\n \"tracked\": true,\n \"event\": \"signup\",\n \"event_key\": \"mcp-signup-jane@example.com-1234567890\"\n}" }
]
}
}
Liveness check. Returns empty result.
curl -X POST https://cairo.ani.computer/mcp \
-H "X-Write-Key: YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0","id":99,"method":"ping"}'
| Code | Meaning |
|---|---|
-32000 | Missing write key |
-32600 | Invalid request (missing method) |
-32601 | Method not found |
-32603 | Internal error (uncaught exception) |
Batch mode is supported: send a JSON array of JSON-RPC requests, receive an array of responses.
Every capability Cairo offers is an MCP tool. Each section below lists arguments and a working curl example. Required arguments are marked; everything else is optional.
track_eventTrack a CDP event (page view, click, purchase, custom event).
| Argument | Type | Description |
|---|---|---|
event (required) | string | Event name |
user_id | string | User ID |
user_email | string | User email |
anonymous_id | string | Anonymous ID |
properties | object | Event properties |
namespace | string | Namespace (default: "default") |
Example:
curl -X POST https://cairo.ani.computer/mcp \
-H "Content-Type: application/json" \
-H "X-Write-Key: YOUR_KEY" \
-d '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"track_event","arguments":{"event":"<event>"}}}'
batch_trackTrack multiple events in a single call. Each item needs at least an event name.
| Argument | Type | Description |
|---|---|---|
events (required) | array | Array of event objects |
namespace | string | Namespace for all events |
Example:
curl -X POST https://cairo.ani.computer/mcp \
-H "Content-Type: application/json" \
-H "X-Write-Key: YOUR_KEY" \
-d '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"batch_track","arguments":{"events":[]}}}'
query_eventsQuery CDP events with filters. Returns recent events matching criteria.
| Argument | Type | Description |
|---|---|---|
event_type | string | Filter by event type |
user_email | string | Filter by user email |
platform | string | Filter by platform |
limit | number | Max results (default 20) |
since | string | ISO timestamp: only events after this time |
Example:
curl -X POST https://cairo.ani.computer/mcp \
-H "Content-Type: application/json" \
-H "X-Write-Key: YOUR_KEY" \
-d '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"query_events","arguments":{}}}'
identify_userIdentify a user with traits (email, name, plan, etc.).
| Argument | Type | Description |
|---|---|---|
user_id (required) | string | User ID |
email | string | Email address |
traits | object | User traits |
namespace | string | Namespace |
Example:
curl -X POST https://cairo.ani.computer/mcp \
-H "Content-Type: application/json" \
-H "X-Write-Key: YOUR_KEY" \
-d '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"identify_user","arguments":{"user_id":"<user_id>"}}}'
lookup_userLook up a user by email. Returns profile, traits, and recent activity.
| Argument | Type | Description |
|---|---|---|
email (required) | string | User email to look up |
Example:
curl -X POST https://cairo.ani.computer/mcp \
-H "Content-Type: application/json" \
-H "X-Write-Key: YOUR_KEY" \
-d '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"lookup_user","arguments":{"email":"<email>"}}}'
resolve_identityResolve the identity graph for a user across IDs, emails, and anonymous IDs.
| Argument | Type | Description |
|---|---|---|
user_id | string | User ID |
email | string | |
anonymous_id | string | Anonymous ID |
namespace | string | Namespace |
Example:
curl -X POST https://cairo.ani.computer/mcp \
-H "Content-Type: application/json" \
-H "X-Write-Key: YOUR_KEY" \
-d '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"resolve_identity","arguments":{}}}'
alias_identityLink two user identities together (e.g., anonymous ID to known user).
| Argument | Type | Description |
|---|---|---|
previous_id (required) | string | Previous user ID or anonymous ID |
user_id (required) | string | New canonical user ID |
namespace | string | Namespace |
Example:
curl -X POST https://cairo.ani.computer/mcp \
-H "Content-Type: application/json" \
-H "X-Write-Key: YOUR_KEY" \
-d '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"alias_identity","arguments":{"previous_id":"<previous_id>","user_id":"<user_id>"}}}'
capture_errorCapture an error event (like Sentry). Supports stack traces, context, and tagging.
| Argument | Type | Description |
|---|---|---|
message (required) | string | Error message |
stack_trace | string | Stack trace |
type | string | Error type (error, exception, rejection) |
level | string | Severity: fatal, error, warning, info |
source_file | string | Source file path |
source_line | number | Line number |
user_email | string | Affected user email |
context | object | Additional context |
tags | object | Tags for filtering |
release | string | Release/version |
environment | string | Environment (production, staging) |
namespace | string | Namespace |
Example:
curl -X POST https://cairo.ani.computer/mcp \
-H "Content-Type: application/json" \
-H "X-Write-Key: YOUR_KEY" \
-d '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"capture_error","arguments":{"message":"<message>"}}}'
list_error_groupsList error groups (like Sentry issues). Filter by status.
| Argument | Type | Description |
|---|---|---|
status | string | Filter: open, resolved, ignored, regressed |
namespace | string | Namespace |
limit | number | Max results (default 20) |
Example:
curl -X POST https://cairo.ani.computer/mcp \
-H "Content-Type: application/json" \
-H "X-Write-Key: YOUR_KEY" \
-d '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"list_error_groups","arguments":{}}}'
get_error_groupGet details of a specific error group by fingerprint.
| Argument | Type | Description |
|---|---|---|
fingerprint (required) | string | Error group fingerprint |
Example:
curl -X POST https://cairo.ani.computer/mcp \
-H "Content-Type: application/json" \
-H "X-Write-Key: YOUR_KEY" \
-d '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"get_error_group","arguments":{"fingerprint":"<fingerprint>"}}}'
resolve_errorUpdate an error group status to resolved, ignored, or reopen it.
| Argument | Type | Description |
|---|---|---|
fingerprint (required) | string | Error group fingerprint |
status (required) | string | New status: open, resolved, ignored |
assigned_to | string | Assign to (email or name) |
Example:
curl -X POST https://cairo.ani.computer/mcp \
-H "Content-Type: application/json" \
-H "X-Write-Key: YOUR_KEY" \
-d '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"resolve_error","arguments":{"fingerprint":"<fingerprint>","status":"<status>"}}}'
error_trendsGet error count trends over time for monitoring and alerting.
| Argument | Type | Description |
|---|---|---|
namespace | string | Namespace |
time_range | string | 24h, 7d, or 30d |
group_by | string | hour or day |
Example:
curl -X POST https://cairo.ani.computer/mcp \
-H "Content-Type: application/json" \
-H "X-Write-Key: YOUR_KEY" \
-d '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"error_trends","arguments":{}}}'
list_destinationsList configured event destinations and their status.
| Argument | Type | Description |
|---|---|---|
namespace | string | Namespace (default: "default") |
Example:
curl -X POST https://cairo.ani.computer/mcp \
-H "Content-Type: application/json" \
-H "X-Write-Key: YOUR_KEY" \
-d '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"list_destinations","arguments":{}}}'
list_destination_typesList all available destination types (Mixpanel, Slack, BigQuery, etc.).
No arguments.
Example:
curl -X POST https://cairo.ani.computer/mcp \
-H "Content-Type: application/json" \
-H "X-Write-Key: YOUR_KEY" \
-d '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"list_destination_types","arguments":{}}}'
create_destinationCreate a new event destination configuration.
| Argument | Type | Description |
|---|---|---|
name (required) | string | Destination name |
type (required) | string | Destination type (e.g., mixpanel, slack, bigquery) |
namespace | string | Namespace |
config | object | Destination-specific config (API keys, URLs, etc.) |
event_types | array | Event types to forward (default: all) |
Example:
curl -X POST https://cairo.ani.computer/mcp \
-H "Content-Type: application/json" \
-H "X-Write-Key: YOUR_KEY" \
-d '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"create_destination","arguments":{"name":"<name>","type":"<type>"}}}'
update_destinationUpdate an existing destination configuration.
| Argument | Type | Description |
|---|---|---|
id (required) | string | Destination config ID |
name | string | New name |
config | object | Updated config |
enabled | boolean | Enable or disable |
event_types | array | Updated event types |
Example:
curl -X POST https://cairo.ani.computer/mcp \
-H "Content-Type: application/json" \
-H "X-Write-Key: YOUR_KEY" \
-d '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"update_destination","arguments":{"id":"<id>"}}}'
delete_destinationDelete a destination configuration.
| Argument | Type | Description |
|---|---|---|
id (required) | string | Destination config ID |
Example:
curl -X POST https://cairo.ani.computer/mcp \
-H "Content-Type: application/json" \
-H "X-Write-Key: YOUR_KEY" \
-d '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"delete_destination","arguments":{"id":"<id>"}}}'
list_transformationsList event transformation rules for a namespace.
| Argument | Type | Description |
|---|---|---|
namespace | string | Namespace (default: "default") |
Example:
curl -X POST https://cairo.ani.computer/mcp \
-H "Content-Type: application/json" \
-H "X-Write-Key: YOUR_KEY" \
-d '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"list_transformations","arguments":{}}}'
create_transformationCreate a new event transformation rule (JavaScript function).
| Argument | Type | Description |
|---|---|---|
name (required) | string | Transformation name |
code (required) | string | JavaScript transformation function body |
namespace | string | Namespace |
destination_id | string | Apply only to this destination |
execution_order | number | Order of execution (lower runs first) |
Example:
curl -X POST https://cairo.ani.computer/mcp \
-H "Content-Type: application/json" \
-H "X-Write-Key: YOUR_KEY" \
-d '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"create_transformation","arguments":{"name":"<name>","code":"<code>"}}}'
update_transformationUpdate an existing transformation rule.
| Argument | Type | Description |
|---|---|---|
id (required) | string | Transformation ID |
name | string | |
code | string | |
enabled | boolean |
Example:
curl -X POST https://cairo.ani.computer/mcp \
-H "Content-Type: application/json" \
-H "X-Write-Key: YOUR_KEY" \
-d '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"update_transformation","arguments":{"id":"<id>"}}}'
delete_transformationDelete a transformation rule.
| Argument | Type | Description |
|---|---|---|
id (required) | string | Transformation ID |
Example:
curl -X POST https://cairo.ani.computer/mcp \
-H "Content-Type: application/json" \
-H "X-Write-Key: YOUR_KEY" \
-d '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"delete_transformation","arguments":{"id":"<id>"}}}'
list_tracking_plansList tracking plans (event schemas and validation rules).
| Argument | Type | Description |
|---|---|---|
namespace | string | Namespace (default: "default") |
Example:
curl -X POST https://cairo.ani.computer/mcp \
-H "Content-Type: application/json" \
-H "X-Write-Key: YOUR_KEY" \
-d '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"list_tracking_plans","arguments":{}}}'
create_tracking_planCreate a new tracking plan with event schema validation.
| Argument | Type | Description |
|---|---|---|
name (required) | string | Plan name |
namespace | string | Namespace |
enforcement_mode | string | allow, warn, or drop |
schema | object | JSON Schema for event validation |
Example:
curl -X POST https://cairo.ani.computer/mcp \
-H "Content-Type: application/json" \
-H "X-Write-Key: YOUR_KEY" \
-d '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"create_tracking_plan","arguments":{"name":"<name>"}}}'
update_tracking_planUpdate an existing tracking plan.
| Argument | Type | Description |
|---|---|---|
id (required) | string | Plan ID |
name | string | |
enforcement_mode | string | |
schema | object |
Example:
curl -X POST https://cairo.ani.computer/mcp \
-H "Content-Type: application/json" \
-H "X-Write-Key: YOUR_KEY" \
-d '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"update_tracking_plan","arguments":{"id":"<id>"}}}'
delete_tracking_planDelete a tracking plan.
| Argument | Type | Description |
|---|---|---|
id (required) | string | Plan ID |
Example:
curl -X POST https://cairo.ani.computer/mcp \
-H "Content-Type: application/json" \
-H "X-Write-Key: YOUR_KEY" \
-d '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"delete_tracking_plan","arguments":{"id":"<id>"}}}'
gdpr_delete_userDelete a user and all their data (GDPR right to erasure).
| Argument | Type | Description |
|---|---|---|
user_id (required) | string | User ID or email to delete |
namespace | string | Namespace |
Example:
curl -X POST https://cairo.ani.computer/mcp \
-H "Content-Type: application/json" \
-H "X-Write-Key: YOUR_KEY" \
-d '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"gdpr_delete_user","arguments":{"user_id":"<user_id>"}}}'
gdpr_suppress_userSuppress a user so no new events are stored for them.
| Argument | Type | Description |
|---|---|---|
user_id (required) | string | User ID or email |
reason | string | Reason for suppression |
namespace | string | Namespace |
Example:
curl -X POST https://cairo.ani.computer/mcp \
-H "Content-Type: application/json" \
-H "X-Write-Key: YOUR_KEY" \
-d '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"gdpr_suppress_user","arguments":{"user_id":"<user_id>"}}}'
gdpr_unsuppress_userRemove suppression for a user.
| Argument | Type | Description |
|---|---|---|
user_id (required) | string | User ID or email |
namespace | string | Namespace |
Example:
curl -X POST https://cairo.ani.computer/mcp \
-H "Content-Type: application/json" \
-H "X-Write-Key: YOUR_KEY" \
-d '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"gdpr_unsuppress_user","arguments":{"user_id":"<user_id>"}}}'
gdpr_check_suppressionCheck if a user is currently suppressed.
| Argument | Type | Description |
|---|---|---|
user_id (required) | string | User ID or email |
namespace | string | Namespace |
Example:
curl -X POST https://cairo.ani.computer/mcp \
-H "Content-Type: application/json" \
-H "X-Write-Key: YOUR_KEY" \
-d '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"gdpr_check_suppression","arguments":{"user_id":"<user_id>"}}}'
query_agent_sessionsQuery AI agent tracking sessions. See which agents ran, their costs, and outcomes.
| Argument | Type | Description |
|---|---|---|
agent_id | string | Filter by agent ID |
namespace | string | Namespace |
status | string | Filter: active, completed |
limit | number | Max results (default 20) |
Example:
curl -X POST https://cairo.ani.computer/mcp \
-H "Content-Type: application/json" \
-H "X-Write-Key: YOUR_KEY" \
-d '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"query_agent_sessions","arguments":{}}}'
system_healthGet Cairo system health: database status, uptime, event counts, error counts.
No arguments.
Example:
curl -X POST https://cairo.ani.computer/mcp \
-H "Content-Type: application/json" \
-H "X-Write-Key: YOUR_KEY" \
-d '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"system_health","arguments":{}}}'
describe_toolGet detailed description, input schema, and usage example for any MCP tool.
| Argument | Type | Description |
|---|---|---|
tool_name (required) | string | Name of the tool to describe |
Example:
curl -X POST https://cairo.ani.computer/mcp \
-H "Content-Type: application/json" \
-H "X-Write-Key: YOUR_KEY" \
-d '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"describe_tool","arguments":{"tool_name":"<tool_name>"}}}'
Cairo exposes Segment-compatible REST endpoints for existing client libraries. All also accept the X-Write-Key header.
| Endpoint | Method | Description |
|---|---|---|
/api/v2/track | POST | Track a single event |
/api/v2/batch | POST | Track many events |
/api/v2/identify | POST | Identify a user |
/api/v2/page | POST | Page view |
/api/v2/screen | POST | Screen view (mobile) |
/api/v2/group | POST | Associate user with group |
/api/v2/alias | POST | Link two identities |
/api/v2/errors/capture | POST | Capture an error |
/api/v2/identities/resolve | GET | Resolve identity graph |
/api/v2/destinations | GET/POST | Destination CRUD |
/api/v2/transformations | GET/POST | Transformation CRUD |
/api/v2/tracking-plans | GET/POST | Tracking plan CRUD |
/api/v2/users/:userId | DELETE | GDPR delete |
| Package | Use for |
|---|---|
@cairo/tracker | Universal event tracking from apps |
@cairo/agent-tracker | AI agent session tracking (generations, tool calls, costs) |
@cairo/agent-mcp | stdio MCP server for Claude Code, Cursor, and other agents |
@cairo/node-sdk | Node.js server-side SDK |
{
"mcpServers": {
"cairo": {
"command": "npx",
"args": ["-y", "@cairo/agent-mcp"],
"env": {
"CAIRO_HOST": "https://cairo.ani.computer",
"CAIRO_WRITE_KEY": "your-write-key",
"CAIRO_AGENT_ID": "my-agent"
}
}
}
}
Cairo is Node.js + PostgreSQL. MIT licensed.
git clone https://github.com/outcome-driven-studio/cairo.git cd cairo npm install cp .env.example .env # Set POSTGRES_URL in .env npm run migrate npm start