Set up with your AI agent
Connect Claude, ChatGPT, Claude Code, Cursor, VS Code or Codex, ask it to set up your affiliate program, and it works through setup with you.
Your AI agent can set up your whole affiliate program. Connect it to AffiliateRail, then say "set up my affiliate program". It walks through the same steps as Getting started in the app, and it writes the tracking tag into your code for you.
Connecting takes about a minute. There's no API key to make or paste.
1. Connect your agent
The server address is https://mcp.affiliaterail.com/mcp. Add it to your agent, and AffiliateRail opens in your browser. Sign in the way you always do and press Allow. That's the whole flow.
Cursor or VS Code. One click each, from Settings, Connections in the app, or here:
Claude Code. Run this in your project, then type /mcp to sign in:
claude mcp add --transport http affiliaterail https://mcp.affiliaterail.com/mcpCodex. Two commands. The second one opens the sign-in page:
codex mcp add affiliaterail --url https://mcp.affiliaterail.com/mcp
codex mcp login affiliaterailClaude or ChatGPT. Add a custom connector with the address above. Connect your assistant or editor has the clicks for both.
2. Say "set up my affiliate program"
Open your agent in the repository for your product and ask. It calls setup_guide, a tool that returns the setup steps, which ones are done, and the tool to use for the next one. It calls it again after each step until nothing is left.
Along the way it:
- reads your commission rule and changes it once you say what to pay
- gives you a link to connect Stripe, which you open yourself because Stripe asks you to approve it (Paddle is connected in the dashboard)
- fetches your tag with
get_install_instructions, adds it to your site, and proves it's live withcheck_install - invites you to your own partner portal, then your first real partner
- sets your logo and colours
Every change shows you a confirmation card first. Nothing happens until you agree, and no tool can move money. The one step it can't do is the test sale: that needs a real browser, so it tells you how. The tool reference lists every tool.
Or copy a prompt instead
If you'd rather paste a brief, go to Settings, Connections and press Copy prompt for your AI assistant. It's written for the agent to read. Paste it into Claude Code, Cursor, Copilot or anything else that can read your repository.
The prompt starts by asking the agent to connect as above. If it can't, the rest of the prompt still gets the tag installed.
What it already knows
The prompt is generated for the program you're looking at, so there's nothing to fill in:
- your program id and the exact script tag, character for character, including a tracker domain of your own if you have set one up
- which payment processor is connected, so the assistant is told about Stripe's
client_reference_id, or Paddle'scustomData, or that no processor is connected - any extra referral parameters your imported links use, so links published before you moved keep converting
What it tells your assistant to do
In order, and it won't skip ahead:
- Connect the MCP server if it can. Then it follows
setup_guideas above. - Look at your code first. Find the framework, where global scripts belong, whether you set a Content Security Policy, and how checkout works.
- Ask you about anything it can't find. The prompt tells it to ask rather than guess.
- Show you a plan and wait. Which files it will change, where the tag will load, whether the payment side needs any code at all. It often doesn't.
- Then write the code.
- Test it, and hand the proof to you. It asks you for a real partner handle to test with, such as your own from Getting started. A made-up one never attributes a sale. The last step is you opening Reports, the Attribution tab, and pressing Check my install. Our own check is worth more than an assistant saying it worked.
The parts that stop it inventing things
Three things in the prompt exist because of how coding assistants fail.
There is no signup event, and the prompt says so in capitals. Every other affiliate platform needs a call in your registration handler to tie a new account to a partner. We bind on the payment instead. That is less work. It is also unfamiliar. An assistant that has read the other platforms' documentation will go looking for ours, and when it can't find one it will either invent an endpoint or tell you the integration is half finished. Both are wrong. The prompt heads off both.
Every real API path is listed, with an instruction never to invent one. If what your assistant needs is not on the list, the prompt sends it to the OpenAPI document and tells it to stop rather than improvise.
Four things that look like bugs are named as normal. The script refusing to run inside an iframe. The click count sitting below your own analytics. An ad blocker dropping the script. Safari's seven-day cookie cap. Each one has sent a careful person hunting for a fault that was never there.
If your agent can't connect
Most agents can. For one that can only send a header, make a key under Settings, API keys and add it as Authorization: Bearer rail_live_…. Treat that key like a password: it can do everything you let it. Give it to your agent yourself, and never let it be written into a tracked file.
Most sites need the tag and nothing else, so an agent working from the prompt shouldn't need a key at all.