Connect your AI agent to Twinpage with MCP
If you build your site with an AI coding agent, it can work with Twinpage too. Connect it once with an API key, and you can ask it in plain words to check that Twinpage is installed, tell you how a test is doing or how much of your plan you've used. It talks to Twinpage through MCP (Model Context Protocol), the standard way coding agents connect to other tools.
What your agent can do
- See your plan, its limits and how many tested sessions you've used this month.
- List your projects and whether the Twinpage code has been seen on each site recently.
- Get the install code for a project, with step-by-step instructions it can follow in your site's code.
- List the tests in a project, with their status and visits.
- Read a test's setup and its current results, including extra metrics, in Twinpage's own words ("likely better", "leading", "no clear difference yet"), with a link to the test in Twinpage.
What stays with you
Your agent can only read your Twinpage data. It can't create, change, start, pause or delete a test, or change a project or your account. You set up and start tests in Twinpage, where you pick elements on your page and preview each change.
Step 1: Create an API key
In Twinpage, open the menu with your email address at the bottom of the sidebar (on a phone, tap the menu button at the top first) and choose AI agents, then Create API key. Give the key a name you'll recognise, such as "Claude Code on my laptop".
Copy the key when it appears. It is shown only once; if you lose it, revoke it and create a new one. An account can have up to 10 keys at a time.
Step 2: Add Twinpage to your agent
Claude Code. Run this in your terminal, in the folder of the project you work on:
claude mcp add --transport http twinpage https://twinpage.app/api/v1/mcp --header "Authorization: Bearer YOUR_API_KEY"
Replace YOUR_API_KEY with the key you copied. Claude Code keeps the key in your own settings, not in the project's files. Type /mcp in Claude Code to check that twinpage is connected. To change the key later, run claude mcp remove twinpage, then run the command again with the new key.
Cursor. Add this to ~/.cursor/mcp.json in your home folder. If the file already lists servers, add the twinpage entry inside mcpServers:
{
"mcpServers": {
"twinpage": {
"url": "https://twinpage.app/api/v1/mcp",
"headers": {
"Authorization": "Bearer YOUR_API_KEY"
}
}
}
}Replace YOUR_API_KEY with the key you copied. Keep the key out of .cursor/mcp.json inside a project, so it never ends up in your code repository. To change the key later, replace it in the same file.
VS Code. Add this to .vscode/mcp.json in your project, or run MCP: Open User Configuration to add it for every project:
{
"inputs": [
{
"type": "promptString",
"id": "twinpage-api-key",
"description": "Twinpage API key",
"password": true
}
],
"servers": {
"twinpage": {
"type": "http",
"url": "https://twinpage.app/api/v1/mcp",
"headers": {
"Authorization": "Bearer ${input:twinpage-api-key}"
}
}
}
}VS Code asks for your key the first time the server starts and keeps it for you, so the file holds no key.
Other tools. Any tool that connects to remote MCP servers over HTTP with a custom header can use Twinpage. Use the server address https://twinpage.app/api/v1/mcp and send the header Authorization: Bearer YOUR_API_KEY. Tools that can only connect by signing in, such as claude.ai connectors and ChatGPT, can't connect to it.
Step 3: Ask your agent
Ask in plain words; your agent picks the right Twinpage tool. For example:
- "List my Twinpage projects and tell me whether the code is installed on each."
- "Install Twinpage on this site."
- "How is my homepage test doing?"
- "What plan am I on, and how many tested sessions have I used this month?"
To create or change a test, open Twinpage; your agent can give you the link to any test.
Keep your key safe
Treat your key like a password: anyone who has it can read your projects, tests, results, plan and usage. Keep it out of your code repository and out of files you share. You are responsible for what is done with it, including by the agent you connect.
If a key may have been exposed, revoke it on the AI agents page at once. A revoked key stops working immediately; create a new one and update your agent's settings.
Your agent, and the AI provider behind it, read your Twinpage data for you and at your request, under their own terms, not ours. Twinpage sends them nothing itself; what they do with what they read is between you and them.
If something goes wrong
- Claude Code shows twinpage as failed in /mcp: the key is wrong or has been revoked. Run
claude mcp remove twinpage, then add it again with a working key. - "Invalid API key": the key was mistyped, or it has been revoked. Check it, or create a new key on the AI agents page.
- "Missing API key": your tool didn't send the key. Check that the Authorization header is set as shown above.
- "Rate limit exceeded": each key can make up to 60 requests a minute. Wait a minute and try again.
- Your agent doesn't list the Twinpage tools: restart it after adding the server, then check its list of connected tools (/mcp in Claude Code). Claude Code loads twinpage only in the folder where you added it; in another folder, run the add command there too.
Testing with Twinpage
Twinpage is A/B testing for marketing sites: one script tag, a visual editor, one main goal per test and a verdict you can trust, with prices you can read before you start.