cmcp_live_... keys for pipelines, SDKs, and MCP. Each key can carry conditions that limit what it can do.
Manage keys in the dashboard (Connect → API keys) or via the API keys reference.
Why conditions
| Use case | Typical conditions |
|---|---|
| CI for one project | project_id + log_usage + read_summaries |
| Shared ingest with a budget | monthly_limit |
| Temporary contractor key | expires_at |
| Locked-down server | allowed_cidrs + rate_limit_rpm |
Create a key (dashboard)
- Open
https://costmcp.com→ your workspace → Connect - Under API keys, set:
- Name
- Permissions (checkboxes)
- Project scope (all projects or one)
- Monthly limit (USD) (optional)
- Expires (optional)
- Advanced: rate limit, CIDR allowlist, live/test
- Click Create key and copy the secret once
Create a key (API)
secret (cmcp_live_...) once. Store it as COSTMCP_API_KEY in your pipeline.
Condition reference
| Field | Effect |
|---|---|
permissions[] | Capability allow-list — see Permissions |
project_id | Key may only touch that project (writes + reads) |
conditions.project_slugs | Multi-project allow-list (ignored if project_id is set) |
conditions.deny_project_slugs | Deny-list when no allow-list |
conditions.features | Restrict usage feature strings |
conditions.sources | Restrict api / mcp / manual / import |
monthly_limit | Max USD attributed to this key in the current UTC month |
expires_at | Hard stop — 401 key_expired |
rate_limit_rpm | Rolling 60s window — 429 rate_limited |
allowed_cidrs | Empty = all IPs; otherwise 403 ip_not_allowed |
environment | live (default) or test |
project_id over project_slugs).
How enforcement works
Same checks apply to REST ingest/read routes andhttps://mcp.costmcp.com.
Error shape
Use the key
REST
Remote MCP (API key bridge)
Rotate, edit, revoke
| Action | Endpoint / UI |
|---|---|
| Edit conditions | Dashboard Edit, or PATCH .../api-keys/{id} |
| Rotate secret | Dashboard Rotate, or POST .../api-keys/{id}/rotate |
| Revoke | Dashboard Revoke, or DELETE .../api-keys/{id} |
Spend metering
Every successful ingest stampsapi_key_id on the cost_messages row. The dashboard list shows spent / monthly_limit for the current UTC month. Only spend attributed to that key counts toward the cap.
Production vs local env key
| Environment | COSTMCP_API_KEY env on the API process |
|---|---|
Local / NODE_ENV !== production | Accepted as a demo-workspace fallback |
| Production | Disabled unless COSTMCP_ALLOW_ENV_API_KEY=true |
Related
- API keys reference — full request/response fields
- Authentication — key vs JWT vs OAuth
- Permissions — permission strings
- Remote HTTP MCP — agent URL
https://mcp.costmcp.com
