AffiliateBase has a Model Context Protocol (MCP) server. Connect an AI tool that runs on your computer, such as Claude Code, Cursor, or Codex, to set up AffiliateBase from your codebase and check on your program without leaving your editor or terminal.
Use it to answer questions like:
- What setup step is incomplete?
- Which tracking instructions should I follow, and where do they go in my code?
- What test affiliate link should I open?
- Has AffiliateBase seen a first click or conversion?
- What campaigns, affiliates, referrals, commissions, or payouts exist?
Using ChatGPT? You don’t need a token. See Connect AffiliateBase to ChatGPT.
Create a connector token
Tools on your computer connect with a connector token.
- Open AffiliateBase.
- Go to Settings -> AI connectors.
- Enter a Token name and an Expires on date (they default to “Setup assistant” and 90 days from today). To manage promo codes, select Allow promo-code management.
- Click Create token.
- Copy the token now. AffiliateBase shows it only once.
A connector token works for the account you created it in. It covers:
- setup status and setup guidance
- setup integration confirmation
- read-only reporting
- read-only campaign and affiliate lists
It cannot execute payouts, void commissions, delete affiliates, create API keys, or make account-wide destructive changes.
Store the token in an environment variable rather than pasting it into a config file you might commit:
export AFFILIATEBASE_MCP_TOKEN="ab_live_your_connector_token"Connect your tool
The MCP server URL is:
https://app.affiliatebase.io/mcpYour tool sends the token in an Authorization: Bearer header.
Claude Code
claude mcp add --transport http affiliatebase https://app.affiliatebase.io/mcp \
--header "Authorization: Bearer $AFFILIATEBASE_MCP_TOKEN"Add --scope user to use AffiliateBase in every project. Claude Code saves the token value in its config, so don’t use --scope project for a repository you share.
Cursor
Add AffiliateBase to ~/.cursor/mcp.json (all projects) or .cursor/mcp.json (one project):
{
"mcpServers": {
"affiliatebase": {
"url": "https://app.affiliatebase.io/mcp",
"headers": {
"Authorization": "Bearer ${env:AFFILIATEBASE_MCP_TOKEN}"
}
}
}
}Codex
Add AffiliateBase to ~/.codex/config.toml:
[mcp_servers.affiliatebase]
url = "https://app.affiliatebase.io/mcp"
bearer_token_env_var = "AFFILIATEBASE_MCP_TOKEN"Example client config
Other MCP clients that accept a JSON server config can use:
{
"mcpServers": {
"affiliatebase": {
"url": "https://app.affiliatebase.io/mcp",
"headers": {
"Authorization": "Bearer ab_live_your_connector_token"
}
}
}
}Starter prompt
After you connect, start with this prompt:
Use AffiliateBase MCP to read my setup status, get install instructions, and help me verify that Stripe Checkout receives the generated referral ID as client_reference_id before marking setup complete. Do not use the ?via token as client_reference_id.The AI should read setup state first, then recommend the simplest next action. When your tool can see your code, it can make the install changes with you.
What the connector can do
With a default token, the AI tool can help you finish setup:
- check which setup steps are done and what comes next
- give install instructions for your checkout path (Payment Links, embedded Stripe elements, or your own Checkout Sessions)
- give you an affiliate link to test with
- check whether tracking and the Stripe handoff are working
- mark setup confirmed, once AffiliateBase has seen proof
It can also read, but not change, your program:
- campaigns, affiliates, referrals, commissions, and payouts
- a summary of your dashboard numbers
Optional promo-code management
Select Allow promo-code management when creating a connector token. Existing connector tokens keep their original permissions; create a new token with this option and update your tool to enable these actions.
With this option, the AI tool can list promo-code assignments, search your Stripe codes and discounts, assign an existing code to an affiliate, create a new code in Stripe, refresh an assignment, or stop tracking a code in AffiliateBase. Changes default to a preview. Assigning an existing code does not change Stripe. Creating a code does.
For developer details, including tool names, preview and execution examples, and safe retries, see Manage Promo Codes with MCP.
Safe write behavior
The only change a default token can make is marking setup confirmed, and the AI can do that only after AffiliateBase has seen real checkout proof: an affiliate link opened, a Stripe checkout started, and the generated referral ID returned as client_reference_id. Telling the AI it worked is not enough. It never executes payouts or changes commissions.
Recommended setup flow
Ask the AI tool to read your setup status, get the install instructions for your checkout path, and give you the test affiliate link. Then have it help you update your checkout code or Payment Link, verify the installation, and check readiness before confirming setup.
For most Stripe Payment Link setups, the AI should keep you on the default path: install the tracking script on the same published page as the Payment Link, then confirm Stripe received the generated referral ID as client_reference_id.
Manage or revoke tokens
Go to Settings -> AI connectors to see each connector, who created it, when it was last used, and when it expires. Click Revoke to stop a token immediately. Connections you approved from ChatGPT appear in the same list.
Security notes
- Use AI connector tokens, not full-access REST API keys.
- Keep tokens in environment variables, and out of files you commit or share.
- Revoke connector tokens you no longer use.
- Create short-lived tokens for testing.
- Do not paste tokens into public chats, shared documents, or issue trackers.
- Test setup writes on a disposable test account.
- The MCP endpoint is rate limited. A client that receives
429should wait for theRetry-Afterseconds before retrying.