MCP Canary

Docs

Everything an agent or a human needs to run MCP Canary. The same text for agents is at /llms.txt.

Install #

# macOS, Linux
curl -fsSL https://mcpcanary.com/install.sh | sh
# Windows PowerShell
irm https://mcpcanary.com/install.ps1 | iex

The installer never asks a question and never needs sudo. It verifies the SHA-256 checksum and installs to the first writable directory on your PATH (~/.local/bin, ~/bin, /usr/local/bin, /opt/homebrew/bin), else to ~/.local/bin. Set CANARY_INSTALL_DIR or CANARY_VERSION=v0.1.0 to change that. On Windows it installs to %LOCALAPPDATA%\Programs\McpCanary and adds it to the user PATH.

Builds: macOS arm64 and x64, Linux x64 and arm64 (glibc 2.34 or later; Alpine is not supported yet), Windows x64. Releases: github.com/xakpc-dev-labs/canary/releases. The CLI is open source (MIT) in the same repository: github.com/xakpc-dev-labs/canary.

Quick start #

canary inspect https://api.example.com/mcp
canary monitor set customer-search-prod --url https://api.example.com/mcp \
  --tool search_customer --args '{"email":"[email protected]"}' \
  --assert '$.customers[0].email == "[email protected]"' --interval 5m --dry-run
# the same line without --dry-run
canary monitor test customer-search-prod

inspect connects, lists the tools with their safety class, and never calls a tool. It also prints the agent-readiness report: a grade (A-F) and findings on the tool names, descriptions, arguments, safety hints, server instructions, MCP version, and protocol compliance, each with a fix (agent_readiness in --json). The MCP server validator shows the same report in the browser; the MCP server tester shows the connection result and the grade. --dry-run shows what monitor set would do (see Preview). The first monitor set creates an anonymous workspace, saves its token, starts the 7-day trial, and runs the first check.

Preview #

canary monitor set ... --dry-run shows the monitor before it exists or changes:

Preview of monitor 'customer-search-prod' (new, nothing saved)
Endpoint    https://api.example.com/mcp  PASSED (streamable_http)
Tool        search_customer  read_only
Arguments   {"email":"[email protected]"}
Assertions  $.customers[0].email == "[email protected]"
Schedule    every 5m, timeout 30s
On apply    creates a workspace, starts the trial, saves the monitor, runs a first check

The preview connects to the endpoint and lists its tools, but it never calls a tool. It saves nothing, creates no workspace, starts no trial, and does not count as an on-demand check. For an existing monitor, it lists each field that would change. Header values are never shown. Warnings (Warning: CODE: message) name what would make the apply or its first check fail: a missing tool, a tool that is not read-only, an unreachable endpoint, or a plan limit. Exit code: 0 = ready, 2 = warnings, 20 = invalid input. With --json, it prints the API's answer from POST /v1/monitors/{name}/preview.

Known fixtures #

A tool can answer with valid JSON from the wrong place: a staging database, an empty replica, a broken tenant filter. To catch that, call the tool with a record that exists only in production, and assert more than one of its fields:

canary monitor set customer-search-prod --url https://api.example.com/mcp \
  --tool search_customer --args '{"email":"[email protected]"}' \
  --assert '$.customers[0].id == "cus_8Hq2"' \
  --assert '$.customers[0].plan == "pro"'

When the record is missing or different, the check fails with ASSERTION_FAILED and shows the path, the expected value, and what the tool returned.

To keep the configuration in the repository, put the monitor set line and a monitor test line in your deploy workflow. monitor set is idempotent: the same command again reports "changed": false.

Commands #

canary inspect URL [--bearer-env VAR] [--header-env Name=VAR]... | inspect --website PAGE_URL
canary monitor set NAME (--url URL | --website PAGE_URL) [--tool T] [--args JSON] [--assert EXPR]... [--interval 5m] [--timeout 30s]
                   [--bearer-env VAR] [--header-env Name=VAR]... [--allow-side-effects] [--alert-on-change] [--dry-run]
