Using Rainforest with the Model Context Protocol (MCP)
Rainforest's MCP server lets you generate and run tests directly from AI-powered coding tools like Claude Code, Cursor, or Windsurf — right alongside the code you're building. Instead of switching to the Rainforest app to write tests after the fact, you can create and validate tests in the same environment where you already have full context on your application.
Why use the MCP?
Your AI assistant already understands your app
When you use Rainforest through an AI coding tool, the AI has direct context on your codebase — it knows your routes, components, and user flows. That means when it generates a Rainforest test, it can produce higher-quality, more accurate tests because it understands what your app actually does.
Compare this to writing tests in isolation, where you'd need to manually describe every flow from scratch. The MCP closes that gap by letting the AI connect its knowledge of your code to Rainforest's test generation engine.
Testing fits into your workflow, not the other way around
With the MCP, test creation happens where you already work — your editor. You can generate a test while you're building a feature, run it to verify things work, and move on. There's no context-switching to a separate tool or browser tab. Tests become a natural part of your development loop rather than a separate chore.
Setup
Prerequisites
- A Rainforest QA account with an API token
- An MCP-compatible AI tool (Claude Code, Claude Desktop, Cursor, Windsurf, etc.)
Get your API token
- Log into Rainforest
- Go to Settings → Integrations
- Copy your API token
Installation
Add the Rainforest MCP server to your tool's MCP configuration. The specifics depend on which tool you're using:
Claude Code
claude mcp add rainforest -- npx -y @anthropic-ai/mcp-remote https://app.rainforestqa.com/api/mcp --header "Authorization:Bearer YOUR_API_TOKEN"Claude Desktop
- Open Claude Desktop and go to Settings → Connectors
- Click Add custom connector
- Enter the following URL:
https://app.rainforestqa.com/api/mcp - You'll be redirected to your browser to authenticate — enter your Rainforest API token when prompted
Other MCP clients
Most MCP clients support adding servers through a JSON configuration file. Add the following to your client's MCP config:
{
"mcpServers": {
"rainforest": {
"command": "npx",
"args": [
"-y",
"@anthropic-ai/mcp-remote",
"https://app.rainforestqa.com/api/mcp",
"--header",
"Authorization:Bearer YOUR_API_TOKEN"
]
}
}
}Replace YOUR_API_TOKEN with the token you copied from Settings → Integrations. Check your client's documentation for the specific config file location.
Verify the connection
Once connected, you can confirm things are working by asking your AI assistant something like:
"List my Rainforest sites"
or
"Show me my Rainforest environments"
If it returns your account's sites and environments, you're good to go.
What you can do
Once connected, you can ask your AI assistant to:
- Generate tests — Describe what you want to test in natural language and Rainforest's AI will create the test for you. For example: "Create a test that logs in, adds an item to the cart, and completes checkout."
- Run tests — Kick off test runs for individual tests or groups of tests and check results, all from your editor.
- Manage environments and sites — View and switch between your configured environments and sites.
- Work with branches — List and filter branches to organize tests alongside your code branches.
Tips for getting the best results
- Provide credentials when needed. If your test requires logging in, pass credentials to the test generation step so the AI can include authentication in the flow.
- Generate tests while building features. This is when the AI has the most context on what you're building and can write the most accurate tests.
- Review generated tests before publishing. AI-generated tests are a great starting point — run them in draft mode first to make sure they behave as expected.
Updated about 6 hours ago
