Claude Code with CoverOps
Connect Claude Code to CoverOps and ask about your coverage in plain words: which files the last run missed, which test failed and why, what a change affects, what never runs in production. Claude Code reaches CoverOps through its MCP server, with an API token you create in the dashboard. This page takes you from nothing to a first answer in about five minutes.
What you need
- Claude Code, installed and signed in. The commands and output on this page are from Claude Code 2.1.330.
- A CoverOps account with at least one project. Answers are only as good as the data: a project with at least one run (an agent or a CI upload) gives Claude something to read.
- Your CoverOps address. On the hosted service it is
https://coverops.ai. On your own installation it is the address you open the dashboard at. - HTTPS access from your machine to that address. Nothing else needs to be opened.
The MCP server is at <address>/v1/mcp, for example https://coverops.ai/v1/mcp.
Step 1: Create an API token
- Sign in to the dashboard.
- In the sidebar, open Workspace → Team and scroll to API tokens.
- Label: a name you will recognise later, for example
claude-code. - Scope: choose read (see the table below).
- Click Mint token.

The token (cov_api_…) is shown once. Copy it now. The panel also shows the ready-made claude mcp add command with your address and token filled in.

Click I have copied it. From then on the list shows only the token's prefix, its scope, when it was created and when it was last used.
Which scope
| Scope | What Claude can do with it | Choose it when |
|---|---|---|
read | Ask every question: runs, files, tests, flaky tests, dead code, impact, quality gate, the code map. | You want answers. This is the right choice for almost everyone. |
write | Everything read can, plus start and stop coverage monitoring. Over MCP it can also post a message to the project's notification channels (notify) and rebuild the code map (rebuild_code_graph). | You want Claude to open and close a monitoring window for you. |
Neither scope can manage members, tokens, connections, passwords, SSO or settings, or delete anything. Those always need you, signed in to the dashboard.
A token acts as you: it sees your projects and nothing else, and every call is in the audit log under your name. If your seat on a project is viewer, a write token still only reads there. A viewer account's token is always read.
Step 2: Add CoverOps to Claude Code
Run this in the folder of the project you work on. Put your own address and token in:
claude mcp add --transport http coverops https://coverops.ai/v1/mcp \
--header "Authorization: Bearer cov_api_…"
--transport http: CoverOps speaks Streamable HTTP. Do not usesse.coverops: the name Claude Code shows for the server. Any name works.--header "Authorization: Bearer …": the token. The wordBearerand the space after it are required.
Claude Code answers like this. The output on this page is real, from a trial against a local CoverOps; only the address and the folder were replaced with the ones you would see:
Added HTTP MCP server coverops with URL: https://coverops.ai/v1/mcp to local config
Headers: {
"Authorization": "[REDACTED]"
}
File modified: ~/.claude.json [project: ~/work/shop]
Where the setting is kept
By default the server is added for you, in this folder only (--scope local, kept in ~/.claude.json). Two other choices:
| Option | Who gets it | Kept in |
|---|---|---|
--scope local (default) | you, in this folder | ~/.claude.json |
--scope user | you, in every folder | ~/.claude.json |
--scope project | everyone who clones the repository | .mcp.json in the repository |
Never commit a token. To share the setting with your team through .mcp.json, let each person keep their own token in an environment variable. Claude Code expands ${VAR} in .mcp.json:
{
"mcpServers": {
"coverops": {
"type": "http",
"url": "https://coverops.ai/v1/mcp",
"headers": { "Authorization": "Bearer ${COVEROPS_TOKEN}" }
}
}
}
Each person then sets COVEROPS_TOKEN in their shell. Claude Code asks once before it uses a server from a project's .mcp.json.
Step 3: Check the connection
claude mcp list
Checking MCP server health…
coverops: https://coverops.ai/v1/mcp (HTTP) - ✔ Connected
For details, including the scope and the header (the token is not repeated here):
claude mcp get coverops
coverops:
Scope: Local config (private to you in this project)
Status: ✔ Connected
Type: http
URL: https://coverops.ai/v1/mcp
Headers:
Authorization: Bearer cov_api_…
To remove this server, run: claude mcp remove coverops -s local
Inside a Claude Code session, /mcp shows the same status and lists the server's tools. CoverOps offers 28 tools; the full list is in API and MCP.
If you see ✘ Failed to connect instead, go to Common errors.
Step 4: Ask your first questions
Start claude in the same folder and ask in plain words. Claude picks the CoverOps tool itself and asks you before it calls it the first time.
| Ask | Claude uses |
|---|---|
| Which CoverOps projects can I see? | list_projects |
| In the newest run, which files are least covered, and which tests failed? | project_overview, then run_detail |
| Why did the tests in the last run fail? | why_failed |
Show the line coverage of OrderService.java in the last run. | file_coverage |
| Which tests are flaky this month? | flaky_tests |
| What has never executed in production in the last 90 days? | dead_code |
| Which tests should run for yesterday's commits? | impact_plan |
Does the quality gate pass for branch feature/checkout? | quality_gate |
Claude works on your active project (the one selected in the dashboard). To ask about another, name it: "in project Shop demo, …".
What Claude receives is JSON. For the second question, for example, run_detail returns the run (branch, commit, how many tests passed and failed), each file with its line hits, worst covered first, and each test with its result and message. Claude turns that into a short answer; you can always ask it to show the numbers.
Starting and stopping monitoring (write scope)
With a write token you can ask "start coverage monitoring for the checkout services" and later "stop monitoring". Claude calls start_coverage_monitoring and stop_coverage_monitoring. Both are in the audit log as mcp.start_coverage_monitoring and mcp.stop_coverage_monitoring, under your name.
Common errors
✘ Failed to connect … HTTP 401
claude mcp list with a wrong token (real output, wrapped to fit):
coverops: https://coverops.ai/v1/mcp (HTTP) - ✘ Failed to connect — Server rejected the configured
Authorization header (HTTP 401). Check that the token is valid for this MCP endpoint — OAuth fallback
is disabled when headers.Authorization is set. Error detail: {"error":{"code":"UNAUTHORIZED",
"message":"Invalid or revoked API token. Create an API token in the CoverOps dashboard
(Team → API tokens) and send it as `Authorization: Bearer <token>`."}}
CoverOps answers 401 when:
| The message says | Why | What to do |
|---|---|---|
Invalid or revoked API token | The token is mistyped, was cut short when copied, or was revoked. Copying the prefix from the list (cov_api_58c6290…) does not work: that is not the token. | Create a new token and add the server again (see below). |
This MCP endpoint needs an API token | No Authorization header reached CoverOps, or Bearer is missing. | Check claude mcp get coverops: the header must read Authorization: Bearer cov_api_…. |
This account is disabled | Your CoverOps account was switched off or declined. | Ask your CoverOps administrator. |
To replace the token, remove the server and add it again with the new one:
claude mcp remove coverops -s local
claude mcp add --transport http coverops https://coverops.ai/v1/mcp --header "Authorization: Bearer cov_api_…"
403 and "read-only"
The connection works, but CoverOps refuses one action:
| You see | Why | What to do |
|---|---|---|
This API token is read-only; mint one with write scope under Team → API tokens. | A read token was asked to start or stop monitoring, post a notification or rebuild the code map. | Create a write token if you need that, and replace the header. |
You have read-only access to <project>. | Your seat on that project is viewer. The token cannot do more than you. | Ask a project admin for a member seat. |
An API token may only start and stop coverage monitoring; this change needs a signed-in session | A REST call with a write token tried another change. | Do it in the dashboard. |
Other messages
No project "…" is visible to this token: the name is not one of your projects. Ask "which projects can I see?" and use a name from that list.405onGET: the client tried to open a server stream. CoverOps is stateless: use--transport http, notsse.- An OAuth sign-in window, or "no dynamic client registration": the server was added without the header. CoverOps MCP has no OAuth sign-in; add it with
--headeras in Step 2. - Answers cut short: Claude Code limits the size of one tool answer. Ask a narrower question (one file, one service, fewer days) or raise the limit with
MAX_MCP_OUTPUT_TOKENS.
Revoke a token
When a laptop is lost, someone leaves, or a token was pasted somewhere it should not be:
- Open Workspace → Team → API tokens.
- Find the token by its label and prefix, and click Revoke.

The next request with that token gets 401. Revoking is in the audit log (api.token.revoke). Then remove the server from Claude Code:
claude mcp remove coverops -s local
Use -s user or -s project if you added it with that scope.
Good to know
- Treat a token like a password. A
cov_api_value in a commit or a chat is compromised: revoke it. - One token per tool and machine makes revoking easy; the Last used column shows which ones are still in use.
- Every call made with a token is in the access log as
token:<id>with your e-mail beside it. - The MCP server, the REST API and the security details are described in API and MCP.