> ## Documentation Index
> Fetch the complete documentation index at: https://docs.testdriver.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Add TestDriver to Claude Code

> Install one plugin to get the TestDriver MCP server, agent, and skills in Claude Code.

Install the TestDriver plugin, and Claude Code can write, run, and debug end-to-end tests in a live sandbox.

The plugin bundles three things:

* The TestDriver MCP server
* The `testdriver` agent, which builds tests step by step
* Skills that teach Claude the TestDriver SDK

## Before you begin

* **[Claude Code](https://code.claude.com)** and **Node.js 20.19 or later**, which runs the MCP server.
* **A TestDriver API key.** Create one at [console.testdriver.ai/team/api-keys](https://console.testdriver.ai/team/api-keys).
* **A project with the TestDriver SDK installed**, so the agent can run the tests it writes. If you don't have one yet, see [Set up a project](/quickstart-manual).

**1. Set your API key**

The plugin's MCP server reads your key from the `TD_API_KEY` environment variable. Add it to your shell profile (such as `~/.zshrc`) so every Claude Code session can use it:

```bash theme={null}
export TD_API_KEY="your_api_key"
```

Open a new terminal, or run `source ~/.zshrc`, before you start Claude Code.

**2. Install the plugin**

TestDriver is a community plugin. In Claude Code, run `/plugin`, open the **Discover** tab, search for **TestDriver**, and install it.

You can also install it from TestDriver's own marketplace:

```text theme={null}
/plugin marketplace add testdriverai/testdriverai
/plugin install testdriver@testdriver
```

**3. Check the connection**

Run `/mcp` in Claude Code. The `testdriver` server should be listed as connected.

If it isn't, check that `TD_API_KEY` is set in the terminal you started Claude Code from.

**4. Write your first test**

Ask for the TestDriver agent by name:

```text theme={null}
Use the testdriver agent to write a test that logs in to https://testdriver-sandbox.vercel.app/login and adds an item to the cart.
```

The agent starts a sandbox and performs each step. It writes the code into a test file under `tests/`, then runs it with Vitest until it passes.

> [!TIP]
>
> Only need TestDriver's tools in chat, without the agent or skills? Add the hosted server instead. It signs in through your browser and needs no API key. See [MCP Setup](/mcp-setup).

## Next steps

> **[Generate tests with AI](/generating-tests)**
>
> Prompt the agent and steer it while it works.

> **[Make assertions](/making-assertions)**
>
> Check what's on screen in plain language.

> **[Run tests](/copilot/running-tests)**
>
> Run your tests locally and choose a device.

> **[Run in CI/CD](/ci-cd)**
>
> Run your tests on every pull request.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.