@asserthive/[email protected] is published under npm's beta tag. Use the documented exact version for this beta; the latest tag may point to an older beta.
Use WebTest AI with Cursor and Claude Code
Cursor Agent and Claude Code can invoke WebTest AI through its local MCP server or CLI. The coding agent decides when to call tools; WebTest AI owns browser execution, fixed success checks, evidence, limits, and the final test verdict. An agent's explanation does not replace the recorded result.
Install the published beta
Run these commands from your project root with Node 18 or newer:
npm install --save-dev --save-exact @asserthive/[email protected]
npx playwright install chromium
npx webtest-ai --version
The version command must print 0.2.0-beta.1. --save-exact persists this version as an exact dependency pin; the npm latest tag may point to an older beta. Playwright Chromium is used by the explicit MCP browser debug tools. The default CDP test runtime needs Chrome or Chromium and can use the Chromium downloaded by the command above; see commands and configuration for browser setup.
Separate the agent, navigator, and selector
| Role or path | What it uses | Access required |
|---|---|---|
| Coding agent / orchestrator | Cursor Agent or Claude Code decides when to invoke WebTest AI | That product's login or plan, according to its terms |
| WebTest AI navigator | Ollama or a configured OpenAI-compatible endpoint plans Goal actions | A configured local endpoint or the endpoint's API credential |
| Optional ambiguous-element selector | Jev, OpenAI Decisions, or a configured selector profile chooses an observed element | Its credential, when required by the configured provider, only when configured and exact local resolution is insufficient |
| Credential-free paths | Recorder capture, exact-step tests, scripted demo, report inspection | No Jev or OpenAI Decisions account required; local capture, exact steps, and fixtures need no model API credential |
Cursor's selected model is not exposed as a navigator API for WebTest AI. Eligible Claude subscriptions can power Claude Code, but Anthropic Console/API access used by other software is separately configured and billed under current terms. Anthropic currently documents monthly API credits for some Max, Ultra, and Team plans; those credits still do not turn a Claude Code login or model selection into an API endpoint or credential for WebTest AI. Check the current Claude subscription and API billing terms.
For Goal tests, configure the navigator using model configuration. An optional selector resolves ambiguous targets; it does not replace the navigator or decide whether a test passes.
Connect Cursor
Add this server to .cursor/mcp.json in the project root, merging it with any existing mcpServers entries:
{
"mcpServers": {
"webtest-ai": {
"type": "stdio",
"command": "npx",
"args": [
"--yes",
"@asserthive/[email protected]",
"mcp"
]
}
}
}
Project configuration applies to this workspace. Personal configuration at ~/.cursor/mcp.json makes the tools available across projects. Open Cursor at the project root, then reload the window or restart Cursor after changing configuration. Check Cursor's MCP settings for server status and enabled tools; inspect its MCP logs if the server cannot connect or tools are missing. See the official Cursor MCP documentation.
Connect Claude Code
From the project root, register the local stdio server:
claude mcp add --scope project --transport stdio webtest-ai -- \
npx --yes @asserthive/[email protected] mcp
claude mcp list
The equivalent project .mcp.json is:
{
"mcpServers": {
"webtest-ai": {
"type": "stdio",
"command": "npx",
"args": [
"--yes",
"@asserthive/[email protected]",
"mcp"
]
}
}
}
Merge this entry into an existing file rather than replacing other servers. Review the project configuration before trusting it. Interactive Claude Code sessions request approval for project MCP servers; non-interactive behavior differs, so do not rely on an approval prompt to make an untrusted project safe. Use claude mcp list to check connection health and /mcp inside Claude Code to inspect server status and tools. Restart the session after configuration changes if needed. These commands and approval rules are documented in the official Claude Code MCP guide.
Practical prompts
Replace the sample suite, config, and application URL with files and a running app in your project. These prompts name the actual MCP tools so the agent can distinguish test execution from exploration.
Review the contract first:
Parse
specs/checkout.mdwithwebtest-ai.spec.parse. Explain each test's fixed success checks and any required test data before running anything.
Run and diagnose:
Run
specs/checkout.mdwithwebtest-ai.run.suite, usingwebtest-ai.config.jsonasconfigPath. Read the returned report path withwebtest-ai.report.summaryand summarize failures from the report. Keep the original success checks unchanged.
Inspect evidence:
Open the latest report using
webtest-ai.report.listandwebtest-ai.report.summary. Usewebtest-ai.report.testwith that report and a test ID to inspect tool-call evidence. FollownextOffsetuntil the relevant calls are covered, and cite the recorded assertions and artifacts.
Explore explicitly:
Start an explicit browser debug session at
http://127.0.0.1:3000withwebtest-ai.browser.start_session. Takewebtest-ai.browser.snapshotusing the returnedsessionId, and show me the observed controls before clicking anything. Stop the session withwebtest-ai.browser.stop_sessionwhen we finish.
Debug sessions are exploratory browser control. They do not create a suite pass verdict. Run the saved contract through webtest-ai.run.suite or the CLI to obtain a test result. Tool inputs and report resources are described in the MCP reference.
CLI fallback
Any coding agent with terminal access can use the same vendor-neutral commands:
npx webtest-ai run --suite specs/checkout.md --config webtest-ai.config.json
REPORT_PATH=artifacts/reports/Everyday_Goods-example.json
npx webtest-ai report export --report "$REPORT_PATH"
REPORT_PATH must point to a real generated report: replace the example with a JSON report path printed by the run. Exporting a report does not rerun the tests or publish it to another service.
Security and troubleshooting
- Keep keys in environment variables or an ignored
.env, never in MCP JSON. Ensure the server process receives the required environment. Keep secret values out of specs and prompts too. - Trust only project MCP configuration you have reviewed, and review browser-capable tool calls. Starting a server executes its configured local command.
- Recorder artifacts, screenshots, labels, reports, and URLs may contain sensitive data. Review them before sharing or committing, even when redaction is enabled.
- If package resolution fails, check Node 18+, npm registry access, and the exact
0.2.0-beta.1pin. Confirmnpx webtest-ai --versionfrom the project root. - For a disconnected MCP server, inspect Cursor's MCP settings and logs, or Claude Code's
claude mcp list,/mcp, and diagnostic logs. Check thatnpxis on the client's PATH, then restart after correcting configuration. - Start the client from the project root so relative suite, config, and report paths resolve correctly. Pass
configPathwhen running a suite; server-wide configuration can also be supplied by appending--config,webtest-ai.config.jsonaftermcpin the server arguments. - A missing navigator for a Goal test is not fixed by a Cursor or Claude subscription. Configure a navigator, or use exact-step tests, the scripted fixture demo, or the documented external-session flow. External-session mode lets an external agent provide actions explicitly; it does not expose the client's model as an API.
- Missing Jev or OpenAI Decisions credentials never cause an undocumented fallback. A configured selector failure is reported explicitly; fix that configuration or deliberately choose another supported setup. Exact local resolution can avoid selector calls when the target is unique.