canary monitor list | get ID | delete ID | test ID [--timeout 90s] | checks ID [--limit N]
canary auth login ID [--client-id ID] [--client-secret-env VAR] [--scope S] [--no-wait] [--wait 15m] | status ID | logout ID
canary incident list [--status open|resolved] [--monitor ID] [--limit N] | get ID
canary webhook set NAME --url URL [--event E]... | list | get ID | delete ID | deliveries ID [--limit N]
canary email add ADDRESS | list | remove ADDRESS
canary pricing | entitlement
canary billing upgrade --plan solo|pro | billing portal
canary subscription cancel
canary workspace show | delete --yes

ID is a name or an id. Every command takes --json. monitor set gives the full desired state: an option you leave out goes back to its default. Durations: 90, 30s, 15m, 1h.

Safety #

A check calls a tool only when the server declares readOnlyHint: true for it. A tool that is mutating, possibly mutating, or has no hints needs --allow-side-effects. The rule is checked on every check, so a server that changes its hints later is not called. Without --tool, a check only connects and lists tools.

WebMCP #

WebMCP tools live in a web page: the page registers them for browser agents with document.modelContext.registerTool(). Every Shopify Liquid store has them. Set --website instead of --url; the checks, safety rule, assertions, incidents, and alerts are the same.

canary inspect --website https://your-store.myshopify.com/
canary monitor set my-store --website https://your-store.myshopify.com/ \
  --tool search_catalog --args '{"catalog":{"query":"gift card"}}' \
  --assert '$.products[0].available == true' --dry-run

Target auth #

Header secrets come only from environment variables, never from command-line values:

MCP_TOKEN=... canary monitor set prod --url https://api.example.com/mcp --bearer-env MCP_TOKEN
X_KEY=...     canary monitor set prod --url https://api.example.com/mcp --header-env X-Api-Key=X_KEY

Values are encrypted at rest and never returned. A monitor set without these options keeps the stored headers.

OAuth sign-in #

For a server that asks a human to sign in (Linear, Slack, Figma, GitHub, and most hosted MCP servers), create the monitor first, then sign in once:

canary monitor set linear --url https://mcp.linear.app/mcp
canary auth login linear        # prints a link for a human, then waits

The human opens the link on any device and signs in. The target sends the browser back to MCP Canary, which stores the tokens encrypted and renews the access token before it expires. Checks then send it. MCP Canary registers itself when the server allows it (client ID metadata document or dynamic client registration). For a server that does not, such as GitHub, register an OAuth app with the callback URL https://api.mcpcanary.com/oauth/callback and pass it:

GH_SECRET=... canary auth login github --client-id Iv1.abc123 --client-secret-env GH_SECRET

When the token cannot be renewed (revoked, or a token without renewal stops working), checks fail with TARGET_AUTH_EXPIRED, which opens an incident like any failure. Run canary auth login again. With --json, auth login returns the link at once; poll canary auth status ID --json until login_pending is false. A monitor set with a new URL removes the sign-in.

Assertions #

'$.customers[0].email == "[email protected]"'    equals (the right side is JSON, so strings need quotes)
'$.count != 0'                       not equals
'$.items exists'                     the path is present
'$.name contains "acme"'             substring, or an array element
'$.id matches "^cus_"'               regular expression
'duration < 3000ms'                  tool call time (ms, s, m, h)

$ is the tool's structuredContent, else its first text block parsed as JSON. Paths support .name, ['name'], and [0]. A tool result with isError: true always fails the check.

Exit codes #

Code Meaning
0 Success. For inspect and monitor test: the check passed.
2 monitor set saved the monitor, but the first check failed. With --dry-run: the preview has warnings.
3 The target is unhealthy: assertion failed, tool error, auth or protocol problem.
10 No token or a bad token.
11 Permission denied, or a limit that no plan allows.
20 Invalid input (bad flag, bad JSON, missing environment variable).
21 Not found.
30 MCP Canary is unavailable or rate limited. Retry later.
31 The target is unreachable or timed out.
40 Payment required. The error lists offers with checkout links.

