---
title: AI and MCP
description: Connect AI agents to Insy over the Model Context Protocol — a public server that searches these docs, and an account server with browser sign-in, scoped tools and confirmations.
---

Insy runs two [Model Context Protocol](https://modelcontextprotocol.io) (MCP) servers, and they do
different jobs:

- **The docs server** at `https://docs.insy.io/mcp` searches and reads this documentation — the
  help center and the developer pages. It needs no sign-in.
- **The account server** at `https://api.insy.io/mcp` works on a live Insy account: memberships,
  purchases, communities, products, payouts and support. It connects through a browser sign-in,
  so you never put an API key in the client config.

Both speak the Streamable HTTP transport. Point the client at the URL; there is no `/sse`
endpoint.

## Docs server

The docs site serves it itself, next to the pages, with four read-only tools:

| Tool | What it does |
| --- | --- |
| `search_docs` | Full-text search over docs.insy.io. Each match has its title, route, content type and an excerpt. |
| `get_page` | One page as Markdown, by the route from `search_docs` or `list_pages` (for example `/developers/oauth`). |
| `list_pages` | Every page with its route, title and description. |
| `get_navigation` | The navigation tree: the header tabs and the sidebar under each. |

Clients that discover servers on their own find it at
[`/.well-known/mcp.json`](https://docs.insy.io/.well-known/mcp.json); the server card is at
`/.well-known/mcp/server-card.json`.

**Claude Code**

```bash
claude mcp add --transport http insy-docs https://docs.insy.io/mcp
```

**Cursor (.cursor/mcp.json)**

```json
{
  "mcpServers": {
    "insy-docs": { "url": "https://docs.insy.io/mcp" }
  }
}
```

It serves only what docs.insy.io already publishes.

## Account server

**Claude Code**

```bash
claude mcp add --transport http insy https://api.insy.io/mcp
```

**Cursor (.cursor/mcp.json)**

```json
{
  "mcpServers": {
    "insy": { "url": "https://api.insy.io/mcp" }
  }
}
```

### Transport

The server is stateless and answers every request with one JSON body: no sessions and no
server-sent event streams.

- **`POST /mcp` only.** `GET` and `DELETE` answer `405` with `Allow: POST`.
- **One message per request.** A JSON-RPC batch (an array) answers `400` before any of it runs.
- **Protocol versions.** Clients that open with `initialize` can use any version from `2024-11-05`
  to `2025-11-25`; an unknown version is negotiated down to `2025-11-25`. Clients on `2026-07-28`
  send the per-request `_meta` envelope instead and need no handshake. A `MCP-Protocol-Version`
  header naming a version the server does not support answers `400`.
- **Headers.** `Content-Type` must be `application/json` (otherwise `415`), and `Accept` must list
  both `application/json` and `text/event-stream` (otherwise `406`) — even though the reply is
  always JSON.

A tool that asks for confirmation on this server has a `confirmationToken` property in its
`inputSchema`; the others do not.

### Connect from claude.ai or Grok

1. **Add a custom connector**

    In claude.ai open **Settings → Connectors → Add custom connector**. In Grok, add a custom MCP
    connector the same way.

2. **Enter the server URL**

    `https://api.insy.io/mcp`. Leave the client ID and secret fields empty.

3. **Sign in and approve**

    Your browser opens the Insy sign-in, then the consent screen listing what the connection asks
    for. You can approve everything, keep it read-only, or set each resource to None, Read or
    Write; the connection gets only what you leave on, and its tools are limited to that. Approve
    to finish.

To see or end a connection later, open [Account → Connected apps](https://insy.io/account/connected-apps)
on insy.io. It lists every app you approved with its scopes, when you approved it and when it last
used a token. **Disconnect** removes your consent and revokes every token and pending authorization
code the app holds at once; to come back it has to ask you again. The same list is
`GET /oauth/connections` and `DELETE /oauth/connections/{clientId}` on the API, for a signed-in
Insy session — not for OAuth tokens or API keys.

### How sign-in works

The account server is an OAuth 2.1 resource server. A request without a token gets `401` with a
`WWW-Authenticate` header that points at `/.well-known/oauth-protected-resource/mcp`; from there
the client finds the authorization server metadata at
`https://api.insy.io/.well-known/oauth-authorization-server`.

Clients register themselves through **dynamic client registration** (RFC 7591) at
`POST https://api.insy.io/oauth/register`, so there is nothing to set up in the Insy app first.
Every client registered this way is public: it gets a `client_id` and no secret, and must use
PKCE (`S256`). Redirect URIs must use `https`, plain `http` to a loopback address (`127.0.0.1`,
`[::1]` or `localhost`, any port), or an app's own scheme such as `cursor://`.

Registration is limited at several levels:

| Limit | Over it |
| --- | --- |
| 5 a minute and 30 a day per IP address | `429` |
| 10 an hour per IP address | `503` with `temporarily_unavailable` |
| 5000 an hour for clients whose every redirect URI is `https` on `claude.ai`, `claude.com`, `chatgpt.com`, `grok.com` or a subdomain of one | `503` with `temporarily_unavailable` |
| 1000 an hour for every other client | `503` with `temporarily_unavailable` |
| 10,000 an hour overall | `503` with `temporarily_unavailable` |

Self-registered clients are cleaned up: one nobody approved within 24 hours is deleted, and so is
one that has neither been issued nor used a token for 90 days — by then every refresh token it held
has expired. Its consents and tokens go with it, and the client registers again on its next
connection.

The client always receives the code flow and refresh tokens: the registration response lists
`authorization_code` and `refresh_token` even if the request named fewer.

**Client ID metadata documents** — an `https` URL used as the `client_id` instead of registering —
are accepted only from a list pinned in Insy's code; today that is OpenAI Codex
(`https://chatgpt.com/oauth/codex/client.json`). Insy never fetches the document: any other URL
used as a `client_id` is an unknown client.

The consent screen shows the address the client will return to, and warns about every client Insy
has not verified. Grok, Claude and ChatGPT are recognised by where they send the user back: a
client whose every redirect URI is on `https://grok.com`, `https://claude.ai` or
`https://chatgpt.com` (exact host, no subdomains) is shown under that product's name, with no
warning. For any other client that **registered itself**, the warning says insy cannot confirm the
name it gave and names the host you will be sent to. Continue only if you started the connection
on that host.

When the client sends the RFC 8707 `resource` parameter — `https://api.insy.io/mcp`, the
`resource` the protected-resource metadata advertises — its tokens are bound to the account
server: the [Account API](/developers/api/v1) and the `/oauth/userinfo`, `/oauth/memberships` and
`/oauth/products` endpoints refuse them. Tokens issued without a `resource` work everywhere. Any other `resource` value is refused with `invalid_target`; see
[the OAuth reference](/developers/oauth/reference#post-oauthtoken).

If you want a client of your own instead — a fixed name and logo on the consent screen — register
it under [Account → Developer → OAuth clients](https://insy.io/account/developer/oauth-clients)
and see [Sign in with Insy](/developers/oauth).

### What a connection can reach

The grant is the signed-in person's account. The tools are the [Account API](/developers/api/v1)
in another protocol: each one runs the same operation as its REST endpoint, with the same
[scope](/developers/oauth/scopes), validation and ownership checks. A token only sees the tools its
scopes cover; `tools/list` returns exactly those.

| Tool | REST endpoint | Scope |
| --- | --- | --- |
| `get_customer_overview` | `GET /v1/me` | `profile.read` |
| `list_memberships` | `GET /v1/me/memberships` | `memberships.read` |
| `get_telegram_join_link` | — (MCP only) | `memberships.write` |
| `cancel_subscription` | `POST /v1/me/memberships/{slug}/cancel` | `memberships.write` |
| `list_purchases` | `GET /v1/me/purchases` | `purchases.read` |
| `report_problem` | `POST /v1/me/reports` | `support.write` |
| `list_managed_communities` | `GET /v1/communities` | `communities.read` |
| `set_community_published` | `PATCH /v1/communities/{slug}` | `communities.write` |
| `find_community_member` | `GET /v1/communities/members` | `members.read` |
| `get_community_stats` | `GET /v1/communities/{slug}/stats` | `communities.read` |
| `list_community_activity` | `GET /v1/communities/{slug}/activity` | `members.read` |
| `list_community_members` | `GET /v1/communities/{slug}/members` | `members.read` |
| `list_community_payments` | `GET /v1/communities/{slug}/payments` | `earnings.read` |
| `list_access_plans` | `GET /v1/communities/{slug}/plans` | `communities.read` |
| `get_community_reviews` | `GET /v1/communities/{slug}/reviews` | `communities.read` |
| `list_managed_products` | `GET /v1/products` | `products.read` |
| `add_product_variant` | `POST /v1/products/{slug}/variants` | `products.write` |
| `set_product_published` | `PATCH /v1/products/{slug}` | `products.write` |
| `get_payout_status` | `GET /v1/payouts/accounts` | `earnings.read` |
| `create_support_case` | `POST /v1/support/cases` | `support.write` |
| `search_help` | `GET /v1/help/search` | `help.read` |
| `read_help_article` | `GET /v1/help/article` | `help.read` |
| `find_refundable_payments` | — (MCP only) | `refunds.write` |
| `refund_payment` | — (MCP only) | `refunds.write` |

A tool's `structuredContent.data` is the REST response's `data`. Tool arguments use the REST body's
field names; a slug the REST endpoint takes in the path is the `communitySlug` or `productSlug`
argument.

`get_telegram_join_link` has no REST endpoint. It returns a fresh personal invite link to the
Telegram group of a community the person is an active member of, and the link works like a
credential: the first Telegram account to open it joins as that person. So it needs
`memberships.write`, asks for confirmation, and is refused with `telegram_not_linked` when the Insy
account has no Telegram account connected yet — connect one in the Insy app first.

`find_refundable_payments` and `refund_payment` let the **owner** of a community refund a
customer's card payment. Find the customer by Insy user id, e-mail or Telegram user id; the first
tool lists their refundable payments in that community with a payment id. `refund_payment` refunds
the whole remaining amount, or `amountCents` of it, from the owner's Stripe balance (Insy's fee is
not returned), and can cancel the subscription the payment renewed (`cancelSubscription`). Every
refund asks for confirmation, and the most that can be refunded is what Stripe reports as still
refundable at that moment. Access is shortened and the payment marked refunded when Stripe reports
the refund. Crypto payments are refused with `unsupported_method`; an owner refunds at most 20
payments a day through these tools.

Each tool carries MCP annotations. `readOnlyHint` is set on the tools that only read.
`destructiveHint` is set only on `set_community_published`, `set_product_published`,
`cancel_subscription` and `refund_payment`, which overwrite, end or pay back something; tools that add
something new do not carry it. `idempotentHint` is set on the read-only tools and on the creates
deduplicated under [Retries](#retries).

Access tokens last one hour and refresh tokens 30 days. Calls share the account's
[rate limit](/developers/api/v1#rate-limits) with the REST API: 120 a minute and 3000 an hour.
The MCP server accepts OAuth tokens only; API keys work on the REST API. Removing the connector in
your client stops it from calling Insy, and disconnecting the app under
[Connected apps](https://insy.io/account/connected-apps) revokes its tokens.

### Confirming consequential operations

These tools run in two calls on the account server:

| Tool | Asks for confirmation |
| --- | --- |
| `set_community_published`, `set_product_published` | When the call would change the current state. |
| `add_product_variant` | When the product is already published, so the price goes live at once. |
| `cancel_subscription` | When there is an active subscription to cancel. |
| `create_support_case` | Always. |
| `report_problem` | When the community or product exists. |
| `get_telegram_join_link` | When the community exists. |

When a call would change nothing — the community is already in that state, there is no
subscription — the tool runs straight away and answers for itself (`unchanged`, `not_found`).

The first call changes nothing: it returns `confirmationRequired: true`, a `summary` of the effect,
a `confirmationToken` and `expiresInSeconds` (10 minutes). Show the summary to the person, and only
after they agree call the same tool again with the same arguments plus `confirmationToken`. A token
is single-use and bound to the account, the tool and the arguments; anything else returns
`confirmation_invalid`.

> **What a confirmation token proves**
>
> A token guarantees that exactly the arguments it was issued for run, and only once. It cannot
> prove that a person saw the summary: the token goes back to the MCP client, and from there to the
> model. Whether the person is asked is up to the client — show the `summary` and wait for an answer
> before sending the token.

If the confirmed call times out, retry it with the **same token and the same arguments**: for 10
minutes after the token was used, the retry gets what the first call came to instead of
`confirmation_invalid` — its result, the earlier identical create's result it was answered with,
or the same error if it failed. If the token's call waited on an identical call that was still
running, the retry gets that call's result once it finishes; if that call was refused before it
changed anything (for example missing billing details), the retry gets `action_not_completed` —
nothing was done, so ask the person again. While that call is still running, or its outcome is
unknown, the retry gets `action_pending`. It never runs twice.

### Retries

Tools that create something — `add_product_variant` and `create_support_case` — are idempotent
for 10 minutes: the same call with the same arguments returns the first result instead of creating
a duplicate. There is no idempotency key to manage; retrying a timed-out call is safe within that
window. (Over REST, where two identical creates may both be meant, you opt in with an
[`Idempotency-Key`](/developers/api/v1#retries-and-idempotency) header instead.)

Confirmations are an MCP step: the REST endpoints run in one call, because there the request comes
from code someone wrote on purpose, not from a model choosing a tool.

### Write budgets

Some writes reach people — the Insy team, a seller — so each account may run them only so often,
whatever the channel (MCP, the REST API or the Insy assistant):

| Tool | Budget |
| --- | --- |
| `create_support_case` | 5 an hour |
| `report_problem` | 5 a day (24 hours) |
| `get_telegram_join_link` | 10 an hour |

Over the budget the tool returns `tool_budget_exceeded` with roughly how many minutes to wait. A
retry that is answered from the idempotency or confirmation record does not count.

### Errors

A tool that fails returns `isError: true` with the code and message in `structuredContent`
(`error`, `message`). An unexpected failure is `failed`, and its message carries a reference you
can quote to Insy support. Do not retry it blindly: the operation may have partly run.

## When sign-in fails

| What you see | What happened |
| --- | --- |
| `invalid_redirect_uri` from `/oauth/register` | The client asked to return to an address that is not `https`, loopback `http` or an app scheme. |
| `code_challenge is required for public clients` | The client did not use PKCE. Every self-registered client must. |
| `temporarily_unavailable` from `/oauth/register` | A registration limit was reached. Try again later. |
| `invalid_grant` | The authorization code expired (it lives one minute) or was already used, or the refresh token is no longer valid — including after a reused refresh token revoked all of the app's tokens. Reconnect. |
| `invalid_target` | The client sent a `resource` other than `https://api.insy.io/mcp`, or one that differs from the resource the code or refresh token was issued for. |
| `invalid_token` on `/mcp` | The access token expired, or was revoked (for example by disconnecting the app). A client normally refreshes on its own; if not, reconnect. |

## Plain files for agents

Without an MCP client, [`/llms.txt`](https://docs.insy.io/llms.txt) indexes every page,
[`/llms-full.txt`](https://docs.insy.io/llms-full.txt) has all of them in one file, and adding
`.md` to any page URL returns its Markdown.

## Newsletter drafts

The account MCP server supports newsletter preparation for accounts with newsletters enabled.
Request `newsletters.read` for reading and `newsletters.drafts.write` for preparing drafts.
Existing tokens need a new consent grant for these permissions.

| Tool | Purpose |
| --- | --- |
| `list_newsletters` | Paginated newsletter summaries owned by the signed-in account. |
| `get_newsletter` | Content, status and a link to review in the panel. |
| `get_newsletter_stats` | Aggregate delivery and engagement results. Delivery does not prove inbox placement. |
| `get_newsletter_clicked_links` | Aggregate results per link. |
| `get_newsletter_readiness` | On-demand audience and sending-blocker check; does not send. |
| `create_newsletter_draft` | Create a draft with a name, subject and preheader. |
| `update_newsletter_draft` | Edit a draft's name, subject and preheader. |
| `send_newsletter_test` | Send a proof to the verified account email; requires separate `newsletters.test.send` consent. |
| `import_newsletter_html` | Replace draft content with a complete HTML email and optional plain text; return validation findings. |

The HTML import switches the draft to raw HTML mode and replaces its editor document.
Include the required footer and unsubscribe markup. Invalid content can be saved for editing,
but validation errors block sending. Creating a draft can inherit sender defaults from the
account's previous newsletter; review the sender and audience in the panel.

Draft permissions cannot send, schedule, delete newsletters, or change recipient
lists. A separate `newsletters.test.send` permission exposes `send_newsletter_test`: one
real SES email with a `[TEST]` subject prefix to the authenticated owner's verified email
only. The tool accepts no recipient address, is limited to three calls per hour, and
does not change campaign status or create a recipient snapshot. This scope is off by
default on consent. Use a proof only when the owner requests it. After an uncertain
delivery, check the inbox before retrying; reuse the same `expectedReviewRevision` from `get_newsletter`. Repeats of the same
newsletter/revision are deduplicated for ten minutes; an edited revision sends a new
proof. Stale revisions are rejected before SES is called. Scheduled and sent newsletters cannot be edited. **The account owner reviews and sends
from the newsletter panel.** Only the account MCP exposes these tools; they are not part of the
admin MCP, the REST Account API, the embedded assistant or Chatwoot.

### Images and owner review

Photos, banners and screenshots can be included with standard HTML `img` elements and
HTTPS URLs on `cdn.insy.io`. External resource hosts, `srcset`, CSS imports and embedded
images are rejected for raw HTML, including Outlook backgrounds. Review frames also
block external resources through CSP. The newsletter editors upload images using the `mailing_content`
target to the public Cloudflare R2 bucket, served through `cdn.insy.io`. Use the permanent
URL returned by that upload, with descriptive `alt` text and responsive sizing. The admin
editor uses the CDN image resizer to deliver a smaller JPEG. Do not embed local paths,
blob URLs, CID attachments or base64 data; the raw newsletter sender does not attach files.
The MCP HTML importer accepts existing image URLs; it does not upload binary images.

`get_newsletter_readiness` is limited to ten calls per account per hour. Clicked links are
paginated. The HTML-import request and newsletter-content response have a 5 MiB transport
cap; ordinary MCP calls retain their smaller limits. HTML remains limited to 500,000
characters and plain text to 200,000. Existing rendered-email size checks still apply.

Before sending or scheduling in either panel, the owner sees a frozen, server-rendered content preview using the same body renderer as SES (with
placeholder personalization and no tracking).
The request includes its `expectedReviewRevision`. The backend compares it again under a
database row lock before queuing recipients. If content, sender or audience selection
changed, the owner must open a new preview. Draft tools do not request confirmation for
each edit; they still cannot send or schedule. The permission covers the account's drafts,
including drafts created manually.

Existing dynamically registered OAuth clients may need re-registration or an explicit
update of their allowed scopes before requesting newsletter consent. Existing tokens are
never upgraded automatically. Administrator read access starts switched off on consent.


## INSY Discord editorial posts

`publish_insy_discord_post` requires explicit `editorial.discord.publish` consent and a
current super administrator role. It is only available on the isolated `/admin/mcp` endpoint, through a separate
editorial connection. It grants no `admin.read` access; ordinary `/mcp` exposes no
publishing tool. The scope is
excluded from default client registration and is switched off by default on consent;
request it explicitly when registering the editorial client for `/admin/mcp`.

The only destinations are INSY's `news` and `changelog` channels, checked against the
platform guild before posting. Supply the title, description, product/docs link and
optional `cdn.insy.io` image. Changelog posts must link to `docs.insy.io`.

The first call returns a full preview and `confirmationToken`. Show the exact post and
channel to the owner and wait for explicit approval, then repeat identical arguments
with that token. Approval of a newsletter or docs publication is not Discord approval.
The server binds the token to the user, tool and arguments; the client must obtain the
human's decision rather than automatically consuming the token. No routine may publish.

Posts use the existing platform bot, suppress all mentions, and do not crosspost to
followers. They are limited to five per account per hour and identical retries are
deduplicated. On an unknown delivery outcome, check the channel before retrying. No
Discord token or webhook is given to the agent. The platform bot must already have
View Channel, Send Messages and Embed Links permissions in both destination channels.
