Afglo Docs

MCP Server

Connect AI agents to your affiliate program using the Model Context Protocol.

The Afglo MCP server lets AI agents — Claude Desktop, Claude Code, and other MCP-compatible clients — manage your affiliate program through natural language. The server wraps the Afglo REST API and exposes it as MCP tools.

How It Works

The MCP server detects the API key type and exposes the appropriate tools:

  • Owner keys (sk_) expose 22 tools for full program management.
  • Affiliate keys (ak_) expose 6 read-only tools for viewing personal data.

All tools include annotations (readOnlyHint, destructiveHint, idempotentHint, openWorldHint) so agents understand the safety profile of each operation. Tool names are prefixed with afglo_ to avoid conflicts when used alongside other MCP servers.

Setup

Install and build

cd mcp-server
npm install
npm run build

Configure for Claude Code

Add to .mcp.json in your project root:

{
  "mcpServers": {
    "afglo": {
      "command": "node",
      "args": ["./mcp-server/dist/index.js"],
      "env": {
        "AFGLO_API_KEY": "sk_your_owner_key_here"
      }
    }
  }
}

Configure for Claude Desktop

Add to your Claude Desktop config (~/Library/Application Support/Claude/claude_desktop_config.json on macOS):

{
  "mcpServers": {
    "afglo": {
      "command": "node",
      "args": ["/absolute/path/to/mcp-server/dist/index.js"],
      "env": {
        "AFGLO_API_KEY": "sk_your_owner_key_here"
      }
    }
  }
}

Environment variables

VariableRequiredDescription
AFGLO_API_KEYYesOwner (sk_) or affiliate (ak_) key
AFGLO_BASE_URLNoAPI base URL (default: https://afglo.com)

Owner Tools

When configured with an sk_ key, the server provides 22 tools:

Campaign management

ToolDescription
afglo_list_campaignsList all campaigns with pagination
afglo_get_campaignGet a single campaign by ID
afglo_create_campaignCreate a new campaign with commission settings
afglo_update_campaignUpdate campaign settings or toggle active state

Affiliate management

ToolDescription
afglo_list_affiliatesList affiliates with filters for campaign, email, state
afglo_get_affiliateGet a single affiliate by ID
afglo_create_affiliateEnroll a new affiliate into a campaign
afglo_update_affiliateUpdate state, payout email, or name
ToolDescription
afglo_list_affiliate_linksList tracking links
afglo_create_affiliate_linkCreate a new tracking link
afglo_get_affiliate_linkGet a single link
afglo_update_affiliate_linkUpdate URL or label

Tracking data

ToolDescription
afglo_list_referralsList referral visits with funnel stage filter
afglo_list_leadsList captured leads
afglo_list_conversionsList sales with revenue details

Money

ToolDescription
afglo_list_commissionsList commissions by status
afglo_get_commissionGet a single commission
afglo_update_commissionChange status (paid, voided, etc.)
afglo_list_payoutsList payout batches
afglo_get_payoutGet a single payout
afglo_mark_payout_as_paidMark payout and its commissions as paid

Analytics

ToolDescription
afglo_get_analyticsDashboard analytics — totals, trends, time series, top affiliates

Affiliate Tools

When configured with an ak_ key, the server provides 6 read-only tools:

ToolDescription
afglo_my_profileYour name, email, payout email, timezone
afglo_my_campaignsCampaigns you belong to, with affiliate links and stats
afglo_my_commissionsCommission history — amounts, status, sale details
afglo_my_referralsReferral visits — who clicked, from where, when
afglo_my_payoutsPayout history — amounts, status, commission counts
afglo_my_linksYour tracking links with per-link visitor/lead/conversion counts

Example Conversations

Owner: "How are my affiliates performing?"

The agent calls afglo_get_analytics and presents a summary of visitors, conversions, and top affiliates.

Owner: "Add jane@example.com to the Summer Sale campaign"

The agent calls afglo_list_campaigns to find the campaign ID, then afglo_create_affiliate with the email and campaign.

Owner: "Mark all due payouts as paid"

The agent calls afglo_list_payouts with status=pending, then calls afglo_mark_payout_as_paid for each.

Affiliate: "How much have I earned?"

The agent calls afglo_my_commissions and summarizes the total by status.

The agent calls afglo_my_links and ranks them by visitor count.

Resources

The MCP server also exposes resources that agents can read for context without making a tool call:

URIKey typeDescription
afglo://campaignsOwnerAll campaigns in the account
afglo://my/campaignsAffiliateYour campaign memberships

On this page