# How to run A/B tests on your website with Claude

> To run A/B tests with Claude, connect an A/B testing tool that has an MCP server. With Duelpilot you add it as a custom connector in claude.ai or Claude Desktop (sign in, no token) or with one command in Claude Code; Claude installs the script, sets up three routines, and designs and watches tests while a person approves launches. On a Next.js site built with Cursor or Claude Code, [GrowthBook](https://duelpilot.com/compare/duelpilot-vs-growthbook), [PostHog](https://duelpilot.com/compare/duelpilot-vs-posthog) and others also have MCP servers.

Last reviewed: 2026-10-29 · HTML version: https://duelpilot.com/guides/ab-testing-with-claude

## What you need

- A website you (or Claude) can add one script tag to, in the code or through your CMS.
- Claude in any form that speaks MCP (claude.ai, Claude Desktop, Claude Code), or Cursor.
- An A/B testing tool with an MCP server. This guide uses Duelpilot; the last section lists others.

## 1. Connect Claude

### claude.ai and Claude Desktop: a custom connector

Add a custom connector with the URL https://duelpilot.com/api/mcp and sign in when Claude asks (OAuth). In Duelpilot you pick the organisation, the sites and the permissions; there is no token to paste. Claude's help centre describes the clicks (Customize → Connectors → Add custom connector) and notes that a connector added in your Claude account also works in Claude Desktop ([Claude Help Center](https://support.claude.com/en/articles/11175166)).

### Claude Code: one command

Create an agent token in Duelpilot (Settings → Agents) and run the command below; the tools appear in a new session.

```bash
claude mcp add --transport http duelpilot https://duelpilot.com/api/mcp --header "Authorization: Bearer $DUELPILOT_TOKEN"
```

One catch: Claude Code's cloud scheduled tasks only see the connectors on your claude.ai account, not servers you added locally with claude mcp add ([Claude Code docs](https://code.claude.com/docs/en/routines)). If you want the routines below to run in the cloud, also add Duelpilot as a claude.ai connector, or declare it in a committed .mcp.json.

### Cursor and other MCP clients

Add a remote MCP server with the URL https://duelpilot.com/api/mcp and the header Authorization: Bearer <token>. No account yet? Your agent can open a workspace itself and hand you a claim link ([instructions for agents](https://duelpilot.com/agents.md)).

## 2. Let Claude install and verify the script

Ask Claude to install Duelpilot. It fetches the snippet and the installation guide for your platform, adds the script, and verifies it: a check of your HTML (in the head, synchronous, not rewritten by an optimiser or held back by a cookie banner) plus a real desktop and phone browser. In a CMS you log in yourself and Claude asks before every save or publish.

### On Next.js with Claude Code or Cursor

A coding agent edits your repository directly. The Next.js guide it receives says to put a plain synchronous script in the head of the root layout (App Router) or pages/\_document (Pages Router), not next/script, which runs too late to prevent flicker. Duelpilot recognises Next.js and switches on a hydration-safe mode, so React's hydration doesn't undo or clash with the variant. The script's public URL can go in a NEXT\_PUBLIC\_ environment variable, with the staging script for preview deployments (Pro and up); the agent token never goes in your site. See the [Next.js guide](https://duelpilot.com/guides/nextjs-ab-testing).

On the Code plan, Claude Code or Cursor can also build tests that change behaviour (a booking flow, pricing logic, search ranking) in your own repository behind a Duelpilot flag, and open the pull requests with preview deployments. Duelpilot never gets access to your code and only stores the links; a person approves the test and merges.

## 3. Set up the routines

Duelpilot's three agents are routines in your own Claude: one-line scheduled prompts; Duelpilot returns the current instructions on every run. Right after the install, Claude creates them with its own scheduler, or gives you the exact clicks.

The three routines your agent schedules.

| Routine | When it runs | What it does |
|---|---|---|
| Analyst | Weekly (and once right after setup) | Reads GA4 through Duelpilot and your pages, then proposes 3–5 ideas, each with evidence. |
| Designer | Hourly, plus an API trigger where the platform has one | Designs 2–4 variants that really differ for each idea in Design, with previews and site checks on phone, tablet and desktop. |
| Monitor | Daily | Checks live tests, pauses only for harm or breakage, and sends one short summary. |

Where they can run: Claude Code's cloud scheduled tasks (formerly routines; /schedule, on Pro, Max, Team and Enterprise, with an API trigger for the Designer; [docs](https://code.claude.com/docs/en/routines)), Claude Desktop's local tasks, only while the app is open and the computer awake ([docs](https://code.claude.com/docs/en/desktop-scheduled-tasks)), scheduled tasks in Claude on paid plans ([help](https://support.claude.com/en/articles/13854387-schedule-recurring-tasks-in-claude-cowork)), or Cursor automations with an MCP server ([docs](https://cursor.com/docs/cloud-agent/automations)). Duelpilot shows whether each agent actually runs and emails the owners when one is late.

## 4. What Claude can and can't do

- Can: install and verify the script, read GA4 and page structure, propose ideas and goals, design variants with previews, run site checks, read results, post updates, and pause a live test to prevent harm.
- Can, with your explicit yes in the chat: launch a test, ship a winner, resume a paused test. Claude first shows the exact summary; Duelpilot checks that your yes is bound to that summary and records who said it and in which client.
- Can't: launch, ship or resume on its own say-so, switch on autopilot, change the policy, connect Google, change the consent mode, start billing or manage tokens. There is deliberately no MCP tool for any of that.
- Never reinterprets statistics: the server's sequential statistics decide, and Claude reports the verdict as it is.

If you'd rather not approve every test, an owner can switch on autopilot per site (Pro and up): the server then launches the agent's top-ranked variant only when every guardrail you set passes, such as a maximum number of tests, a maximum traffic share and pages it must never touch. Shipping a winner stays your call.

## Without Duelpilot

Other testing tools document MCP servers Claude can use, with different scopes. Flag-based tools suit a Next.js team that wants tests in code: [GrowthBook](https://duelpilot.com/compare/duelpilot-vs-growthbook) has a hosted MCP server or a local package ([docs](https://docs.growthbook.io/integrations/mcp)), and [PostHog Experiments](https://duelpilot.com/compare/duelpilot-vs-posthog) has an official MCP server whose tools can also launch and ship experiments, with approval left to your client ([docs](https://posthog.com/docs/model-context-protocol/tools)). For visual website tests, [Kameleoon](https://duelpilot.com/compare/duelpilot-vs-kameleoon) lists Claude, Claude Code and Cursor among supported assistants ([docs](https://docs.kameleoon.com/mcp/connect-ai-assistants)), and [Tailor](https://duelpilot.com/compare/duelpilot-vs-tailor) offers an MCP server for Claude and Claude Code on Pro and above ([Tailor](https://www.tailorhq.ai/integrations/mcp)). The full list, with what each lets an agent do, is on [A/B testing MCP servers](https://duelpilot.com/mcp-ab-testing).

## Try Duelpilot with your own agent

Give your agent one line: [set up Duelpilot for my site using /agents.md](https://duelpilot.com/agents.md). It opens a workspace, installs and verifies the script, and drafts the first test; you approve it, then switch on autopilot if you like. Or [see pricing](https://duelpilot.com/#pricing).

**[Start for €0](https://duelpilot.com/login) · [Give it to your agent](https://duelpilot.com/#start)** (€0 until you launch your first test)

## FAQ

### Can Claude run A/B tests on my website by itself?

Claude does most of the work. With Duelpilot it launches a test only after your explicit yes to the exact summary it showed, or an owner's autopilot launches within the guardrails they set.

### Do I need Claude Code, or is claude.ai enough?

claude.ai or Claude Desktop is enough. Claude Code or Cursor helps when your site is a repository, such as a Next.js app: the agent adds the script to your code itself.

### Does running the routines cost extra?

Duelpilot charges no AI credits: the routines run in your own Claude subscription. Duelpilot itself is €0 until you launch your first test, then a flat price per site.

### Why didn't my scheduled task see Duelpilot?

Cloud scheduled tasks use your claude.ai connectors, not servers added with claude mcp add. Add Duelpilot as a claude.ai connector, or in a committed .mcp.json.

## Sources

- [Get started with custom connectors using remote MCP | Claude Help Center](https://support.claude.com/en/articles/11175166) (checked 2026-10-29)
- [Automate work with scheduled tasks | Claude Code Docs](https://code.claude.com/docs/en/routines) (checked 2026-10-29)
- [Schedule recurring tasks in Claude Code Desktop | Claude Code Docs](https://code.claude.com/docs/en/desktop-scheduled-tasks) (checked 2026-10-29)
- [Schedule recurring tasks in Claude Cowork | Claude Help Center](https://support.claude.com/en/articles/13854387-schedule-recurring-tasks-in-claude-cowork) (checked 2026-10-29)
- [Automations | Cursor Docs](https://cursor.com/docs/cloud-agent/automations) (checked 2026-10-29)
- [MCP Server | GrowthBook Docs](https://docs.growthbook.io/integrations/mcp) (checked 2026-10-17)
- [PostHog MCP tools reference](https://posthog.com/docs/model-context-protocol/tools) (checked 2026-10-17)
- [Connect AI assistants | Kameleoon](https://docs.kameleoon.com/mcp/connect-ai-assistants) (checked 2026-10-17)
- [Tailor MCP: Connect Your AI Agents to Website Experiments](https://www.tailorhq.ai/integrations/mcp) (checked 2026-10-17)

## Related

- [A/B testing MCP servers](https://duelpilot.com/mcp-ab-testing)
- [A/B testing on Next.js](https://duelpilot.com/guides/nextjs-ab-testing)
- [Run A/B tests with ChatGPT](https://duelpilot.com/guides/ab-testing-with-chatgpt)
- [Agentic A/B testing explained](https://duelpilot.com/agentic-ab-testing)
