MCP server
Connect Claude, ChatGPT, Claude Code or Cursor to your Affilyflow account – setup, sign-in, the 28 tools, prompts and limits.
The MCP server lets your AI assistant work directly with your Affilyflow account: find programs, read the store's rules, search products, create tracking links and fetch your clicks, sales, pages and balance – inside the conversation. The tools use the same functions as the dashboard and the REST API, so the numbers match.
The MCP server is for affiliates only. An overview with examples is on AI agents and API.
The address
https://app.affilyflow.com/api/mcpThe address is for an MCP client that sends POST requests. Opening it in a browser returns 405 Method Not Allowed – that is expected. Add the address as a connector in your assistant.
Before you start: you need an affiliate account. The assistant can join programs for you – but only after you have seen the program's terms and said yes (see Joining).
Connect Claude
- Open Customize → Connectors in Claude and choose Add custom connector.
- Name the connector Affilyflow and paste the MCP address.
- Choose Connect. Sign in to your Affilyflow account and approve the connection.
- Enable Affilyflow under Connectors in the conversation. Ask the assistant to show your joined programs.
On a team account, an owner may need to add the connector to the organization first. See Anthropic's guide: Get started with custom connectors.
Connect ChatGPT
- Open ChatGPT on the web. Find Developer mode under Settings → Apps → Advanced Settings, if it is available for your account.
- Create a custom app named Affilyflow. Paste the MCP address and choose OAuth as authentication.
- Sign in to Affilyflow and approve the connection. On a work account, your administrator may need to grant access first.
- Select Affilyflow in the conversation. Ask ChatGPT to show the programs you have joined.
Connect Claude Code
Run the command in your terminal:
claude mcp add --transport http affilyflow https://app.affilyflow.com/api/mcpThen open Claude Code, type /mcp, choose Affilyflow and complete the sign-in in your browser. No API key is needed. Because Claude Code runs on your own computer, the approval page shows a warning – only allow it if you just started the connection yourself.
Connect Cursor and other MCP clients
Clients that cannot sign in with OAuth use an API key. Create one under AI og API → For udviklere (AI and API → For developers) in the dashboard (see REST API) and add it to the client's configuration:
{
"mcpServers": {
"affilyflow": {
"url": "https://app.affilyflow.com/api/mcp",
"headers": { "Authorization": "Bearer afk_YOUR_KEY" }
}
}
}Sign-in and access
Claude, ChatGPT and Claude Code connect with a sign-in instead of a key (OAuth 2.1 with PKCE). The assistant sends you to Affilyflow's own sign-in and approval page. It shows the app's name and the address you will be sent back to, so you can check that it is the right app. The assistant gets access to the MCP server – it never gets your password.
| The assistant can | The assistant cannot |
|---|---|
| Read programs, rules, products, your links, sites, clicks, sales, balance and payouts | Join a program before you have said yes to its terms |
| Join programs once you have seen the terms and said yes | Leave programs |
| Create, rename and archive links | Delete links or sites |
| Add and edit your sites | See or change bank, CPR, tax or address details or your profile |
| Create product boxes and put products in them | Delete product boxes |
| Analyze your sites with AI and suggest products | Request a payout |
- An access token lasts one hour and is renewed automatically. The renewal lasts 60 days and rotates on every use.
- Access from a sign-in works only on the MCP server – not on the REST API.
- Under AI og API in the dashboard you see your connected apps and can disconnect them. API keys are revoked in the same place. A disconnected app stops working from its next request.
The data you fetch through the assistant becomes part of the AI service you use. Choose the account and workspace you want to use for your affiliate results.
Joining
Programs are open – there is no application. With join_program the assistant can join you in the same conversation where it found the program. It takes two steps:
- The assistant calls
join_programwithoutaccept_rules. Nothing changes – the response is the program's terms: commission, cookie, approval period, allowed channels, paid search, coupon and cashback sites, the store's guidelines verbatim and any upcoming tightening with its date. - Once you have read the terms and said yes, the assistant calls again with
accept_rules: true. You are joined – exactly as with the button in the dashboard – and the store is notified.
Joining creates your first link. Give the channel (channel); otherwise the channel of your most recent link is used if the program allows it, and without either the link has no channel yet and you choose it afterwards. landing_page and sub_id give the link a specific page and sub-ID. If you have already joined, nothing changes (already_joined: true).
The same rules as in the dashboard apply: only programs open to new affiliates, and not a store whose team you are on yourself.
The tools
The server has 28 tools. Read tools change nothing. Write tools join you to programs and only create, edit or archive your own links, sites and product boxes – no tool deletes anything. Tool descriptions are in English; data and error messages are in Danish.
Programs and rules
| Tool | Does |
|---|---|
search_programs | Searches all open programs – including ones you have not joined – with the countries the store sells to, commission, cookie window, approval period, channels, rules, network EPC and join link. Can be filtered by market (market, e.g. SE). With sort: "recommended" they come in the same personal order as "Recommended for you" in the dashboard, each with its reason (recommendation.reasons). |
list_programs | The programs you have joined, with the saved rules and the store guidelines. sort: "recommended" puts the ones that fit your sites, niche and channel best first. |
get_program | One program in depth: description, guidelines verbatim, today's rules and upcoming tightenings with date, discount codes, creatives with ready banner HTML, top products, network stats and your own numbers. |
check_compliance | Checks a planned promotion against the program's measurable rules: channel, coupon and cashback sites, paid search, landing page and advertising label. Returns ok, warning or not allowed per rule. |
join_program | Joins you to a program – the same join as in the dashboard, and the store is notified. Without accept_rules nothing changes: the response is the program's terms. With accept_rules: true it joins you and creates the first link. Write tool. |
Products and links
| Tool | Does |
|---|---|
search_products | Searches the stores' products with price, stock, estimated commission, the stores' own picks and – for joined programs – a ready link to the product. Can be filtered by market (market), category in the product tree (category) and brand (brand), and grouped gives one row per product across stores. |
recommend_products | Reads one of your sites (or an address) with AI and finds products in the network that fit – per topic and for the pages you get clicks from. The analysis is saved for 30 days; refresh analyzes again (at most once per 24 hours per site). |
create_link | Creates or reuses a link with channel, landing page, sub-IDs (sub_id … sub_id5), campaign, UTM, name, HTML snippet and QR code. Without a channel, the channel of your most recent link is used. Write. |
create_links_batch | Up to 50 links in one call with a result per link. Write. |
list_links | Your links, newest first, optionally with numbers per link. |
get_link | One link with numbers, the pages it performs on, the program status and today's rules. |
update_link | Renames a link or changes its landing page or site label. Write. |
archive_link | Hides a link from the list – it keeps working. Write. |
restore_link | Shows an archived link again. Write. |
Sites
| Tool | Does |
|---|---|
get_sites | Sites measured from clicks with earnings, page-tracking coverage and suggestions for sites to add (suggest_add). |
get_pages | The pages on your sites with clicks, sales, commission and trend. |
list_websites | Your registered sites. |
add_site | Adds a site. The numbers from clicks that already came from it are included. Write. |
update_site | Fixes domain, name, niche or traffic – e.g. a domain missing its .dk. Write. |
Results
| Tool | Does |
|---|---|
get_stats | Clicks, sales and commission for a period – in total or by sub-ID (1–5), program, link, day, site, page, source, device or country, optionally compared with the previous period. |
list_sales | Individual sales with status, rejection reason, approval date, refunds and the click with its sub-IDs. With updated_since, only sales created or changed since then – for syncing. |
list_clicks | Individual clicks with page, source, sub-IDs, device, country and the sales the click led to. One visit is one click: the click shows the most recently used link in the visit. |
Product boxes
| Tool | Does |
|---|---|
list_product_lists | Your product boxes (called lists in the API; your saved products are not included) with item count, layout and the script for your site. With list_id, that list's products in order with tracking links and whether they can be shown right now, plus ready HTML that works without a script. |
create_product_list | Creates an empty list with a name, short text and layout (box, table or grid). Write. |
add_to_product_list | Saves a product from search_products at the end of a list, optionally with a short note. Requires that you have joined the program. Write. |
Account and payouts
| Tool | Does |
|---|---|
get_account | Your account, your social profiles, quota for new links and shortcuts to the dashboard. |
get_balance | Balance, next payout day and what is missing. Read-only. |
list_payouts | Your payouts with self-billing invoices. Read-only. |
Parameters and responses are the same as in the REST API. Every tool returns structured content plus the same JSON as text. create_link and get_link with include_qr return the QR code as an image.
Prompts
In Claude and Claude Code (and other clients that support prompts) there are four ready-made workflows. Their text is in Danish, as it becomes your message in the conversation.
| Prompt | Does | Arguments |
|---|---|---|
monthly_report | A monthly report with key numbers, best programs and pages, rejected sales and the next payout. | month (YYYY-MM, default: last month) |
find_programs_for_my_niche | Finds the best open programs for your niche and explains their rules. | niche, channel |
optimize_links | Reviews links, pages and page tracking and suggests improvements. | – |
build_product_links | Finds products and creates links for them in one call. | query (required), store, sub_id, count (default 10, max 50) |
ChatGPT does not use prompts – the tools work without them.
What the assistant is told
The server gives the assistant short instructions: how Affilyflow works, a typical workflow, that the store's rules and guidelines must be followed, that a discount code shared with all affiliates gives no commission on its own while a personal code earns commission without a click, that advertising must be labelled under Danish marketing law, that amounts are in DKK excluding VAT, and that dates are in Danish time. How the assistant uses this is up to the model – check important numbers in the dashboard.
Try it
- "Which products in the network fit mysite.com? Show them per topic, and make links to the five I earn most on for my most-clicked page."
- "Find the 10 sofas I earn most on at Nordlys Bolig and create links for them with sub-ID article-sofas-oct. Check the program rules first and give me the HTML for my site."
- "I want to make a TikTok video and run Google Ads on generic keywords for one of my programs. Am I allowed to? Show the store's guidelines and tell me if the rules are about to change."
- "Make a report for last month compared with the month before: best programs, pages and sources, rejected sales with reason, and when my next payout is."
- "Add the sites that send me clicks."
- "Find a program that fits mysite.dk, show me its rules and join it if I say yes – then make a link to the front page with channel Website."
Limits
| Limit | Value |
|---|---|
| Requests per minute | 120 per API key or connection |
| Write requests per minute | 60 per API key or connection |
| New links | 500 per 24 hours per account. A reused identical link does not count. |
| Links per batch | 50 |
New program joins (join_program) | 20 per 24 hours per account. A program you have already joined does not count. |
AI analyses of sites (recommend_products) | 10 per 24 hours per account – every new analysis counts, failed ones too; the same site at most once per 24 hours |
Errors
A tool that fails returns an error with a code the assistant can act on, for example:
| Code | Meaning |
|---|---|
not_joined | You have not joined the program. The assistant can join you with join_program once you have said yes to the terms – or join in the dashboard. |
join_limit | 20 new joins in the last 24 hours. Try again later, or join in the dashboard. |
channel_required | The link has no channel and there is no earlier one to fall back on. The assistant asks where the link will be used. |
channel_not_allowed | The channel is not allowed in the program. |
landing_page_other_host | The landing page is not on the store's domain. |
landing_page_cart_link | The landing page is an "open cart" link (/actions/cart/…), which loses the click on the way. Use the product's own page. |
immutable_field | Sub-ID and campaign cannot be changed on an existing link, and the channel only if the link has none. Create a new one, or use ?sid=. |
daily_link_limit | 500 new links in the last 24 hours. |
invalid_domain, duplicate_domain | The domain is invalid or already on one of your sites. |
invalid_category | The category is not in the product catalog tree (search_products). Use an id or slug from a product's category, e.g. pandelamper. |
invalid_market | market is not a two-letter country code, e.g. DK or SE (search_programs and search_products). |
rate_limited | Too many requests. Wait a moment. |
The full list is under REST API → Error codes.
A 401 means the access has expired or been disconnected: connect the assistant again, or check that the API key has not been revoked.
For client builders
- Transport: Streamable HTTP without sessions. Every POST stands alone, and there is no SSE stream on GET.
- Protocol: the server speaks
2025-11-25,2025-06-18,2025-03-26and2024-11-05(withinitialize) as well as the stateless2026-07-28(withserver/discover, version and client capabilities inparams._meta, and the headersMCP-Protocol-Version,Mcp-MethodandMcp-Name). - Access:
Authorization: Bearer afk_…(API key) or an OAuth access token. Without valid access the server returns 401 withWWW-Authenticate: Bearer resource_metadata="…", which starts the sign-in in the client.
OAuth endpoints (Affilyflow is its own authorization server):
| Path | Purpose |
|---|---|
/.well-known/oauth-protected-resource/api/mcp | Protected resource metadata (RFC 9728). |
/.well-known/oauth-authorization-server | Authorization server metadata (RFC 8414). |
/oauth/authorize | Sign-in and approval. |
/oauth/token | Code exchange and refresh (authorization_code, refresh_token). |
/oauth/register | Dynamic client registration. |
/oauth/revoke | Revoke a token. |
PKCE with S256 is required, the scope is affiliate (plus offline_access for refresh), and the token is bound to the resource https://app.affilyflow.com/api/mcp. Clients can identify themselves with a Client ID Metadata Document (a URL as client_id) or with dynamic registration. Redirect URIs must be https or loopback.
curl -X POST https://app.affilyflow.com/api/mcp \
-H "Authorization: Bearer $AFFILYFLOW_API_KEY" \
-H "Content-Type: application/json" \
-H "Accept: application/json, text/event-stream" \
-d '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"get_stats","arguments":{"group_by":"program","compare":true}}}'Missing something?
Write to us – we answer quickly, and the page gets fixed.