JSON output and errors #

With --json, stdout has only the API's JSON, also for errors, and stderr is empty. Every error has the same shape:

{ "ok": false, "code": "PLAN_LIMIT_REACHED", "retryable": false,
  "message": "Monitor limit reached: the trial plan allows 3 monitors. ...",
  "details": { "limit": "monitors", "current_plan": "trial", "required_plan": "solo" },
  "offers": [ { "plan": "solo", "amount": 2400, "currency": "USD", "interval": "month", "checkout_url": "https://..." } ] }

A failed check is not an error: inspect and monitor test return "status": "failed" with a failure object (code, message, details). Failure codes include TARGET_UNAVAILABLE, TARGET_TIMEOUT, TOOL_RETURNED_ERROR, ASSERTION_FAILED, and SIDE_EFFECTS_NOT_ALLOWED.

Incidents and contract changes #

Only scheduled checks open incidents, and only after a confirming re-check. The next passing scheduled check resolves it. monitor test never opens or resolves one, so a CI run does not page anyone.

Each check compares the tool contract (names and schemas, not descriptions) with the last one and records the difference: tool_added, tool_removed, argument_added, argument_removed, argument_type_changed, and more. With --alert-on-change, a change also opens an incident.

Email alerts #

canary email add [email protected]

The address gets a confirm link first. Alerts start after someone clicks it, so an agent cannot send email to an address that nobody confirmed. A pending address gets a new link at most every 10 minutes when you run email add again.

Emails go out for incident.opened, incident.resolved, entitlement.expiring (2 days before a trial ends, 3 days before a cancelled plan ends, with payment links), and entitlement.expired. Never for single checks. Every email is plain text and has a one-click unsubscribe link; unsubscribing removes the address. The number of addresses depends on the plan.

Webhooks #

canary webhook set ops --url https://hooks.example.com/canary          # default events
canary webhook set ops --url https://hooks.example.com/canary --event '*'

Events: monitor.created, monitor.updated, monitor.deleted, check.passed, check.failed, contract.changed, incident.opened, incident.resolved, entitlement.activated, entitlement.expiring, entitlement.expired. Default: contract.changed, incident.*, entitlement.expiring, entitlement.expired.

The signing secret is shown once, on create. Each request has X-McpCanary-Signature: t=<unix seconds>,v1=<hex>, where v1 is HMAC-SHA256 of t + "." + body with the secret. Compare in constant time and reject old timestamps. Failed deliveries are retried with the same event id.

Plans and payment #

canary pricing shows the plans; canary entitlement shows yours. When a write needs a plan, the error lists offers with a checkout_url: give it to a human. A link is valid for 7 days. canary subscription cancel cancels at the end of the paid period. When access ends, checks pause; nothing is deleted.

canary workspace show prints the workspace id (GET /v1/workspace), the API URL, and where the token comes from (MCP_CANARY_TOKEN or the credentials file), with only the first characters of the token. Give the id to support; never share the token.

canary workspace delete --yes deletes the workspace with all monitors, history, webhooks, and alert emails, and forgets the saved token. It refuses while a paid subscription renews: cancel it first.

Configuration #

Variable Use
MCP_CANARY_TOKEN Workspace token. Wins over the saved token.
MCP_CANARY_API_URL API base URL. Default https://api.mcpcanary.com.

The token is saved per API URL in ~/Library/Application Support/McpCanary/credentials.json (macOS), ~/.config/mcpcanary/credentials.json (Linux), or %LOCALAPPDATA%\McpCanary\credentials.json (Windows), with mode 0600.

HTTP API #

The CLI is a thin client: everything it does is an HTTP call to https://api.mcpcanary.com/v1/... with Authorization: Bearer <token>. The OpenAPI document is at https://api.mcpcanary.com/openapi.json.