Affitor

com.affitorPublished by affitor.comOfficial publisherv0.2.4Updated Oct 30, 2026

Affiliate programs in AI tools: read partners, commissions and payouts; track clicks and sales.

VerifiedStreamable HTTPWeb executableDeveloper ToolsBusiness & Commerce

Overview

AI-generated overview

Affitor MCP server that lets an AI assistant report affiliate clicks, leads, sales and refunds and check integration readiness for an Affitor program.

What you can do
  • Report clicks and leads, binding customers to the affiliate click that brought them
  • Check integration readiness and get the first failing gate with a next action
  • Fetch a step-by-step payment-tracking integration plan for a given framework and provider
  • Run a synthetic click-lead-sale verification through the real attribution pipeline
  • With write mode enabled, record sales and refunds that create or reverse commissions
When to use it
Useful when you run an Affitor affiliate program and want an agent to wire up or verify payment tracking, or to report conversions from server-side code without hand-writing API calls.
Requirements
A remote endpoint or the npm package run locally via npx; an Affitor program API key in AFFITOR_API_KEY (the server exits if it is missing); optional AFFITOR_API_URL override; optional AFFITOR_MCP_WRITE=1 to enable the sale and refund tools; network access to the Affitor API.
Before you install
AFFITOR_API_KEY is a server-side secret and should never be shipped to a browser. With AFFITOR_MCP_WRITE=1 the agent can create real sales and commissions or reverse them via refunds; keep it off unless needed and rely on testMode for dry runs. Verification runs are limited to 10 per program per hour. Customer identifiers and emails are sent to Affitor.

Installation

In SourceWeft

  1. Open Affitor in the dashboard and add it to a workspace.
  2. Connect the required credentials. They are stored privately and never shown on public pages.
  3. Enable the server for the chats that should use its tools.

Web executable via Streamable HTTP. Remote servers run from the web runtime once configured in a workspace.

Use with an agent

Paste this prompt into Claude Code, Codex, Cursor or another agent — or into SourceWeft chat. The agent reads this server's install guide, shows you its publisher, endpoint and sign-in, and adds it to your client once you agree. Keys never go into a command.

Read https://sourceweft.com/mcp/com.affitor%2Fmcp/install.md and connect the MCP server it describes to my client. Before changing any config, show me its publisher, endpoint and sign-in method and wait for my OK. Never put an API key in a command or in a file I would commit; ask me where it should come from.

Read the install guide the agent follows

Other MCP clients

Add this to your client's mcpServers config. The client completes OAuth sign-in on first connect.

{
  "mcpServers": {
    "affitor": {
      "type": "http",
      "url": "https://mcp.affitor.com/mcp"
    }
  }
}

README

@affitor/mcp

A Model Context Protocol (MCP) stdio server for Affitor.

It exposes Affitor's affiliate-tracking capabilities as MCP tools so AI agents — Claude Desktop, Cursor, and any other MCP client — can report clicks, leads, sales and refunds, and poll integration readiness, directly as tool calls.

Under the hood it wraps the consolidated server client @affitor/sdk/server (the Affitor class). Authentication is your program API key, supplied via the AFFITOR_API_KEY environment variable.

Add it to your MCP client

Add this to your client's MCP server config (e.g. claude_desktop_config.json for Claude Desktop, or .cursor/mcp.json for Cursor):

json
{  "mcpServers": {    "affitor": {      "command": "npx",      "args": ["-y", "@affitor/mcp"],      "env": {        "AFFITOR_API_KEY": "your_program_key"      }    }  }}

Restart your client and the affitor tools will be available to the agent.

Environment variables

VariableRequiredDescription
AFFITOR_API_KEYYesYour Affitor program API key (Bearer). Server-side only — never ship it to a browser.
AFFITOR_API_URLNoAPI base override. Defaults to https://api.affitor.com.
AFFITOR_MCP_WRITENoSet to 1 to register the two tools that move money: affitor_track_sale and affitor_track_refund. Off by default, so an agent exploring tools cannot create a real sale or reverse a commission.

If AFFITOR_API_KEY is not set, the server prints a clear message to stderr and exits.

Tools

Every tool carries MCP annotations (readOnlyHint, destructiveHint, idempotentHint), so a client can ask before a write. affitor_track_sale and affitor_track_refund are marked destructive and only exist with AFFITOR_MCP_WRITE=1.

ToolDescription
affitor_readinessCheck this program's integration/onboarding readiness — returns a 5-gate verdict + blocker + next_action. Poll until integration_verified is true.
affitor_track_leadReport a lead/signup. Binds the customer to the click so later sales attribute by customerExternalId alone.
affitor_track_saleNeeds AFFITOR_MCP_WRITE=1. Report a sale: creates a real sale and commission unless testMode is true. Resolves attribution by customerExternalId (bound at lead time).
affitor_track_refundNeeds AFFITOR_MCP_WRITE=1. Report a refund (omit amount = full → commission reversed; partial → refunded). Idempotent by invoiceId. testMode is a dry run.
affitor_track_clickReport a click (usually browser-side; public, no customer needed).
affitor_get_integration_planReturn the deterministic payment-tracking integration plan for a stack — install, checkout-metadata snippet, trackSale snippet + where to inject it, and the verify step. Pure — reads the canonical @affitor/recipes registry; no SDK client, no network, no side-effects. The agent follows this instead of guessing a contract.
affitor_run_verificationFire the synthetic click → lead → sale verification chain through Affitor's REAL attribution pipeline (isolated is_test rows). The agent's proof step: run it, then poll affitor_readiness until integration_verified is true. Rate-limited to 10/program/hour — on a rate_limited result, wait retry_after_seconds, don't hammer.

