API and MCP
Everything the dashboard shows can be asked for by a script, a CI job or an AI assistant. Two doors, one credential:
- REST API: the routes the dashboard itself uses, under
/v1, documented at/v1/openapi.jsonon your deployment. - MCP: a Model Context Protocol server
at
/v1/mcp, so an assistant (Claude, Cursor, VS Code Copilot, anything that speaks MCP) can ask CoverOps questions in a conversation: "which tests does this change affect", "what is dead in prod", "does the gate pass for this branch".
The credential: an API token
Mint one under Team → API tokens in the dashboard. A token acts as the person who minted it (same projects, same visibility, their name in the audit log) and is capped by a scope:
| Scope | May |
|---|---|
read | every GET, the two questions sent as a POST (/v1/impact/plan, /v1/workspace/projects/{id}/select), and every MCP tool that answers a question |
write | also start, stop and resume coverage monitoring, finish a run, and choose which services and repositories are watched (PUT /v1/workspace/projects/{id}/monitoring); over MCP, the write tools below |
Over REST this is an allow list: any other change answers 403, whatever the
token's owner may do from a signed-in session. So a token can never manage
tokens, members, agent or link tokens, the session link, connections (git,
Slack, Atlassian), passwords, two-step or SSO, notification channels or other
settings, and cannot delete a run. CI does not need it for any of that: the
GitHub Action, the CLI and the test-framework plugins speak with an agent
token on /v1/agent/…. A viewer's token is always read. The raw value (cov_api_…) is
shown once; afterwards the list shows its prefix and when it was last used.
Revoke from the same screen; the next request gets 401.
Every call made with a token is in the access log as actor: token:<id> with
the owner's e-mail beside it, and minting and revoking are audit events
(api.token.mint, api.token.revoke).
REST
export COVEROPS=https://coverops.example.com
export TOKEN=cov_api_…
curl -s "$COVEROPS/v1/workspace/projects" -H "Authorization: Bearer $TOKEN"
curl -s "$COVEROPS/v1/workspace/dead-code?days=30&environment=prod" -H "Authorization: Bearer $TOKEN"
curl -s "$COVEROPS/v1/workspace/gate?days=14&branch=main" -H "Authorization: Bearer $TOKEN"
curl -s -X POST "$COVEROPS/v1/impact/plan" -H "Authorization: Bearer $TOKEN" \
-H "content-type: application/json" -d '{"since":"2026-10-01"}'
Routes answer for the caller's active project; GET /v1/workspace/projects
lists them and POST /v1/workspace/projects/{id}/select switches. The full
list of public routes, with parameters, is /v1/openapi.json.
MCP
The endpoint is POST /v1/mcp, Streamable HTTP and stateless: each message is
one request, authenticated by the same Bearer token. There is no session to
open; a client that insists on GET for a server stream gets a clear 405.
Connecting
Claude Code (step by step, with screenshots and the common errors: Claude Code with CoverOps)
claude mcp add --transport http coverops https://coverops.example.com/v1/mcp \
--header "Authorization: Bearer cov_api_…"
Cursor / VS Code (mcp.json):
{
"servers": {
"coverops": {
"type": "http",
"url": "https://coverops.example.com/v1/mcp",
"headers": { "Authorization": "Bearer cov_api_…" }
}
}
}
Anything else: a Streamable HTTP client with a static Authorization
header. OAuth-only clients (ones that cannot send a header) are not supported
yet; they would need an authorization server in front of the token. A request
without a valid token gets 401 with WWW-Authenticate: Bearer realm="coverops"
(plus error="invalid_token" when a token was sent but refused) and no
resource_metadata, and the protected-resource discovery paths answer 404
(/.well-known/oauth-protected-resource, also path-inserted, and everything
under /v1/mcp/.well-known/), so a client knows to use a header instead of
looping on discovery. The root /.well-known/oauth-authorization-server
belongs to "Connect with CoverOps" below and now answers 200: it serves
registered applications only, offers no client registration, and does not
cover MCP. An older MCP client that falls back to that document may stop with
a "no dynamic client registration" error instead of a clean "no OAuth";
configure it with a static Authorization: Bearer header. Clients that already
send a header are not affected.
Tools
| Tool | Answers | Scope |
|---|---|---|
list_projects | the projects the token sees, active one marked | read |
project_overview | repositories, agents, recent runs with coverage | read |
run_detail | one run: participants, tests, worst-covered files | read |
file_coverage | line coverage of one file, latest or a named run | read |
test_footprint | what one test did on the backend in one run: endpoints, services crossed, methods, files and lines, in request order | read |
coverage_trends | trends, risky files, test stability over a window | read |
dead_code | measured, never executed methods by file (per environment) | read |
service_map | the dependency network: services or methods, hops, p95 | read |
search_code | find a class or method and whether it ran | read |
ui_coverage | screens and controls used / never used (from ReplayOps) | read |
sessions | ReplayOps sessions the agents saw, with tests and links | read |
flaky_tests | flaky tests over a window: passed on retry in one run, passed and failed on one commit, or flapping on one branch; plus tests failing on one branch only | read |
why_failed | why a run's tests failed: the kind of failure per test and, for a code change, the commits whose lines the test runs | read |
failure_groups | failures that share one error across a window's runs, so one root cause shows once | read |
impact_plan | the tests a set of commits affects, with the change's risk score | read |
change_risk | how risky a set of commits is, 0–100 per changed file and overall, from the code map and coverage | read |
suggest_tests | the known tests to run for a change, and the changed files no known test reaches, with the symbols to test | read |
quality_gate | the gate verdict for a window, branch, service or suite | read |
alerts | the KPI alert log: breaches and recoveries, targets, channels | read |
notify | post a message to the project's Slack / Teams / webhook / e-mail | write |
code_structure | the code map joined with coverage: hubs and their coverage, communities and how much of each ran | read |
code_query | a question in words to the code map, answered as symbols, files and lines | read |
code_explain | one symbol: file, community, everything it connects to | read |
code_affected | what a change to a symbol reaches (blast radius) | read |
code_path | the shortest chain between two symbols | read |
rebuild_code_graph | rebuild the code map now | write |
start_coverage_monitoring | start a campaign run | write |
stop_coverage_monitoring | stop the active campaign | write |
Every tool takes an optional project (id or name); without it the token's
active project answers. Answers are JSON, capped to conversation size (a run's
files worst-first, up to a limit the tool accepts), and a tool that cannot
answer says why rather than failing silently; a read-only token calling
start_coverage_monitoring is told to mint a write token.
What an assistant can do with it
- Before a merge: "run the quality gate for branch
feature/xand list the changed lines nothing covers" →quality_gate, thenfile_coverage. - Planning a regression: "which tests should run for yesterday's commits" →
impact_plan. - Before merging: "how risky is this change, and where does nothing test it" →
change_risk, thensuggest_testsfor what to run and what to write. - A cleanup sprint: "what in prod has never executed in 90 days, by file" →
dead_codewithenvironment: prod. - An incident: "which services did session
ro_…touch and which tests were running" →sessions, thenservice_map.
The code map
Coverage says which lines ran; it does not say what the code is shaped like.
When source arrives (an agent's upload) or a repository is connected, CoverOps
builds a structural map of it with graphify:
tree-sitter over every file, a graph of calls, imports and inheritance, the
communities the source clusters into and the hubs everything leans on. No
model is called and nothing leaves the server; graphify ships in the API image
(COVEROPS_GRAPHIFY=off skips it).
Providers for the model-backed steps (Integrations → AI provider): Anthropic, OpenAI, DeepSeek, Ollama, and any OpenAI-compatible server (LM Studio, vLLM, llama.cpp, LiteLLM). Ollama and local servers need no key.
The map is built from the source the agents upload, from repositories that
are working copies on the server, and from connected GitHub, GitLab and
Bitbucket repositories (their archive at the default branch is fetched with
the connection's credential) and Azure DevOps repositories (as a zip of the
branch). A map with remote repositories is rebuilt every
COVEROPS_GRAPHIFY_REFRESH_HOURS hours as well, since a repository changes
without anybody uploading source. Which of the account's repositories a project maps follows the
selection on its Impact page: an owner with several projects and several
repositories keeps each map to its own codebase. Communities are named after the directory their files share, or by the
project's AI provider when one is connected. The dead-code view uses the same
map to say which never-executed methods nothing references at all.
The traced service map is laid over the static one as well: at service
grain the dependency network (the Services tab, service_map) says what each
service is made of on the map, which service-to-service references exist in
code but were never traced, and which traced hops have no code reference
behind them, which is what a network boundary should look like.
Joined with the latest run's coverage, the map answers the questions worth
asking an assistant: "which hubs are barely covered" (code_structure),
"what does a change to OrderService reach, and is any of it tested"
(code_affected, then file_coverage), "what connects checkout to payments"
(code_query). The Code graph page's Structure tab shows the same hubs and
communities with their coverage and has a box to ask the map directly.
Notifications: Slack, Teams, webhooks, e-mail
CoverOps evaluates the project's KPI targets on the server every
COVEROPS_KPI_EVAL_MINUTES minutes (15 by default; 0 turns it off) and
announces what changed: a target newly breached, and, where a channel asked
for it, a target back within range. Quality-gate verdicts from CI
(GET /v1/agent/gate) are announced the same way: failures always, passes to
channels that opted into recoveries. Channels are set up under
Reports → Notifications, one card per kind, each with a Test button
that sends a real message and shows what the far end answered. Each card
also shows the last delivery (an alert or a test): when, whether it went
through, and the far end's answer in words — so a webhook that was revoked
on the other side shows up on the card, not only in the server's log.
| Channel | What to paste | What arrives |
|---|---|---|
| Slack | an Incoming Webhook URL from the Slack app directory | a Block Kit message, coloured by severity, with a link into CoverOps |
| Microsoft Teams | a Workflows "Post to a channel when a webhook request is received" URL (Office 365 connector URLs, …webhook.office.com, were retired by Microsoft in May 2026 and are refused) | an Adaptive Card with the same facts and an Open in CoverOps button |
| Webhook | your own HTTPS endpoint and, optionally, a secret | JSON {event, project, title, lines, link, sent_at}; with a secret, X-CoverOps-Signature: sha256=<HMAC-SHA256 of the body> and X-CoverOps-Event |
| recipients | plain text and HTML, through the server's SMTP_URL or SES_REGION, from SMTP_FROM |
Links in messages use COVEROPS_DASHBOARD_URL, or https://COVEROPS_HOST in
the on-prem bundle; without either the message carries no link. Webhook URLs
are credentials: they are stored with the channel and never written to a log.
Over MCP, alerts reads the same log and notify posts through the same
channels, so an assistant that just summarised the nightly run can put the
summary where the team reads.
Connect with CoverOps (OAuth for other products)
Another product (TestingOps first) can connect one project by OAuth 2.0
instead of a pasted link token, and read GET /v1/link/coverage/by-test with
the access token it gets. Nothing else on the link surface accepts that token.
- Endpoints, at the root of the API host (
https://api.coverops.aion the hosted service; the dashboard's host on-prem, where the bundled proxy routes them to the API):/.well-known/oauth-authorization-server(RFC 8414),/oauth/authorize,/oauth/token,/oauth/revoke(RFC 7009). The issuer comes fromCOVEROPS_OAUTH_ISSUER, elseCOVEROPS_PUBLIC_API_URL, elseCOVEROPS_DASHBOARD_URL. - Applications are registered by a super admin under Platform → OAuth apps:
a name and exact redirect URIs, https only. A client marked as a development
client may also use
http://localhost; a production client never can. The client secret is shown once and stored as a hash; rotate it if it is lost. - Limits:
/oauth/authorizetakes 30 requests a minute per address,/oauth/tokenand/oauth/revoke120 (each also capped overall); beyond that the answer is429. Finished requests, spent and expired tokens and ended connections are deleted every hour. - Scopes, each for the one project the person picks; an application asks
only for those its registration lists:
coverage:read:GET /v1/link/coverage/by-test.coverage:runs: open a RunningOps run, report its verdicts and finish it —POST /v1/agent/runs/start,POST /v1/agent/runs/testsandPOST /v1/agent/runs/finishwith the access token as the bearer, and no other agent route (coverage, traces and the rest answer403).sourceis alwaysrunningops(left out, it is set; any other value is a400). Finish closes only arunningopsrun of the connected project: a run of another origin there is a403, and a run key of another project is a404whatever the body says. The runs report as the application's own agent in the project, which holds no token. A token without the scope a route needs gets403witherror="insufficient_scope"; a refresh can never add a scope.
- Flow: authorization code with PKCE S256 and a required
state. The person signs in to CoverOps and picks one project they administer (owner or Admin seat). Client authentication isclient_secret_postorclient_secret_basic. - Tokens: the access token lives one hour. The refresh token changes on
every refresh; presenting a used one again ends the whole connection. A
connection nobody refreshes for 90 days expires. The token answer carries
project: { id, name }. Codes, tokens and secrets are stored as SHA-256 only. - Losing the right to connect: each refresh checks that the person who approved the connection still administers the project and that their account is on. Someone whose Admin seat is taken away, or whose account is switched off, therefore keeps the connection working for at most one more hour (the life of the access token already issued); the next refresh is refused and the connection ends. Revoke it under Connected apps to end it at once.
- Revoking: the application revokes its refresh token, or a project administrator presses Revoke under Projects → Connected apps. Either ends every token of the connection. Connecting, refused codes and refreshes, and revoking are in the audit log, without any secret.
Network and security notes
- The MCP endpoint sits behind the same TLS edge as the dashboard; nothing new
to open. If agents and people reach different hostnames, MCP is on the
people's one (
/v1/mcpon the dashboard host). - Rate limiting, if wanted, is the edge's job; tokens are per person, so a misbehaving client is one revoke away.
- Keep tokens in the client's secret store, not in a repository; treat a
cov_api_in a commit as compromised and revoke it.