MCP server

Connect Claude, ChatGPT, Claude Code or Cursor to your Affilyflow account – setup, sign-in, the 28 tools, prompts and limits.

View as Markdown

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

MCP addressTekst
https://app.affilyflow.com/api/mcp

The 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

  1. Open Customize → Connectors in Claude and choose Add custom connector.
  2. Name the connector Affilyflow and paste the MCP address.
  3. Choose Connect. Sign in to your Affilyflow account and approve the connection.
  4. 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

  1. Open ChatGPT on the web. Find Developer mode under Settings → Apps → Advanced Settings, if it is available for your account.
  2. Create a custom app named Affilyflow. Paste the MCP address and choose OAuth as authentication.
  3. Sign in to Affilyflow and approve the connection. On a work account, your administrator may need to grant access first.
  4. Select Affilyflow in the conversation. Ask ChatGPT to show the programs you have joined.

Connect Claude Code

Run the command in your terminal:

TerminalShell
claude mcp add --transport http affilyflow https://app.affilyflow.com/api/mcp

Then 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:

mcp.jsonJSON
{
  "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 canThe assistant cannot
Read programs, rules, products, your links, sites, clicks, sales, balance and payoutsJoin a program before you have said yes to its terms
Join programs once you have seen the terms and said yesLeave programs
Create, rename and archive linksDelete links or sites
Add and edit your sitesSee or change bank, CPR, tax or address details or your profile
Create product boxes and put products in themDelete product boxes
Analyze your sites with AI and suggest productsRequest 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:

  1. The assistant calls join_program without accept_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.
  2. 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

ToolDoes
search_programsSearches 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_programsThe 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_programOne 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_complianceChecks 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_programJoins 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.
ToolDoes
search_productsSearches 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_productsReads 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_linkCreates 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_batchUp to 50 links in one call with a result per link. Write.
list_linksYour links, newest first, optionally with numbers per link.
get_linkOne link with numbers, the pages it performs on, the program status and today's rules.
update_linkRenames a link or changes its landing page or site label. Write.
archive_linkHides a link from the list – it keeps working. Write.
restore_linkShows an archived link again. Write.

Sites

ToolDoes
get_sitesSites measured from clicks with earnings, page-tracking coverage and suggestions for sites to add (suggest_add).
get_pagesThe pages on your sites with clicks, sales, commission and trend.
list_websitesYour registered sites.
add_siteAdds a site. The numbers from clicks that already came from it are included. Write.
update_siteFixes domain, name, niche or traffic – e.g. a domain missing its .dk. Write.

Results

ToolDoes
get_statsClicks, 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_salesIndividual 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_clicksIndividual 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

ToolDoes
list_product_listsYour 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_listCreates an empty list with a name, short text and layout (box, table or grid). Write.
add_to_product_listSaves 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

ToolDoes
get_accountYour account, your social profiles, quota for new links and shortcuts to the dashboard.
get_balanceBalance, next payout day and what is missing. Read-only.
list_payoutsYour 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.

PromptDoesArguments
monthly_reportA 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_nicheFinds the best open programs for your niche and explains their rules.niche, channel
optimize_linksReviews links, pages and page tracking and suggests improvements.–
build_product_linksFinds 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

LimitValue
Requests per minute120 per API key or connection
Write requests per minute60 per API key or connection
New links500 per 24 hours per account. A reused identical link does not count.
Links per batch50
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:

CodeMeaning
not_joinedYou 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_limit20 new joins in the last 24 hours. Try again later, or join in the dashboard.
channel_requiredThe 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_allowedThe channel is not allowed in the program.
landing_page_other_hostThe landing page is not on the store's domain.
landing_page_cart_linkThe landing page is an "open cart" link (/actions/cart/…), which loses the click on the way. Use the product's own page.
immutable_fieldSub-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_limit500 new links in the last 24 hours.
invalid_domain, duplicate_domainThe domain is invalid or already on one of your sites.
invalid_categoryThe category is not in the product catalog tree (search_products). Use an id or slug from a product's category, e.g. pandelamper.
invalid_marketmarket is not a two-letter country code, e.g. DK or SE (search_programs and search_products).
rate_limitedToo 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-26 and 2024-11-05 (with initialize) as well as the stateless 2026-07-28 (with server/discover, version and client capabilities in params._meta, and the headers MCP-Protocol-Version, Mcp-Method and Mcp-Name).
  • Access: Authorization: Bearer afk_… (API key) or an OAuth access token. Without valid access the server returns 401 with WWW-Authenticate: Bearer resource_metadata="…", which starts the sign-in in the client.

OAuth endpoints (Affilyflow is its own authorization server):

PathPurpose
/.well-known/oauth-protected-resource/api/mcpProtected resource metadata (RFC 9728).
/.well-known/oauth-authorization-serverAuthorization server metadata (RFC 8414).
/oauth/authorizeSign-in and approval.
/oauth/tokenCode exchange and refresh (authorization_code, refresh_token).
/oauth/registerDynamic client registration.
/oauth/revokeRevoke 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.

Call a tool with an API keyShell
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.

Contact support