{
  "markdown": "# affiliate-router-mcp\n\n[![M8ven Verified](https://m8ven.ai/badge/mcp/forgemeshlabs-affiliate-router-mcp-1pkb5d?variant=verified)](https://m8ven.ai/mcp/forgemeshlabs-affiliate-router-mcp-1pkb5d)\n\nVendor-neutral monetization routing for agent tools. One MCP server that discovers,\nroutes, and attributes revenue across paid APIs, referral links, and affiliate programs.\n\n**Source:** https://github.com/forgemeshlabs/affiliate-router-mcp\n\nThe router is not tied to any single payment network or affiliate system.\nAdapters are pluggable. The registry is a local JSON file you control.\n\n**Status:** experimental · v0.1.6\n\n> **Disclaimer:** This MCP does not guarantee payouts. It routes attribution data\n> according to each vendor/program's rules. Commission distribution is enforced by\n> the vendor's payment system, not by this router.\n\n---\n\n## What it does\n\nAgents need a way to call monetizable tools without hardcoding every affiliate\nor payment system. `affiliate-router-mcp` provides:\n\n- **Discovery** — find vendors and products by category or intent\n- **Routing** — choose the right payment/attribution path automatically\n- **Calling** — execute payments with affiliate attribution\n- **Link generation** — inject tracking params into referral URLs\n- **Telemetry** — log every attributed call locally for tracking\n\n---\n\n## 8 Tools\n\n| Tool | Cost | Description |\n|------|------|-------------|\n| `search_opportunities` | Free | Find products by category or keyword |\n| `list_affiliate_programs` | Free | List all vendors and their programs |\n| `get_opportunity_details` | Free | Full details on a specific vendor/product |\n| `get_best_route` | Free | Recommend the best route for an intent |\n| `generate_affiliate_link` | Free | Build a tracked referral URL |\n| `call_affiliate_product` | varies | Pay and call a product with attribution |\n| `estimate_commission` | Free | Project monthly earnings at a call volume |\n| `get_affiliate_telemetry` | Free | View local attribution log |\n\n---\n\n## Adapters\n\nEach payment or attribution system is a separate adapter. Adding a new one does not\naffect existing adapters.\n\n| Adapter | How it works | Payment | Status |\n|---------|-------------|---------|--------|\n| `x402_pyrimid` | Approve USDC → `routePayment` on-chain → retry with tx hash | On-chain USDC split | **Tested** |\n| `x402_direct` | EIP-3009 `transferWithAuthorization` via Coinbase facilitator | On-chain USDC to vendor | Implemented |\n| `referral_link` | Inject affiliate param into URL | None — program-dependent | Implemented |\n\n**Pyrimid is the first fully tested paid affiliate adapter.** It is not the only\nsupported model. Future adapters may include: PartnerStack, Rewardful, Impact,\nCommission Junction, coupon/promo code injection, API-key partner programs, and\nother emerging agent commerce protocols.\n\n---\n\n## Install\n\n```bash\nnpm install -g affiliate-router-mcp\n```\n\nOr with Claude Code / any MCP client:\n\n```json\n{\n  \"mcpServers\": {\n    \"affiliate-router\": {\n      \"command\": \"affiliate-router-mcp\",\n      \"env\": {\n        \"WALLET_PRIVATE_KEY\": \"0x...\",\n        \"PYRIMID_AFFILIATE_ID\": \"af_your_id\",\n        \"GUMROAD_AFFILIATE_ID\": \"your-gumroad-id\"\n      }\n    }\n  }\n}\n```\n\n---\n\n## Environment Variables\n\n| Variable | Required | Notes |\n|----------|----------|-------|\n| `WALLET_PRIVATE_KEY` | For `call_affiliate_product` with x402 adapters | Base wallet with USDC + ETH for gas |\n| `PYRIMID_AFFILIATE_ID` | No | Default affiliate ID for Pyrimid-registered products |\n| `GUMROAD_AFFILIATE_ID` | No | Gumroad tracking ID |\n| `PARTNERSTACK_CODE` | No | PartnerStack referral code |\n\n---\n\n## Included Vendors\n\n**CoinOpAI** (`x402_pyrimid`) — crypto intelligence API on Base mainnet\n- Kronos Signals — $0.05/call, 20% commission\n- Kronos Decision — $0.15/call, 20% commission\n- Trade Preflight — $0.05/call, 20% commission\n- Trade Audit — $0.07/call, 20% commission\n- Image Generation — $0.10/call, 20% commission\n\n**Gumroad** (`referral_link`) — digital product marketplace, ~30% commission per product\n\n**PartnerStack** (`referral_link`) — SaaS affiliate programs stub (add your own products)\n\n---\n\n## Routing Logic\n\n```\ncall_affiliate_product(vendor_id, product_id, params, affiliate_id?)\n    ↓\nresolve affiliate_id: tool arg → env var → null\n    ↓\nadapter = vendor.affiliate_system\n    ↓\nx402_pyrimid + affiliate_id present?\n  cache VALID   → Pyrimid split flow (affiliate earns commission)\n  cache INVALID → x402_direct fallback (vendor gets 100%)\n  cache UNKNOWN → try Pyrimid → cache result → fallback on failure\n\nx402_direct → EIP-3009 payment, no affiliate split\nreferral_link → inject tracking param, no payment\n```\n\n---\n\n## Package vs. Product Updates\n\nThese are independent concerns.\n\n**Package updates** (this repo):\n- Adding or fixing adapters\n- Updating tool schemas\n- Changing routing or caching logic\n- Dependency bumps\n\n**Product/catalog updates** (registry.json):\n- Registering new vendor endpoints\n- Changing prices or commission rates\n- Enabling affiliate eligibility on a product\n- Assigning network-specific product IDs (e.g. Pyrimid product IDs)\n\nAdding a vendor to `registry.json` does not require a package release.\nReleasing a new package version does not require products to be re-registered.\n\n---\n\n## Adding a Vendor\n\nEdit `registry.json`. No code changes needed for referral-link vendors.\nx402 vendors require a funded wallet. Pyrimid vendors additionally require\non-chain registration to obtain a `vendor_id` and per-product `pyrimid_product_id`.\n\n```json\n{\n  \"id\": \"my_vendor\",\n  \"name\": \"My Vendor\",\n  \"affiliate_system\": \"referral_link\",\n  \"affiliate_config\": {\n    \"tracking_param\": \"ref\",\n    \"affiliate_id_env\": \"MY_VENDOR_REF_CODE\",\n    \"commission_pct\": 25\n  },\n  \"products\": [...]\n}\n```\n\n---\n\n## Telemetry\n\nAll `call_affiliate_product` calls append to `logs/affiliate-telemetry.jsonl`:\n\n```json\n{\n  \"ts\": \"2026-05-14T17:07:01Z\",\n  \"vendor_id\": \"coinopai\",\n  \"product_id\": \"kronos_signals\",\n  \"amount_usd\": 0.05,\n  \"affiliate_id\": \"af_your_id\",\n  \"payment_type\": \"x402_pyrimid\",\n  \"commission_est_usd\": 0.0099,\n  \"status\": \"success\",\n  \"tx_hash\": \"0x...\"\n}\n```\n\n---\n\n## What's Not in v0\n\n- Remote registry sync\n- PartnerStack / Impact.com / Rewardful API integrations\n- Web dashboard\n- Multi-level commissions\n- Server-side redirect tracking for links\n\n---\n\n## Part of the ForgeMesh Ecosystem\n\nInfrastructure for monetized agent ecosystems.\n\n| Package | What | Install |\n|---------|------|---------|\n| **affiliate-router-mcp** | Vendor-neutral monetization routing (this package) | `npm i affiliate-router-mcp` |\n| [coinopai-mcp](https://github.com/forgemeshlabs/coinopai-mcp) | Paid crypto intelligence via x402 | `npm i coinopai-mcp` |\n| [forgemesh-imagegen](https://github.com/forgemeshlabs/imagegen-mcp) | Paid image generation MCP | `npm i forgemesh-imagegen` |\n\nEach package works standalone. No shared dependency required.\n\n---\n\n## License\n\nMIT — CoinOpAI\n",
  "bytes": 6922,
  "sha": "1b023cbfc479ae1ca1482e1ef51d82196b572fddf6aab831301ee07a3e323ca5",
  "repo_slug": "forgemeshlabs/affiliate-router-mcp",
  "fonte": "repo",
  "truncated": false,
  "api": "https://agentalog.com/api/listings/mcp_io_github_forgemeshlabs_affiliate_router_54b84623/readme"
}