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 buildConfigure 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
| Variable | Required | Description |
|---|---|---|
AFGLO_API_KEY | Yes | Owner (sk_) or affiliate (ak_) key |
AFGLO_BASE_URL | No | API base URL (default: https://afglo.com) |
Owner Tools
When configured with an sk_ key, the server provides 22 tools:
Campaign management
| Tool | Description |
|---|---|
afglo_list_campaigns | List all campaigns with pagination |
afglo_get_campaign | Get a single campaign by ID |
afglo_create_campaign | Create a new campaign with commission settings |
afglo_update_campaign | Update campaign settings or toggle active state |
Affiliate management
| Tool | Description |
|---|---|
afglo_list_affiliates | List affiliates with filters for campaign, email, state |
afglo_get_affiliate | Get a single affiliate by ID |
afglo_create_affiliate | Enroll a new affiliate into a campaign |
afglo_update_affiliate | Update state, payout email, or name |
Links
| Tool | Description |
|---|---|
afglo_list_affiliate_links | List tracking links |
afglo_create_affiliate_link | Create a new tracking link |
afglo_get_affiliate_link | Get a single link |
afglo_update_affiliate_link | Update URL or label |
Tracking data
| Tool | Description |
|---|---|
afglo_list_referrals | List referral visits with funnel stage filter |
afglo_list_leads | List captured leads |
afglo_list_conversions | List sales with revenue details |
Money
| Tool | Description |
|---|---|
afglo_list_commissions | List commissions by status |
afglo_get_commission | Get a single commission |
afglo_update_commission | Change status (paid, voided, etc.) |
afglo_list_payouts | List payout batches |
afglo_get_payout | Get a single payout |
afglo_mark_payout_as_paid | Mark payout and its commissions as paid |
Analytics
| Tool | Description |
|---|---|
afglo_get_analytics | Dashboard analytics — totals, trends, time series, top affiliates |
Affiliate Tools
When configured with an ak_ key, the server provides 6 read-only tools:
| Tool | Description |
|---|---|
afglo_my_profile | Your name, email, payout email, timezone |
afglo_my_campaigns | Campaigns you belong to, with affiliate links and stats |
afglo_my_commissions | Commission history — amounts, status, sale details |
afglo_my_referrals | Referral visits — who clicked, from where, when |
afglo_my_payouts | Payout history — amounts, status, commission counts |
afglo_my_links | Your 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.
Affiliate: "Which of my links gets the most traffic?"
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:
| URI | Key type | Description |
|---|---|---|
afglo://campaigns | Owner | All campaigns in the account |
afglo://my/campaigns | Affiliate | Your campaign memberships |