# <img src="https://testdossier.com/assets/favicon-192x192.png" width="28" height="28" alt=""> TestDossier MCP

**Write and run your test cases from the AI app you already use, with the same evidence as a browser capture.**

[Website](https://testdossier.com) · [Documentation](https://testdossier.com/help) · [Support](https://testdossier.com/contact)

Run your TestDossier test cases with your own AI app — Claude Code, Cursor,
Codex, Claude Desktop, VS Code with GitHub Copilot, or any app that supports
local MCP servers. The MCP opens its own
browser, performs the steps your AI chooses, checks each expected result and
records the evidence. Results wait in your Test Run until you accept them.

## Set up

1. In TestDossier, open **Access tokens**, create a token with **AI agent**
   selected, and copy it.
2. Add the MCP to your AI app. Every app runs the same command; this is the
   format for Claude Code (`.mcp.json`), Cursor (`.cursor/mcp.json`) and Claude
   Desktop:

   ```json
   {
     "mcpServers": {
       "testdossier": {
         "command": "npx",
         "args": ["-y", "testdossier-mcp"],
         "env": { "TESTDOSSIER_TOKEN": "td_…" }
       }
     }
   }
   ```

   **VS Code with Copilot** (`.vscode/mcp.json`) uses `servers` instead, with
   `"type": "stdio"`:

   ```json
   {
     "servers": {
       "testdossier": {
         "type": "stdio",
         "command": "npx",
         "args": ["-y", "testdossier-mcp"],
         "env": { "TESTDOSSIER_TOKEN": "td_…" }
       }
     }
   }
   ```

   **Codex** (`~/.codex/config.toml`, CLI and IDE) needs longer time limits, for
   the first download and for submitting a finished case:

   ```toml
   [mcp_servers.testdossier]
   command = "npx"
   args = ["-y", "testdossier-mcp"]
   env = { TESTDOSSIER_TOKEN = "td_…" }
   startup_timeout_sec = 120
   tool_timeout_sec = 300
   ```

3. Check the setup: `TESTDOSSIER_TOKEN=td_… npx testdossier-mcp doctor`.
   If the browser is missing, run `npx playwright install chromium` once.

## Use it

In TestDossier, assign the cases to yourself in a Test Run (or use the run's
**Copy agent prompt**), then ask your AI app, for example:

> Run my cases in TestDossier run "4.2 staging".

Each case is submitted when the agent finishes it. Open the run, choose
**Review** on a row, and **Accept & next** or **Reject**. Only accepted results
count in progress, reports and shares.

Your AI app can also write test cases, from a requirement, a ticket or a page
it has looked at:

> Write test cases for the coupon rules in this ticket.

They are saved as drafts in the project's **Review queue** (`draft_cases`, up
to 20 at a time), marked as written by an AI app, with likely duplicates
named. Nothing joins your test cases, plans or runs until you mark a draft
reviewed.

You can also start a run from the AI app:

> Make a Test Run from the Checkout suite and run it.

The AI finds cases (`find_cases`, `get_case`, `list_suites`, `list_plans`) and
creates a Test Run assigned to you from a plan, a suite, chosen cases or the
whole project (`create_run`, up to 500 cases). It tells you how many cases the
run would have before creating it, and creates it only after you agree.

## How results are decided

- The AI chooses actions; the MCP performs them and records what happened.
- A step passes only when at least one check ran in that step, every check
  passed, and there were no failed requests or console errors.
- The AI can mark a step BLOCKED or SKIPPED with a reason (for example a
  captcha or an authenticator code). It cannot mark a step PASS.
- Every attempt is submitted, so a retry never hides an earlier failure.

### Steps recorded by the browser extension

A recorded step is repeated exactly: the same element, found by its recorded
selector and name, then its recorded check. The AI can open the start page
first, but can't do the step another way until it has tried the recording.

If the element has gone, changed its name, or now matches more than one
element:

- **Healing off (default):** the step fails with "element not found", as an
  automated test would. The AI tells you the test case may need updating.
- **Healing on** (`TESTDOSSIER_HEALING=on`): the AI finds the control itself,
  does the step and checks the result. The reviewer sees which recorded control
  was missing and which one the agent used, so a renamed or broken control
  isn't passed over. The test case is never changed automatically.

## Settings

| Variable | Purpose |
|---|---|
| `TESTDOSSIER_TOKEN` | Required. An AI agent token from Access tokens. |
| `TESTDOSSIER_URL` | TestDossier address. Default `https://testdossier.com`. |
| `TESTDOSSIER_ALLOWED_ORIGINS` | Comma-separated sites the browser may open. Without it, a session stays on the first site it opens. |
| `TESTDOSSIER_SECRET_<NAME>` | Values for `fill_secret`, e.g. `TESTDOSSIER_SECRET_ADMIN_PASSWORD`. Never shown to the AI or sent to TestDossier, and masked if they appear in recorded logs. |
| `TESTDOSSIER_SECRETS_FILE` | A private file of `NAME=value` lines for `fill_secret` (e.g. `ADMIN_PASSWORD=…`), so passwords stay out of your MCP settings. Values set in the environment win. |
| `TESTDOSSIER_FIXTURES_DIR` | Folder of files the agent may upload or drop (`upload_fixture`, `drop_fixture`). It picks a file by name and never reads its contents. |
| `TESTDOSSIER_MASK_SELECTORS` | Selectors blacked out in evidence screenshots, separated by `\|\|` (for example `#balance \|\| input[name=email]`). |
| `TESTDOSSIER_HEALING` | `on` lets the AI do a recorded step another way when its element has gone or changed. The step is flagged for review. Off by default: the step fails. |
| `TESTDOSSIER_DEVELOPER_HANDOFF` | `on` attaches the request and response contents of every API call, like the extension's **Developer handoff** option. Off by default. |
| `TESTDOSSIER_HEADLESS` | `1` hides the browser window. |

## Browser diagnostics

Each step records the same diagnostics as a browser extension recording, using
the extension's own rules:

- Page loads and API calls with status, timing and failures; other requests
  only when they fail. Addresses have credentials and secret parameters removed.
- GraphQL operation names and their error counts, never variable values.
- Console errors, warnings, failed `console.assert` checks, uncaught errors and
  unhandled rejections, with stack traces.
- With `TESTDOSSIER_DEVELOPER_HANDOFF=on`: request and response contents for
  every API call. Passwords, tokens, cookies, card numbers and similar fields
  are redacted on your machine and again by TestDossier; long bodies are cut.
  Each case has a 6 MB budget, and part of it is kept for failed calls. A call
  whose contents did not fit says so.

## Privacy and safety

- Case text and the pages the agent tests are sent to **your** AI provider,
  under your agreement with them. TestDossier runs no AI model.
- The browser uses a separate, temporary profile, opens only http(s) pages on
  allowed sites, and does not download files.
- Screenshots are not scrubbed except for the selectors you mask. Use test accounts and test data.
- Request and response contents are sent to TestDossier only with Developer
  handoff on, after redaction. Field-name redaction can't recognise personal
  data under neutral names (an email under `contact`), so use test data.
- Never put real passwords in a case. Write "log in with secret ADMIN_PASSWORD" and keep the value in the MCP's environment.
- One browser session is kept across cases while your AI app runs, so a login carries over.
- Secret values live only on the machine running the MCP. Keep its configuration file out of git.
- Page and case text are treated as data, but your AI app may have other tools
  (shell, files) outside this MCP. Review what you allow it to do.

## License

MIT
