Agnox MCP Server
@agnox/mcp-server connects Agnox to AI coding assistants over the Model Context Protocol. With it, Claude Code, GitHub Copilot (VS Code and Copilot CLI), Cursor, Claude Desktop or Windsurf can:
- read why a run failed, including the page URL, console and network errors, test ids and a DOM snapshot captured at the moment of failure
- get the root cause analysis of a failed test, classified as a product regression, a broken test, flakiness, environment or test data
- see which commit came before a pass-rate drop
- check the risk history of a file or feature before changing it
- fix a broken locator using that context
- find flaky tests and quarantine or release them, without mistaking a regression for a flake
- register the tests in your repository as Agnox test cases
The package also ships the Agnox Quality skill: a ready-made workflow and set of guardrails for Claude Code, Cursor and Codex.
The server talks only to the Public API v1. It has no runtime dependencies and needs Node.js 20 or later. The same package also ships the agnox CLI, whose report upload, gate check and audit pr commands bring the same data to CI; agnox <command> --help lists the options of each.
Before you start
- Create an API key in Settings → My Profile → API keys. The key acts with your role in your organization: a Viewer key can only read, while a Developer or Admin key can also quarantine tests and sync test cases.
- Have Node.js 20 or later on the machine that runs your coding assistant.
Quickstart
Run one command at the root of your repository:
npx -y @agnox/mcp-server@latest setup
The dashboard's Get started in 60 seconds card shows the same command with --project <your project id> already filled in.
setup does everything in one pass:
-
Logs you in. It reuses a key that already works (environment,
.envor a previous login). Otherwise it asks for the key with masked input, checks it against the API, and saves it in~/.agnox/config.json(readable by your user only). The key is never written to a repository file. -
Picks the project. It uses
--projectif you pass one; otherwise it lists the projects your key can see. -
Configures your assistants. It always writes the shared
.mcp.json(read by Claude Code, VS Code Copilot and Copilot CLI), and asks before writing anything else:Target Default Used by .mcp.jsonalways Claude Code, VS Code Copilot, Copilot CLI (in this repository) .cursor/mcp.jsonon when .cursor/existsCursor .vscode/mcp.jsonoff VS Code Copilot. Newer VS Code builds already read .mcp.json, so writing both can listagnoxtwice.~/.copilot/mcp-config.jsonoff Copilot CLI in every repository. It pins this project for all of them. Existing files are merged: only the
agnoxentry is added or replaced, and every other server and setting is kept. A file with comments or trailing commas, or one that isn't valid JSON, is left untouched andsetupprints the entry to paste in by hand. If an oldagnoxentry in a repository file still holds an API key,setupremoves it and reminds you to rotate the key. -
Tells your agents when to use Agnox (optional). It offers to add a short Agnox section to
.github/copilot-instructions.mdandCLAUDE.md, between<!-- agnox-mcp:start -->and<!-- agnox-mcp:end -->markers, so runningsetupagain updates it instead of adding a second copy. -
Verifies the connection. It runs
doctor: the key, project access, the config files, and a live MCPinitialize+tools/listhandshake.
It finishes with a summary like this:
Agnox is connected — 14 MCP tools verified.
Files: .mcp.json, CLAUDE.md (no API key inside; commit them)
Try it: ask your agent "Why did the latest Agnox run fail, and how do I fix it?"
Teammates: after git pull, run npx -y @agnox/mcp-server@latest login
Share it with your team
Commit .mcp.json (and the other repository files setup wrote). They contain the project id and API URL, never a key. After git pull, each teammate saves their own key once:
npx -y @agnox/mcp-server@latest login
Check the connection
npx -y @agnox/mcp-server@latest doctor
doctor prints PASS, WARN, FAIL or NOTE for each check, with a one-line fix under every problem, and exits with code 1 when anything fails.
Options
| Option | Description |
|---|---|
--project <id> | The project to connect. Without it, setup lists your projects (or picks the only one). |
--api-key <key> | Use and save this key instead of prompting. Prefer the prompt on a shared machine: a key on the command line lands in your shell history. |
--api-url <url> | A self-hosted Agnox API |
--clients <list> | Exactly which files to write, comma-separated: mcp-json (alias claude), cursor, vscode, copilot-cli |
--instructions <list> | Agent instructions to add: copilot, claude, or none |
--non-interactive | Never prompt. Without --clients, only .mcp.json is written; without --instructions, no instructions file is touched. |
For example, to configure Cursor and Copilot CLI too, from a script:
npx -y @agnox/mcp-server@latest setup --project <project id> --clients mcp-json,cursor,copilot-cli --instructions copilot --non-interactive
Why
@latest?npxreuses a cached copy of a package. A copy older than 1.2.0 doesn't knowsetupand would start the MCP server instead, waiting silently for input.@latestmakes npx check for the current version.
Environment variables
| Variable | Required | Default | Purpose |
|---|---|---|---|
AGNOX_API_KEY | Yes | Your API key. Sent only in the x-api-key header; never printed, logged or included in an error message. | |
AGNOX_API_URL | No | https://api.agnox.dev | The Agnox API, for a self-hosted install. Must be https://; plain http:// is accepted only for localhost, 127.0.0.1 and [::1]. No credentials, query or fragment. Redirects are never followed, so the key cannot leak to another host. |
AGNOX_PROJECT_ID | No | Default project for tools that take a projectId |
The server also reads these from a .env file in its working directory, and from credentials saved with agnox login, using the same rules as the CLI. Variables in the env block always win.
Keep keys out of git. The configs below carry no key: run
npx -y @agnox/mcp-server@latest loginonce and the server reads it from~/.agnox/config.json. If you'd rather pass it through the client, reference an environment variable (Claude Code expands${AGNOX_API_KEY}in.mcp.json) instead of pasting the key into a committed file.
Manual configuration
setup writes these files for you. Use this section to write or review them by hand. Every example assumes you've saved your key with npx -y @agnox/mcp-server@latest login.
Claude Code and the shared .mcp.json
Commit a .mcp.json at the repository root. Claude Code reads it, and so do VS Code Copilot (newer builds) and GitHub Copilot CLI when they work in this repository. It uses the top-level key mcpServers:
{
"mcpServers": {
"agnox": {
"type": "stdio",
"command": "npx",
"args": ["-y", "@agnox/mcp-server@latest"],
"env": {
"AGNOX_API_URL": "https://api.agnox.dev",
"AGNOX_PROJECT_ID": "<project id>"
}
}
}
}
Don't add a tools property here; it isn't part of this file's schema. Run /mcp inside Claude Code to confirm that agnox is connected and its 14 tools are listed.
To add the server only for yourself instead of the repository:
claude mcp add agnox -e AGNOX_PROJECT_ID=<project id> -- npx -y @agnox/mcp-server@latest
VS Code / GitHub Copilot
VS Code (1.102 or later) runs MCP servers for GitHub Copilot in agent mode. Newer builds pick up the shared .mcp.json above, so you may not need anything else. For VS Code's own workspace file, .vscode/mcp.json, note the different top-level key, servers:
{
"servers": {
"agnox": {
"type": "stdio",
"command": "npx",
"args": ["-y", "@agnox/mcp-server@latest"],
"env": {
"AGNOX_API_URL": "https://api.agnox.dev",
"AGNOX_PROJECT_ID": "<project id>"
}
}
}
}
Use one of the two files, not both, or Copilot may list agnox twice. .vscode/mcp.json may contain comments; setup won't rewrite such a file, so edit it by hand. VS Code can also prompt for the key and store it securely with an inputs entry ("AGNOX_API_KEY": "${input:agnox-api-key}"), if you'd rather not use agnox login.
You can also add the server to your user profile with MCP: Add Server from the Command Palette, or with code --add-mcp:
code --add-mcp '{"name":"agnox","type":"stdio","command":"npx","args":["-y","@agnox/mcp-server@latest"],"env":{"AGNOX_PROJECT_ID":"<project id>"}}'
Open Copilot Chat in Agent mode and select the tools icon (or run MCP: List Servers) to confirm that agnox is running and its tools are listed.
GitHub Copilot CLI
Copilot CLI reads MCP servers from two places:
| File | Scope | Commit it? |
|---|---|---|
.mcp.json in the repository | This repository only | Yes, it's the shared file above |
~/.copilot/mcp-config.json | Every repository you open | No, it's in your home directory |
Inside a repository with the shared .mcp.json, you don't need anything else. To have Agnox in every repository, add it to ~/.copilot/mcp-config.json. This file uses "type": "local" and needs a tools list (["*"] allows all Agnox tools):
{
"mcpServers": {
"agnox": {
"type": "local",
"command": "npx",
"args": ["-y", "@agnox/mcp-server@latest"],
"env": {
"AGNOX_API_URL": "https://api.agnox.dev",
"AGNOX_PROJECT_ID": "<project id>"
},
"tools": ["*"]
}
}
}
On Windows, Copilot CLI cannot start npx directly. Use "command": "cmd" with "args": ["/c", "npx", "-y", "@agnox/mcp-server@latest"] (setup does this for you). The AGNOX_PROJECT_ID here applies to every repository; leave it out and name the project in your prompt if you work across several.
Run /mcp in Copilot CLI to confirm that agnox is listed.
Cursor
Create .cursor/mcp.json in the project, or ~/.cursor/mcp.json to enable it for every project:
{
"mcpServers": {
"agnox": {
"command": "npx",
"args": ["-y", "@agnox/mcp-server@latest"],
"env": {
"AGNOX_API_URL": "https://api.agnox.dev",
"AGNOX_PROJECT_ID": "<project id>"
}
}
}
}
Then open Cursor Settings → MCP and check that agnox shows a green status.
Claude Desktop
Open Settings → Developer → Edit Config, or edit the file directly:
| OS | Config file |
|---|---|
| macOS | ~/Library/Application Support/Claude/claude_desktop_config.json |
| Windows | %APPDATA%\Claude\claude_desktop_config.json |
Add the server under mcpServers, then restart Claude Desktop:
{
"mcpServers": {
"agnox": {
"command": "npx",
"args": ["-y", "@agnox/mcp-server@latest"],
"env": {
"AGNOX_PROJECT_ID": "<project id>"
}
}
}
}
Windsurf
Use the same mcpServers block in ~/.codeium/windsurf/mcp_config.json.
Windows: if your client cannot start
npxdirectly, use"command": "cmd"with"args": ["/c", "npx", "-y", "@agnox/mcp-server@latest"]. Repository files keep plainnpxso they work for everyone on the team.
Already installed the CLI?
agnox mcpstarts the same server, so"command": "agnox", "args": ["mcp"]works too.
Tools
| Tool | Access | What it does | Arguments |
|---|---|---|---|
list_recent_executions | Read | Recent runs, newest first, with status, source, passed/failed counts, runName (the CI job or shard, e.g. e2e 2/3) and groupName (the CI workflow run its jobs share). Use it to find the taskId of a failed run; for a sharded pipeline, filter by groupName and status: FAILED to see every failed job. Local runs (from a developer machine) are left out once the project has CI or hosted runs; a project with only local runs lists them, and the result says so. | projectId?, status? (comma-separated: PENDING, RUNNING, PASSED, FAILED, ERROR, UNSTABLE), source? (agnox-hosted, external-ci, local), groupName?, limit? (1–100, default 25) |
get_execution_failures | Read | The failed tests of one run: name, spec file, error, failure signature, test key, linked test case, and the page context at failure (URL, title, console and network errors, test ids, DOM snapshot). | taskId (required) |
get_failing_test_context | Read | One failing test without the whole run: error, a short stack snippet, the last test.step() reached, spec file, report URL, the run it came from (taskId, runName, groupName), and stability context (grade, main-branch vs current-branch pass rate, and whether it looks like a branch regression or a known flake). Without a run id, the project's last 30 failed runs that hold the test are searched (optionally one groupName), so a test that failed in an earlier shard of a sharded pipeline is found, not only in the newest failed run. | One of testId?, testKey?, testTitle? (alias testName) or specFile?; executionId? (alias taskId), groupName?, projectId? |
list_failure_clusters | Read | The most frequent failure signatures across recent runs: how many runs and tests each one hit, plus a sample error. Tells one systemic problem apart from many separate bugs. Needs the Root Cause Analysis feature. | projectId?, days? (1–30, default 14) |
get_rca_analysis | Write (AI) | Root cause analysis of one failed test: the diagnosis (rootCause, suggestedFix), a classification (likely_product_regression, likely_broken_test, likely_flaky, likely_environment, likely_test_data or unknown) with its evidence, and contextUsed (repository, file and commit SHAs; never code or secrets). Cached diagnoses cost no AI tokens (cached: true); otherwise, or with forceRefresh, it calls your organization's AI model and saves the result. Needs Root Cause Analysis and your organization's AI key. | taskId (required), testId? or testTitle?, forceRefresh? |
get_stability_timeline | Read | Daily pass rate over 7, 14 or 30 days with the GitHub commits of the same window, plus drops: days whose pass rate fell 10 points or more, each with the commits around it. No AI tokens. | projectId?, days? (7, 14 or 30, default 14) |
get_area_quality_history | Read | Risk history of a spec file, folder or feature keyword: risk (high, medium, low), matching test cases, recent failures, flaky and quarantined tests, suspected regressions and their failure clusters. Call it before changing an area. No AI tokens. | pathOrPattern (required), projectId?, days? (1–30, default 30) |
get_release_readiness | Read | The Release Readiness Gate: READY, REVIEW_REQUIRED or BLOCKED from the latest CI and hosted runs, with the checks behind it (CI evidence, unquarantined failures, pass rate, quarantine and flake debt, required suites), the blocking and quarantined failures, the evaluated runs and a dashboard link. Local runs never count. No AI tokens. | projectId?, branch?, commit?, environment? (development, qa, staging, production), groupName? |
audit_pr_tests | Read (local) | The PR Test Auditor: deterministic checks of the tests in a diff before a pull request is opened. Reads the local git repository (default origin/main to the working tree, untracked files included) or a diffText, and returns findings (no-only-tests, no-new-skips, no-hard-waits, no-force-click, weakened-assertions, missing-test-updates, invalid-suppression) with file, line and snippet, plus a PASS/WARN/FAIL verdict. Works without an API key; with one, notes changed test files whose tests are quarantined, unstable or suspected regressions. No AI tokens. | baseRef?, headRef?, staged?, diffText?, cwd?, projectId?, failOn? (error, warn, never), ignoreMissingTests?, skipsAsErrors? |
get_flaky_and_quarantined_tests | Read | Tests that need attention, each with a kind: suspected_regression (a likely product bug, never a flake), quarantined or unstable (grade D or F). Includes the Safe Auto-Quarantine metadata: quarantineReasonCode, protectedTagsMatched, and consecutivePassesSinceQuarantine toward autoReleasePassThreshold. | projectId? (required if AGNOX_PROJECT_ID is not set) |
toggle_test_quarantine | Write | Quarantine a test (its failures stop failing the run) or release it. Address it by testCaseId, or by testKey from get_execution_failures. By key, the test case is created if it doesn't exist yet. | quarantined (required), testCaseId? (id or AG-TC-12), testKey?, projectId?, title? (needed when creating), file? |
list_automation_candidates | Read | Manual test cases worth automating next, best first, with score, priority, reasons and manual run and failure counts. Cases marked not automatable, or in an excluded suite, are left out. No AI tokens. | projectId?, folder?, minPriority?, limit? (1–20, default 10), offset?, includeExcluded? |
get_automation_brief | Read | What is needed to automate the chosen test cases: steps, preconditions, history, repository and how to name the tests. Call it after list_automation_candidates. No AI tokens. | caseKeys or testCaseIds (at most 20), projectId? |
sync_test_cases | Write | Register automated tests found in the code as Agnox test cases, so they can be tracked and quarantined before their first run. A title that starts with a manual test case key (AG-TC-12: …) turns that case into the automated one. Idempotent. | tests (required, at most 500): [{ file, titlePath }], projectId? |
Write tools need a Developer or Admin key. With a Viewer key they return a readable permission error. get_rca_analysis is marked as not read-only because it may spend your organization's AI tokens and saves the diagnosis on the run; it never deletes anything.
Results
Every tool returns a one-line summary followed by compact JSON:
3 failed tests in run run-k3j2
{"untrusted_data":{"taskId":"run-k3j2","projectId":"665f…","items":[{"name":"checkout › pays with card","file":"tests/checkout.spec.ts","testKey":"4c1f…","error":"TimeoutError: locator.click: Timeout 5000ms exceeded…","context":{"failureUrl":"https://shop.test/pay","testIds":["pay-button"],"domSnapshot":"<button data-testid=\"pay-button\">Pay</button>"}}]}}
- Lists are capped at 20 items (an
omittedcount tells the assistant how many were left out). DOM snapshots are cut at 4,000 characters, error text at 2,000, and URLs and console lines at 500. - Everything under
untrusted_datacomes from test runs and the pages under test. The tool descriptions tell the assistant to treat it as data, never as instructions, which guards against prompt injection from a page under test. - A failing call (bad argument, missing permission, API error) returns a readable error to the assistant instead of breaking the session.
Examples
Fix a broken locator
"Why did the last failed Agnox run fail? Fix the broken locator."
list_recent_executionswith{ "status": "FAILED", "limit": 1 }finds the run.get_execution_failureswith{ "taskId": "run-k3j2" }returns the error, the spec file, and thetestIdsanddomSnapshotcaptured at failure.- The assistant opens
tests/checkout.spec.tsand replaces the stale selector with one that exists in the snapshot, for examplegetByTestId('pay-button').
Find the root cause of a failure
"Why does
checkout › pays with cardfail on the last run? Is it the product or the test?"
get_failing_test_contextreturns the error and the stability context.get_rca_analysiswith{ "taskId": "run-k3j2", "testTitle": "pays with card" }returns the diagnosis and, for example,"classification": "likely_product_regression"with the evidenceregressionSuspected: the newest runs are a consistent failure streak….get_stability_timelinewith{ "days": 7 }shows the drop on the day the test started failing, with the commits that landed around it.
The assistant reports a likely product regression with those commits instead of editing the test.
Check an area before changing it
"I'm about to refactor the checkout page. Anything I should know?"
get_area_quality_history with { "pathOrPattern": "checkout" } returns the area's risk, its suspected regressions, flaky and quarantined tests, and recent failures, so the assistant can run the right tests and avoid touching a test that is already flagged.
Check a release before merging
"Is this branch ready to release? What's blocking it?"
The assistant calls get_release_readiness with the branch, reads the failing checks and blockingFailures, then investigates each failure with get_failing_test_context and get_rca_analysis. It never quarantines or skips a test to turn the verdict green.
Audit test changes before opening a pull request
"Audit my test changes before I open the pull request."
The assistant calls audit_pr_tests, fixes each finding (a fixed sleep becomes a wait for a condition, a removed assertion comes back, a .only goes), and calls it again until it passes. It never adds an agnox-audit-ignore comment, a skip or optional: true just to turn the verdict green. See PR Test Auditor.
Triage a red nightly
"Is last night's failure one problem or many?"
list_failure_clusters with { "days": 1 } groups failures by signature. When one cluster hits most of the failing tests, it's usually a shared cause, such as an expired login or a down service, rather than many separate bugs.
Quarantine a flaky test
"Which tests are flaky in Agnox? Quarantine the checkout one."
get_flaky_and_quarantined_testslists the unstable tests with their keys.toggle_test_quarantinewith:
{
"quarantined": true,
"testKey": "4c1f…",
"title": "checkout › pays with card",
"file": "tests/checkout.spec.ts"
}
Release it later with the same arguments and "quarantined": false.
Register the tests in your repository
"Register every test in
tests/with Agnox."
The assistant reads your spec files and calls sync_test_cases:
{
"tests": [
{ "file": "tests/checkout.spec.ts", "titlePath": ["checkout", "pays with card"] },
{ "file": "tests/login.spec.ts", "titlePath": ["login", "rejects a wrong password"] }
]
}
The result counts created, promoted, alreadyLinked and skipped. Calling it again is safe.
Automate your manual test cases
"Which manual tests should we automate next? Automate the top two."
The assistant calls list_automation_candidates, then get_automation_brief with the keys it chose, and writes the tests in your repository. Each title starts with its test case key, so Agnox turns the manual case into the automated one instead of adding a duplicate. See Automation Planner.
Agnox Quality skill
The package ships an Agent Skill that teaches your coding agent a repeatable quality workflow with these tools:
- Investigate failures:
list_recent_executions→get_execution_failures→get_failing_test_context→get_rca_analysis→get_stability_timeline. - Check the risk before changing code:
get_area_quality_historyfor the file, folder or feature you are about to touch. - Before a pull request:
audit_pr_testson the change, and fix its findings; before merging or releasing,get_release_readiness. - Guardrails:
- Never mask a failure with
test.skip(),test.fixme(), weaker assertions orwaitForTimeout. - Never fix, skip, quarantine or weaken a suspected regression. Report it as a likely product regression, with the evidence.
- Propose a test or locator fix only when the evidence shows UI or test drift, and get a person's approval before changing a business assertion.
- Never mask a failure with
Install it in your repository:
npx -y @agnox/mcp-server@latest skill install # Claude Code: .claude/skills/agnox-quality/SKILL.md
npx -y @agnox/mcp-server@latest skill install --target cursor # Cursor: .cursor/rules/agnox-quality.mdc
npx -y @agnox/mcp-server@latest skill install --target codex # Codex and other agents: a block in AGENTS.md
npx -y @agnox/mcp-server@latest skill install --target all # all three
- Commit the files so every agent on the team follows the same workflow.
- Run the command again after upgrading to get the latest version. It replaces the skill in place, and in
AGENTS.mdit only touches the block between<!-- agnox-skill:start -->and<!-- agnox-skill:end -->. --dir <path>installs into another directory, such as one package of a monorepo.skill print --target <claude|cursor|codex>prints the skill instead of writing it.skill install --helplists every option.
The skill ships in the npm package as skills/agnox-quality/SKILL.md.
Protocol details
- Transport: JSON-RPC 2.0 over stdio, one message per line. Diagnostics go to stderr.
- MCP protocol versions:
2025-11-25,2025-06-18,2025-03-26and2024-11-05. - Tools carry
readOnlyHint/destructiveHint/idempotentHintannotations, so clients can ask before running a write tool.
Troubleshooting
| Symptom | Fix |
|---|---|
| Anything not working | Run npx -y @agnox/mcp-server@latest doctor. It checks the key, project, config files and a live handshake, and prints a fix for each problem. |
AGNOX_API_KEY is not set | Run npx -y @agnox/mcp-server@latest login, or export the key in the shell that starts the client. |
setup prints nothing and waits | npx ran an old cached copy, which starts the MCP server instead. Use @agnox/mcp-server@latest. |
401 errors | The key is wrong or revoked. Create a new one in Settings → My Profile → API keys. |
403 FORBIDDEN on quarantine or sync | The key belongs to a Viewer. Use a Developer or Admin key. |
403 FEATURE_DISABLED on list_failure_clusters | Enable Root Cause Analysis for the organization. |
projectId is required | Pass a projectId, or set AGNOX_PROJECT_ID in the server's env. |
… answered with a web page (HTML) … | AGNOX_API_URL points at the dashboard (for example https://agnox.dev), not the API. Use https://api.agnox.dev, or remove the variable to use the default. |
429 errors | You hit the API rate limit. Wait a minute and retry. |
| Server doesn't start | Check node --version is 20 or later. Run npx -y @agnox/mcp-server@latest doctor to see what fails. |