# Tester Ninja: agent quickstart

You are setting up Tester Ninja for the user. Tester Ninja tests a web app in a real browser and reports only bugs that happen twice. You will use it through its MCP server at `https://testerninja.com/api/mcp`.

Follow the steps in order. Stop and wait whenever a step needs the user to act in a browser. Never ask the user to paste a password into the chat.

## 1. Get an API key

Ask the user to open https://testerninja.com/app/connect, press **Create key**, and give you the key (it starts with `tn_`). If they have no workspace yet, opening that page makes one.

## 2. Add the MCP server

Use the command for the client you are running in. The server name is `testerninja`.

**Claude Code**

```bash
claude mcp add --transport http testerninja https://testerninja.com/api/mcp --header "Authorization: Bearer THE_KEY"
```

**Cursor**: merge this into `~/.cursor/mcp.json`, keeping any other servers.

```json
{ "mcpServers": { "testerninja": { "url": "https://testerninja.com/api/mcp", "headers": { "Authorization": "Bearer THE_KEY" } } } }
```

**Codex**: add this to `~/.codex/config.toml`.

```toml
[mcp_servers.testerninja]
url = "https://testerninja.com/api/mcp"
http_headers = { "Authorization" = "Bearer THE_KEY" }
```

If the tools do not appear, ask the user to restart or reload the client, then carry on from step 3.

## 3. Find or create the project

Call `list_projects`.

- **One or more projects:** pick the one whose address matches the app in this repository. Ask if it is unclear.
- **None:** call `create_project` with the address of the app to test. Look for it in the repository (deploy config, README, `.env.example`, staging or preview addresses). Tests run in the cloud, so `localhost` does not work. If you cannot find a reachable address, ask the user.

Use the project's `id` as `project` in every later call.

## 4. Tell Tester Ninja about the app

Call `list_knowledge` first and skip what is already there. Then read the codebase and call `save_knowledge` for facts a tester needs:

- **App structure:** the main pages and routes, the core user flows, the roles and what each can do.
- **Gotchas:** email verification on sign-up, captchas, rate limits, third-party steps.
- **Feature flags** that change what the screen shows, and their defaults.
- **Rules** for the tester (`kind: "rule"`), such as "Dismiss the cookie banner first".

If the repository has a test account meant for testing (in seed, fixture or example files), call `save_test_login` with it. Never save values from `.env`, `.env.local` or `.env.production`, live API keys or anyone's real password. If you are not sure a value is safe, leave it out and tell the user.

## 5. Add tests and run them

Call `list_test_cases`.

- **There are tests:** call `run_tests`.
- **There are none:** call `create_test_cases` with 3 to 6 cases for the app's main flows, written from what you read in the code, then `run_tests`. Each case is one user flow carried through to its result. Never write cases that pay, delete data or test security.

Poll `get_run` about every 10 seconds until `status` is `done` or `failed`. A run usually takes 1 to 5 minutes.

To test a preview or staging deployment instead of the live site, pass its address to `run_tests` as `url`, or save it once with `save_environment` and pass its name as `environment` (`list_environments` shows what is saved). Each test keeps its path.

## 6. Report, then fix

Tell the user which tests passed, failed or were blocked. For each confirmed bug call `get_finding`: it returns the shortest steps to reproduce, the console and network lines, and a fix prompt. For a test that failed or was blocked and you need to see where, `get_test_trace` returns each step it took with the reason, the console lines and the requests. Offer to fix the bugs in the code. After a fix is deployed, call `run_tests` again to confirm.

If tests were blocked by a sign-in or bot protection, `list_todos` says what a person has to sort out.

If a flow sends an email (a sign-up code, a reset link) and the project has a test inbox saved under Configs, the tester reads the email itself during the run. `read_inbox` shows what arrived.

## 7. Tell the user what they can ask for now

- Run the tests, or only the ones for what they are changing.
- Read why a test failed and fix the bug.
- Add a test for a new feature or a bug they just fixed.
- Schedule a plan (`schedule_plan`) so it runs every night.
- See how the tests of each pull request ended (`list_pull_requests`), once a repository is connected under Pull requests in the dashboard.

The dashboard is at https://testerninja.com/app. Everything you did is visible there.
