diff --git a/README.md b/README.md index ba7d1b3..8c611f2 100644 --- a/README.md +++ b/README.md @@ -31,6 +31,15 @@ Both servers use OAuth. Nothing connects until you sign in to Polar and authoriz ## Installation +The quickest way is the [Polar CLI](https://polar.sh/docs/integrate/cli/introduction). It detects Claude Code, Codex and Cursor and sets each one up with the Polar plugin, MCP server and skills: + +```bash +npm install -g @polar-sh/cli +polar agent setup +``` + +`polar agent setup --status` shows what is set up, and `polar agent setup --skills project` installs the skills into `.agents/skills` for any other agent. To install by hand instead, follow the section for your agent. + ### Claude Code ``` diff --git a/skills/polar-testing/SKILL.md b/skills/polar-testing/SKILL.md index 14b2dd1..3fb917c 100644 --- a/skills/polar-testing/SKILL.md +++ b/skills/polar-testing/SKILL.md @@ -52,7 +52,8 @@ polar = Polar(os.environ["POLAR_ACCESS_TOKEN"], environment="sandbox") ### Sandbox Limitations - No real money is processed, and data is isolated from production -- Customer-facing emails (receipts, renewal reminders) are only delivered to members of your organization; `you+test@example.com` aliases are accepted +- Customer-facing emails (receipts, renewal reminders) are only delivered to members of your organization; `+test` aliases of their addresses are accepted +- A customer email must be on a domain that can receive mail. Polar rejects `@example.com` and made-up domains, at checkout and in the API, so test with a real address such as a `+test` alias of your own - The API allows 100 requests per minute, against 500 in production, which matters for large integration suites ## Test Cards @@ -157,7 +158,6 @@ describe("Polar Checkout", () => { const checkout = await polar.checkouts.create({ products: [testProductId], success_url: "http://localhost:3000/success", - customer_email: "test@example.com", }); expect(checkout.status).toBe("open"); diff --git a/skills/setup-polar/SKILL.md b/skills/setup-polar/SKILL.md index a2b63e5..39e1dfe 100644 --- a/skills/setup-polar/SKILL.md +++ b/skills/setup-polar/SKILL.md @@ -38,29 +38,17 @@ First, check if the Polar MCP server is available by listing organizations: call **Polar plugin installed:** the plugin already configures the Polar server (`polar`, plus `polar-sandbox` where available). Ask the user to sign in to it, preferring `polar-sandbox`: in Claude Code with `/mcp`, in Codex with `codex mcp login `, in Cursor or Antigravity from their MCP settings, in Gemini CLI with `/mcp auth `, and in ChatGPT when prompted to connect. Then continue with the verification below. -Otherwise, guide the user to install the Polar MCP server based on their environment: +Otherwise, set it up with the Polar CLI. Install it with `npm install -g @polar-sh/cli`, then run: -**Claude Code:** ```bash -# Production -claude mcp add --transport http polar https://mcp.polar.sh/mcp/polar-mcp - -# Sandbox (recommended for setup) -claude mcp add --transport http polar-sandbox https://mcp.polar.sh/mcp/polar-sandbox +polar agent setup ``` -**Cursor** (`.cursor/mcp.json`): -```json -{ - "mcpServers": { - "polar-sandbox": { - "url": "https://mcp.polar.sh/mcp/polar-sandbox" - } - } -} -``` +It installs the Polar plugin, with the MCP server and these skills, for Claude Code, Codex and Cursor. Run from inside one of them, it sets up only that agent and asks nothing. `polar agent setup --status` shows what is set up without changing anything. + +For any other agent, connect the MCP server by following the [Polar MCP guide](https://polar.sh/docs/integrate/mcp). -For other clients, follow the [Polar MCP guide](https://polar.sh/docs/integrate/mcp). After installing, the user restarts their editor or CLI and signs in when prompted (in Claude Code, run `/mcp` and authenticate). The sandbox server signs in at sandbox.polar.sh and the production server at polar.sh. +The user then signs in, preferring `polar-sandbox` where it is available: in Claude Code after a restart with `/mcp`, in Codex with `codex mcp login `, and in Cursor from its MCP settings. The sandbox server signs in at sandbox.polar.sh and the production server at polar.sh. Once authenticated, verify MCP works by listing organizations. @@ -141,7 +129,7 @@ When deploying, create a webhook endpoint for the public URL in the dashboard (S ### Step 8: Test the Integration 1. Visit the checkout URL with the product ID from Step 5 (path and query shape come from the route generated in Step 6). -2. Complete checkout using test card: `4242 4242 4242 4242`. +2. Complete checkout using test card `4242 4242 4242 4242` and an email address on a real domain. Polar rejects `@example.com` and other addresses that can't receive mail. 3. Verify that `polar webhook listen` shows `order.paid` with a 2xx status from the handler. 4. Check the success page displays correctly.