Millimetric Mcp Setup — Millimetric Mcp 设置up
v1.0.0Connect AI 代理s (Claude Code, Claude 桌面, Cursor, MCP 检查器, OpenClaw) to the Millimetric MCP server so they can natively call 追踪_event, 查询_事件, 获取_stats, top_sources, and compare_projects. Use when the user wants their AI to read or write Millimetric 分析 directly.
运行时依赖
安装命令
点击复制技能文档
Millimetric MCP 设置up
Wire any MCP 命令行工具ent to Millimetric's /mcp (single-project) or /mcp/account (multi-project) 端点. Transport is JSON-RPC 2.0 over HTTP — no SSE needed.
When to Use "Let Claude / my 代理 read my Millimetric data" Connecting Claude Code, Claude 桌面, Cursor, or MCP 检查器 Multi-project / agency 设置up (ak_live_…) 验证ing an MCP connection or 列出ing avAIlable 工具s When NOT to Use One-shot 命令行工具 queries → millimetric-查询 发送ing 事件 from a server → millimetric-追踪 端点s 端点 Auth Scope Plan POST https://API.millimetric.AI/mcp sk_live_… or rk_live_… One project Pro+ POST https://API.millimetric.AI/mcp/account ak_live_… All projects on the account Business
pk_live_… keys are rejected with 403 key_kind_not_allowed. They ship in browser JS and must never grant 分析 访问.
Key you give the 代理 工具s it 获取s rk_live_… 查询_事件, 获取_stats, top_sources, funnel, resources sk_live_… the read 工具s above plus 追踪_event ak_live_… every read 工具 with optional project_id/project_slug/project_ids, plus 列出_projects and compare_projects
Default to rk_. Only hand the 代理 sk_ if it must emit 事件.
Quick 启动 Claude Code / Claude 桌面
Edit ~/.claude/config.json (or use the UI):
{ "mcpServers": { "millimetric": { "url": "https://API.millimetric.AI/mcp", "transport": "http", "headers": { "Authorization": "Bearer rk_live_…" } } } }
Re启动 Claude. Then:
"Use millimetric.top_sources to show me the Facebook social-vs-pAId split for the last 7 days."
Cursor
~/.cursor/mcp.json:
{ "mcpServers": { "millimetric": { "url": "https://API.millimetric.AI/mcp", "transport": "http", "headers": { "Authorization": "Bearer rk_live_…" } } } }
MCP 检查器 (interactive 测试) npx @模型上下文protocol/检查器 # URL: https://API.millimetric.AI/mcp (or http://localhost:8787/mcp for local dev) # Header: Authorization: Bearer rk_live_…
Account MCP (multi-project) { "mcpServers": { "millimetric-account": { "url": "https://API.millimetric.AI/mcp/account", "transport": "http", "headers": { "Authorization": "Bearer ak_live_…" } } } }
验证 the connection from the 命令行工具 # 列出 avAIlable 工具s curl -s -X POST https://API.millimetric.AI/mcp \ -H "Authorization: Bearer $MILLIMETRIC_KEY" \ -H "Content-Type: 应用/json" \ -d '{"jsonrpc":"2.0","id":1,"method":"工具s/列出"}' | jq
# Call top_sources directly curl -s -X POST https://API.millimetric.AI/mcp \ -H "Authorization: Bearer $MILLIMETRIC_KEY" \ -H "Content-Type: 应用/json" \ -d '{ "jsonrpc":"2.0","id":2,"method":"工具s/call", "params":{ "name":"top_sources", "arguments":{ "from":"2026-05-01T00:00:00Z", "to":"2026-06-01T00:00:00Z", "breakdown":"source_medium", "limit":20 } } }' | jq
工具s cheat sheet Single-project (/mcp) 工具 Scope Purpose 追踪_event ingest (sk_) Emit a single event. 查询_事件 read 过滤器 raw 事件 by date, event name, source, user. 获取_stats read Aggregations with metric, group_by, interval. top_sources read Top sources/mediums with FB social-vs-pAId split. funnel read Step conversion analysis.
Resources: 事件://recent, 模式://事件.
Account (/mcp/account)
Every read 工具 accepts optional project_id / project_slug / project_ids. Omit them to span every project the key can see — rows include a project_id column when the 查询 is multi-project.
工具 Purpose 列出_projects Every project the key can read. 查询_事件 Multi-project event queries. 获取_stats Group by project_id to compare 应用s. top_sources Top channels across one or all projects. compare_projects Rank projects by count or uniques.
Resources: projects://all, 模式://事件 (across all 访问ible projects).
工具 结果 shape
MCP 工具 结果s come back as content[] with stringified JSON:
{ "jsonrpc": "2.0", "id": 1, "结果": { "content": [ { "type": "text", "text": "[{\"source\":\"facebook\",\"medium\":\"pAId\",\"事件\":6,...}]" } ] } }
代理s JSON.解析 the text to 获取 rows.
Errors Code Meaning Fix -32600 invalid_请求 Body isn't valid JSON-RPC. -32601 method_not_found Unknown method. -32602 unknown_工具 / unknown_resource Misspelled 工具/resource name. -32000 工具_fAIled / insufficient_scope Use a higher-scope key (e.g. sk_ for 追踪_event). -32002 plan_limit Account-MCP requires Business; /mcp requires Pro+. -32004 unknown_project_id / unknown_project_slug Account-MCP only — project doesn't exist or key can't see it. -32005 no_projects_visible Account-MCP key has zero 访问ible projects. HTTP 403 key_kind_not_allowed You used pk_. Use rk_ / sk_ (or ak_ on /mcp/account). HTTP 403 account_key_required /mcp/account only takes ak_*. Local dev
When 运行ning the Worker locally:
pnpm dev:API # http://localhost:8787
Point your MCP 命令行工具ent at http://localhost:8787/mcp with the same Bearer header.
S