{"_id":"@affitor/mcp","_rev":"2-f37e35c05cb81afefaeff2f99178e86c","name":"@affitor/mcp","dist-tags":{"latest":"0.2.0"},"versions":{"0.1.0":{"name":"@affitor/mcp","version":"0.1.0","keywords":["affitor","mcp","model-context-protocol","affiliate","tracking","agent","ai","claude","cursor"],"author":{"name":"Affitor","email":"hello@affitor.com"},"license":"MIT","_id":"@affitor/mcp@0.1.0","maintainers":[{"name":"tomto","email":"tomto@affitor.com"},{"name":"sonpiaz","email":"sonxpiaz@gmail.com"}],"homepage":"https://affitor.com","bugs":{"url":"https://github.com/Affitor/cli/issues"},"bin":{"affitor-mcp":"dist/index.js"},"dist":{"shasum":"fda779849d9cc17e52703dbc343bc7004b0791cc","tarball":"https://registry.npmjs.org/@affitor/mcp/-/mcp-0.1.0.tgz","fileCount":6,"integrity":"sha512-P7MYOcMkDyQvJhUWczZw/LKUkVM14hAo9FzIqbs9JUxHYpocxMU9tLe1ndov00/11cQ1ytUOo8xZU9EfNiKeeA==","signatures":[{"sig":"MEQCIDKR1IxFQrgZxvK0Qhosd+G06yi/vsNu//r821gYNzI8AiB1L17VnkpdnQUS17S7LtrQoI+RY34OvUoAZ8O7rMgWbQ==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":24518},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","engines":{"node":">=18"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"gitHead":"af6073ec461c05f959dac0905eb468ceca3f1e1c","scripts":{"dev":"tsc --watch","lint":"tsc --noEmit","test":"vitest run --passWithNoTests","build":"tsc","start":"node dist/index.js","prepublishOnly":"npm run build"},"_npmUser":{"name":"sonpiaz","email":"sonxpiaz@gmail.com"},"repository":{"url":"git+https://github.com/Affitor/cli.git","type":"git"},"_npmVersion":"10.9.8","description":"Model Context Protocol (MCP) stdio server for Affitor — lets AI agents (Claude Desktop, Cursor, …) call Affitor affiliate-tracking capabilities as tools.","directories":{},"_nodeVersion":"22.22.3","dependencies":{"zod":"^3.23.8","@affitor/sdk":"^2.1.0","@modelcontextprotocol/sdk":"^1.29.0"},"_hasShrinkwrap":false,"devDependencies":{"vitest":"^3.1.0","typescript":"^5.7.0","@types/node":"^22.0.0"},"_npmOperationalInternal":{"tmp":"tmp/mcp_0.1.0_1781411469758_0.3723783358286201","host":"s3://npm-registry-packages-npm-production"}},"0.2.0":{"name":"@affitor/mcp","version":"0.2.0","description":"Model Context Protocol (MCP) stdio server for Affitor — lets AI agents (Claude Desktop, Cursor, …) call Affitor affiliate-tracking capabilities as tools.","type":"module","main":"./dist/index.js","types":"./dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"bin":{"affitor-mcp":"dist/index.js"},"scripts":{"build":"tsc","dev":"tsc --watch","start":"node dist/index.js","lint":"tsc --noEmit","test":"vitest run --passWithNoTests","prepublishOnly":"npm run build"},"keywords":["affitor","mcp","model-context-protocol","affiliate","tracking","agent","ai","claude","cursor"],"author":{"name":"Affitor","email":"hello@affitor.com"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/Affitor/cli.git"},"homepage":"https://affitor.com","engines":{"node":">=18"},"dependencies":{"@modelcontextprotocol/sdk":"^1.29.0","@affitor/sdk":"^2.1.0","@affitor/recipes":"^0.1.0","zod":"^3.23.8"},"devDependencies":{"typescript":"^5.7.0","vitest":"^3.1.0","@types/node":"^22.0.0"},"_id":"@affitor/mcp@0.2.0","gitHead":"6175e4c0245367efcfa772fcef4cdf77e4667c76","bugs":{"url":"https://github.com/Affitor/cli/issues"},"_nodeVersion":"22.22.3","_npmVersion":"10.9.8","dist":{"integrity":"sha512-UtIYdvSP4XkfmQinMw+3qcbB7fdeKiMz9nMe89urJMsKv3F5yHCYmKAywvgxTVelKWSIPPlz0OU6IfqS/OYPlw==","shasum":"5dc40a4fa5092d5fdb3eb5f085ffaeb75f3e2721","tarball":"https://registry.npmjs.org/@affitor/mcp/-/mcp-0.2.0.tgz","fileCount":6,"unpackedSize":31955,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCIBx7bnI90uqRjYORcGS/Ci4pkLvFIMv4YR52I+i5EgfSAiAkCYL5lawq0tPvsuFhHQQnHHs4FUxr2YQQZj4/Kppl6w=="}]},"_npmUser":{"name":"sonpiaz","email":"sonxpiaz@gmail.com"},"directories":{},"maintainers":[{"name":"tomto","email":"tomto@affitor.com"},{"name":"sonpiaz","email":"sonxpiaz@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/mcp_0.2.0_1781489167599_0.07516512995300206"},"_hasShrinkwrap":false}},"time":{"created":"2026-06-14T04:31:09.527Z","modified":"2026-06-15T02:06:07.876Z","0.1.0":"2026-06-14T04:31:09.896Z","0.2.0":"2026-06-15T02:06:07.716Z"},"bugs":{"url":"https://github.com/Affitor/cli/issues"},"author":{"name":"Affitor","email":"hello@affitor.com"},"license":"MIT","homepage":"https://affitor.com","keywords":["affitor","mcp","model-context-protocol","affiliate","tracking","agent","ai","claude","cursor"],"repository":{"type":"git","url":"git+https://github.com/Affitor/cli.git"},"description":"Model Context Protocol (MCP) stdio server for Affitor — lets AI agents (Claude Desktop, Cursor, …) call Affitor affiliate-tracking capabilities as tools.","maintainers":[{"name":"tomto","email":"tomto@affitor.com"},{"name":"sonpiaz","email":"sonxpiaz@gmail.com"}],"readme":"# @affitor/mcp\n\nA [Model Context Protocol](https://modelcontextprotocol.io) (MCP) **stdio server** for [Affitor](https://affitor.com).\n\nIt 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.\n\nUnder the hood it wraps the consolidated server client [`@affitor/sdk/server`](https://www.npmjs.com/package/@affitor/sdk) (the `Affitor` class). Authentication is your **program API key**, supplied via the `AFFITOR_API_KEY` environment variable.\n\n## Add it to your MCP client\n\nAdd this to your client's MCP server config (e.g. `claude_desktop_config.json` for Claude Desktop, or `.cursor/mcp.json` for Cursor):\n\n```json\n{\n  \"mcpServers\": {\n    \"affitor\": {\n      \"command\": \"npx\",\n      \"args\": [\"-y\", \"@affitor/mcp\"],\n      \"env\": {\n        \"AFFITOR_API_KEY\": \"your_program_key\"\n      }\n    }\n  }\n}\n```\n\nRestart your client and the `affitor` tools will be available to the agent.\n\n## Environment variables\n\n| Variable           | Required | Description                                                                 |\n| ------------------ | -------- | --------------------------------------------------------------------------- |\n| `AFFITOR_API_KEY`  | Yes      | Your Affitor **program API key** (Bearer). Server-side only — never ship it to a browser. |\n| `AFFITOR_API_URL`  | No       | API base override. Defaults to `https://api.affitor.com`.                    |\n\nIf `AFFITOR_API_KEY` is not set, the server prints a clear message to stderr and exits.\n\n## Tools\n\n| Tool                   | Description                                                                                                                              |\n| ---------------------- | -------------------------------------------------------------------------------------------------------------------------------------- |\n| `affitor_readiness`    | Check this program's integration/onboarding readiness — returns a 5-gate verdict + blocker + next_action. Poll until `integration_verified` is true. |\n| `affitor_track_lead`   | Report a lead/signup. Binds the customer to the click so later sales attribute by `customerExternalId` alone.                            |\n| `affitor_track_sale`   | Report a sale. Resolves attribution by `customerExternalId` (bound at lead time).                                                        |\n| `affitor_track_refund` | Report a refund (omit amount = full → commission reversed; partial → refunded). Idempotent by `invoiceId`.                               |\n| `affitor_track_click`  | Report a click (usually browser-side; public, no customer needed).                                                                       |\n\n### Inputs\n\n**`affitor_readiness`**\n- `forceRecheck?: boolean` — force a fresh server-side recheck instead of the cached verdict.\n\n**`affitor_track_lead`** (one of `customerExternalId` / `clickId` is required)\n- `customerExternalId?: string` — your own user id; binds this customer to the click.\n- `clickId?: string` — Affitor click id (from the `affitor_click_id` cookie).\n- `email?: string`\n\n**`affitor_track_sale`** (one of `customerExternalId` / `clickId` is required)\n- `customerExternalId?: string` — your own user id; resolves attribution (no `clickId` needed once bound at lead time).\n- `clickId?: string`\n- `amount: number` — sale amount in **integer cents** (e.g. `4999` = $49.99).\n- `invoiceId: string` — idempotency key (your invoice / transaction id).\n- `currency?: string` — ISO currency code (default `USD`).\n- `saleType?: \"payment\" | \"subscription\"`\n- `isRecurring?: boolean`\n- `subscriptionId?: string`\n- `subscriptionInterval?: \"monthly\" | \"quarterly\" | \"annual\"`\n\n**`affitor_track_refund`**\n- `invoiceId: string` — the sale's idempotency key (the `invoiceId` you passed to `affitor_track_sale`).\n- `refundAmountCents?: number` — integer cents. Omit (or `0`) = full refund → commission reversed; partial → refunded.\n- `refundReason?: string`\n\n**`affitor_track_click`** (all optional)\n- `affiliateUrl?: string`\n- `pageUrl?: string`\n- `referrerUrl?: string`\n- `existingClickId?: string`\n\nEach 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.\n\n## License\n\nMIT\n","readmeFilename":"README.md"}