Skip to main content
Polar runs a remote Model Context Protocol (MCP) server. Connect your agent to it and the agent can look up and change data in your Polar organization: products, customers, subscriptions, orders, benefits, meters and more. There are two servers, one per environment: Connect both. Prompts in these docs that say “in my Polar sandbox” need polar-sandbox.
The servers use OAuth. When you connect a client, your browser opens so you can sign in and authorize an organization. You don’t copy an API key into your agent.

Set up with the Polar CLI

The quickest way: the Polar CLI detects Claude Code, Codex and Cursor and sets each one up. Claude Code and Codex get the Polar plugin, which bundles the MCP servers and skills. Cursor gets both servers in ~/.cursor/mcp.json and the skills in ~/.cursor/skills.
Terminal
Run polar agent setup --status to see what’s set up, and --force to reinstall. For other agents, polar agent setup --skills project installs the Polar skills into .agents/skills. Then connect the MCP server as described below. See Skills and plugins for details.

Connect your agent

To connect a client yourself, add both servers.
Add the following to .cursor/mcp.json in your project, or to ~/.cursor/mcp.json to make Polar available in every project:
Open Cursor’s MCP settings and connect each server to complete authorization.

Headless agents and CI

Where no browser can complete OAuth, send an organization access token as a bearer token instead. The token must belong to the same environment as the server: a sandbox token for polar-sandbox.
The agent gets the token’s organization and scopes. Prefer OAuth wherever a person is at the keyboard.

How the tools work

Polar exposes more than a hundred API operations. Instead of sending every operation and its input schema to your agent at the start of every conversation, the server gives it a few tools and lets it write short JavaScript snippets to find and call what it needs:
1

Search

The agent calls search to find the operations for its task, such as “find a customer and check their active subscriptions”, and their exact inputs.
2

Execute

The agent calls execute with code that makes the API calls and returns the result.
Code runs in an isolated sandbox without access to other hosts. Calls are limited to Polar’s MCP operations and the access you granted when you authorized the client.

One tool per operation

Some clients run their own code mode and want plain tools. Add ?codemode=false to the server URL, for example https://mcp.polar.sh/mcp/polar-sandbox?codemode=false. The server then exposes one tool per operation instead of search and execute. The docs tools stay the same.

Operations and API version

The MCP server calls the Polar API with Polar-Version: 2027-01, the next API version. Payloads follow the 2027-01 schema, which can differ from the 2026-10 examples elsewhere in these docs. Operations are named {resource}_{action}, like customers_get_state_external, the same as the CLI resource commands. The full list, the request behind each operation and what isn’t available from the MCP server are on MCP operations. Not available from the MCP server: creating Checkout Sessions or customer sessions, ingesting events, creating subscriptions or orders, changing organization settings, uploading files, validating license keys, disputes, and access tokens. Use the API or the dashboard for these.

Event subscriptions

Clients that support MCP events, such as ChatGPT, can subscribe to changes in your organization instead of polling. The server implements events/list, events/subscribe and events/unsubscribe, and delivers each event to the webhook URL the client registers. Events:
  • order.created, order.paid, order.refunded
  • subscription.created, subscription.active, subscription.canceled, subscription.uncanceled, subscription.revoked, subscription.paused, subscription.resumed, subscription.past_due
  • customer.created, customer.updated, customer.deleted
Event subscriptions aren’t available in read-only mode. For your own application, use webhooks.

Read-only mode

For agents that should look up data but never change it, add ?readonly=true to the server URL, for example https://mcp.polar.sh/mcp/polar-mcp?readonly=true. Only GET operations are available, and the agent asks for read-only access when you authorize it.

Telemetry

The server sends one event per tool call to help us improve it, plus a second event carrying the feedback itself when your agent calls the feedback tool. Each tool-call event carries:
  • The tool name, whether the call succeeded, the error type and status code, and the duration.
  • Your agent’s name and version, when its client reports them.
  • The API operations the call used (for example GET /v1/products/{id}) with their status codes, and the names of any fields the API rejected (for example body.prices.0.price_amount).
  • The size of the result.
  • For search, the JavaScript engine’s error message when the agent’s script fails. Search runs against the public API specification without network access, so the message cannot contain your data.
  • The intent your agent passes: one sentence on the goal of the call.
  • What your agent writes in the feedback tool.
Events from the same account share an identifier, a keyed one-way hash of your user or organization ID, so we can see how a session unfolds. Never sent: the ID itself, access tokens, every other tool argument (including the code that execute runs), results, field values, request and response bodies, and IDs in URLs. intent and feedback are the only text your agent writes that the server sends. Every tool asks the agent to write them without customer names, emails or IDs, and before they are sent or logged the server redacts anything that looks like an identifier or a secret, such as emails, IDs, card numbers and API keys. Redaction matches shapes, not meaning, so a name written in plain words can still pass. If your agent handles data you don’t want to share with us at all, opt out. To opt out, add ?telemetry=false (or 0, no, off) to the server URL, for example https://mcp.polar.sh/mcp/polar-mcp?telemetry=false. The server then ignores intent, which is neither sent nor written to its request logs, and removes the feedback tool. It combines with read-only mode: ?readonly=true&telemetry=false. The server still keeps request logs to operate and secure the service, as the Polar API does.

Learn more