Inputs

affitor_readiness

  • forceRecheck?: boolean — force a fresh server-side recheck instead of the cached verdict.

affitor_track_lead (one of customerExternalId / clickId is required)

  • customerExternalId?: string — your own user id; binds this customer to the click.
  • clickId?: string — Affitor click id (from the affitor_click_id cookie).
  • email?: string
  • testMode?: boolean — record a test lead (is_test).

affitor_track_sale (one of customerExternalId / clickId is required)

  • customerExternalId?: string — your own user id; resolves attribution (no clickId needed once bound at lead time).
  • clickId?: string
  • amount: number — sale amount in integer cents (e.g. 4999 = $49.99).
  • invoiceId: string — idempotency key (your invoice / transaction id).
  • currency?: string — ISO currency code (default USD).
  • saleType?: "payment" | "subscription"
  • isRecurring?: boolean
  • subscriptionId?: string
  • subscriptionInterval?: "monthly" | "quarterly" | "annual"
  • testMode?: boolean — record a test sale (is_test, no commission), sent as transaction test_<invoiceId> so it never blocks the real sale with the same invoice.

affitor_track_refund

  • invoiceId: string — the sale's idempotency key (the invoiceId you passed to affitor_track_sale).
  • refundAmountCents?: number — integer cents. Omit (or 0) = full refund → commission reversed; partial → refunded.
  • refundReason?: string
  • testMode?: boolean — dry run: returns the refund that would be sent and calls nothing (the API has no test refunds).

affitor_track_click (all optional)

  • affiliateUrl?: string
  • pageUrl?: string
  • referrerUrl?: string
  • existingClickId?: string

affitor_get_integration_plan

  • framework: "next-app" | "next-pages" | "fastify" | "express" | "node" | "unknown" — the detected app framework; determines where trackSale is injected.
  • provider?: "stripe" | "polar" | "lemonsqueezy" | "paddle" | "unknown" — the detected payment provider (default stripe).
  • mode?: "stripe_connect" | "s2s" — payment-tracking mode (default stripe_connect). stripe_connect = Connect autocaptures the sale (metadata only, no trackSale); s2s = inject trackSale in your webhook. Returns { steps, recipe }.

affitor_run_verification (no input)

  • Fires the synthetic verification chain and returns the parsed result. On a rate limit it returns { http_status: 429, retry_after_seconds, … } rather than throwing — back off and retry.

Each tool returns the Affitor API's JSON payload as text content. On a failed request (a thrown error or an { ok: false } envelope) the tool returns an MCP error result with the message.

License

MIT

Source: packages/mcp/README.md at commit 3bd7313

Tools

5

affitor_readiness

Check readiness

Check how close this program is to tracking real affiliate sales. Use it first to see what to fix, and after affitor_run_verification, every poll.retry_after_seconds until integration_verified is true. Returns state, integration_verified, blocker (the first failing gate), each gate (profile, economics, payout, tracking, live) with status and next_action, last event times and 24-hour counts.

ParametersforceRecheck

affitor_track_lead

Report a lead

Record a signup for this program and bind the customer to the affiliate click that brought them, so their later sales attribute from customerExternalId alone. Use it when a referred visitor creates an account, from your server. Send customerExternalId, clickId, or both. Returns { ok, status, data } from the API, or an error naming what is missing.

ParametersemailclickIdtestModecustomerExternalId

affitor_track_click

Report a click

Record a visit that arrived through an affiliate link. Use it only to track clicks from a server; the Affitor browser tracker does this on its own. Returns { ok, status, data }, where data holds click_id (store it in the affitor_click_id cookie), partner_code and cookie_window_days.

ParameterspageUrlreferrerUrlaffiliateUrlexistingClickId

affitor_get_integration_plan

Get the integration plan

Get the exact steps to connect a payment stack to Affitor: the install, the checkout metadata snippet, the trackSale snippet and the file it goes in, and the check that proves it works. Use it before writing integration code, instead of guessing the contract. Works offline: it reads a built-in recipe list and calls no API.

Parametersmodeproviderframeworkrequired

affitor_run_verification

Run the verification chain

Prove the integration works: send a test click, lead and sale through Affitor's real attribution pipeline, recorded as is_test rows that are never paid. Use it after setup, then poll affitor_readiness until integration_verified is true. Limited to 10 runs per program per hour; on rate_limited, wait retry_after_seconds. Returns the API response, with http_status added on an error.

Takes no parameters.

Version history

3
  1. v0.2.4LatestOct 21, 2026
  2. v0.2.3Oct 17, 2026
  3. v0.2.2Oct 15, 2026

Score

100% of the applicable checks met

How complete this listing is, computed from the registry entry, the endpoint and public sources. Not a rating of the server and not a statement that it is safe or working today: reachability is a dated check, and no installs or reviews go into the score.

  • Reached in the last 30 daysRequired25 pts
  • Auth declaredRequired10 pts
  • Tools listed15 pts
  • DescriptionRequired15 pts
  • Logo10 pts
  • Documentation15 pts
  • License10 pts

Other Affitor integrations