`@cosmoops/connect-sdk` is the official client for the CosmoOps Connect
application-partner API (`/api/v1/application/*`). It covers Login with Connect (OAuth2),
entitlement/readiness gates, plan and subscription reads, usage metering, and
a set of drop-in React components — and nothing outside that surface;
Connect's internal admin API is deliberately out of scope.

```bash
npm install @cosmoops/connect-sdk
```

New here? Start with [Getting started](/docs/getting-started) — a working
Next.js integration in two files.

## Six entry points

The split between them is a security boundary, not a stylistic choice.

| Import | Runs in | Holds the API key |
| --- | --- | --- |
| `@cosmoops/connect-sdk` | anywhere | never — types, `ConnectError`, pure helpers |
| `@cosmoops/connect-sdk/server` | your backend | **yes** |
| `@cosmoops/connect-sdk/next` | your backend | **yes** — Next.js plug-and-play |
| `@cosmoops/connect-sdk/mcp` | your backend | **yes** — your store, as MCP tools |
| `@cosmoops/connect-sdk/client` | the browser | never |
| `@cosmoops/connect-sdk/ui` | either | never — presentational, no `"use client"` |

`@cosmoops/connect-sdk/theme.css` is the seventh and is not code: the one
shared HeroUI theme every component here is drawn against.

The browser half never sees a credential. It calls your own origin, and
`createConnectHandler` — mounted in your backend — is what actually talks to
Connect:

```
Browser  ──►  your backend  ──►  Connect
(client)      (createConnectHandler + server client, holds the key)
```

## Where to go next

- **[Getting started](/docs/getting-started)** — install, wrap two files, done.
  Walks through the same integration [`connect-example`](https://github.com/cosmoops-com/connect-example)
  — the reference Next.js app — actually ships.
- **[Environments](/docs/environments)** — the four environment variables,
  which Connect instance you talk to, and what a local setup needs that a
  deployed one doesn't.
- **[Authentication & authorization](/docs/authentication)** — the OAuth2
  round trip, `proxy.ts` route protection, and role/entitlement-based access
  control.
- **[Webhooks](/docs/webhooks)** — the events Connect sends, how to verify
  them, the retry ladder, and how to debug a delivery that never arrived.
- **[MCP](/docs/mcp)** — register an endpoint of your own, and Connect's
  assistant can answer from inside your product, as the member asking.
- **Concepts** — the four models an integration has to get right:
  [plans and free tiers](/docs/concepts/plans),
  [features and add-ons](/docs/concepts/capabilities),
  [permissions and roles](/docs/concepts/authorization), and the
  [deletion policy](/docs/concepts/deletion-policy) your application declares.
- **[API reference](/docs/api)** — every `/api/v1/application/*` endpoint, by
  module, with the scope each one needs. Generated from the live schema, so it
  cannot drift from what the server accepts.
- **[SDK reference](/docs/reference)** — every type and method across every
  entry point, generated straight from the SDK's own source.