# Claude, ChatGPT & MCP Plugin

> Connect Claude, ChatGPT, Codex, and Cursor to Shaw via OAuth 2.1 MCP with Template Code Library pulls, Brand Kit sync, and direct Klaviyo email import.

Shaw exposes a stateless, authenticated Streamable HTTP MCP server at
`https://shaw.ai/mcp` alongside a redistributable `plugin/` directory
([shaw.ai/plugin](https://shaw.ai/plugin)) for Claude Code and Codex. Every MCP
request runs inside your active Shaw organization and enforces OAuth 2.1 + PKCE
scopes, workspace roles, and credit limits.

<McpQuickConnect />

## Connect your AI client [#connect-your-ai-client]

Authorize once via OAuth 2.1 on [Shaw Connect](https://shaw.ai/app/connect)
(default scopes: `org:read`, `pages:read`, `pages:write`, `connectors:read`), or
pass a scoped personal API key (`Authorization: Bearer sk_...`) in headless
clients.

<Tabs items={["Claude.ai", "Claude Code", "ChatGPT", "Codex CLI", "Cursor"]}>
  <Tab value="Claude.ai">

<Steps>
  <Step title="Open Connectors in Claude">
    In Claude.ai or Claude Desktop, go to **Settings → Connectors → Add custom
    connector**.
  </Step>
  <Step title="Enter the Shaw MCP endpoint">
    Paste `https://shaw.ai/mcp` as the remote MCP server URL and choose **Add**.
  </Step>
  <Step title="Approve workspace scopes on Shaw Connect">
    Complete the browser OAuth 2.1 flow at `https://shaw.ai/app/connect` and
    confirm your workspace permissions.
  </Step>
  <Step title="Verify your connection">
    Ask Claude to check your workspace balance and search the catalog—for
    example: `"Check my Shaw credits and find skincare landing pages."`
  </Step>
</Steps>

  </Tab>
  <Tab value="Claude Code">

<Steps>
  <Step title="Load the Shaw plugin bundle or add the remote MCP server">
    Load the repository's `plugin/` bundle (`.claude-plugin/plugin.json`,
    `.mcp.json`, and `skills/shaw/SKILL.md`) via `/plugin` or `--plugin-dir`, or
    register the remote HTTP server globally:

```sh
claude --plugin-dir ./plugin
```

```sh
claude mcp add --transport http --scope user shaw https://shaw.ai/mcp
```

  </Step>
  <Step title="Authenticate via OAuth 2.1">
    Sign in to your Shaw workspace from the terminal:

```sh
claude mcp login shaw
```

  </Step>
  <Step title="Confirm active workspace and credits">
    Start a Claude Code session and ask it to run `get_me` and
    `get_credits_balance` before inspecting templates.
  </Step>
</Steps>

  </Tab>
  <Tab value="ChatGPT">

<Steps>
  <Step title="Enable Developer Mode">
    Open ChatGPT **Settings → Connectors**, enable **Developer Mode**, and
    choose **Add custom MCP server**.
  </Step>
  <Step title="Configure OAuth for Shaw">
    Set the server URL to `https://shaw.ai/mcp` and select **OAuth**
    authentication.
  </Step>
  <Step title="Sign in to your workspace">
    Complete consent on [Shaw Connect](https://shaw.ai/app/connect). ChatGPT
    automatically receives dynamic client registration and `S256` PKCE tokens.
  </Step>
  <Step title="Run a template workflow">
    Prompt ChatGPT to fetch your Brand Kit (`get_brand_kit`), search templates
    (`search_templates`), and inspect credit cost before unlocking source.
  </Step>
</Steps>

  </Tab>
  <Tab value="Codex CLI">

<Steps>
  <Step title="Use the bundled Codex plugin or register the URL">
    Point Codex at `plugin/.codex-plugin/plugin.json` and `plugin/.mcp.json` in
    the Shaw repository, or add `https://shaw.ai/mcp` directly:

```sh
codex mcp add shaw --url https://shaw.ai/mcp
```

  </Step>
  <Step title="Sign in via OAuth">
    Authorize Codex against your Shaw workspace:

```sh
codex mcp login shaw
```

  </Step>
  <Step title="Load the Shaw skill">
    Codex automatically picks up `plugin/skills/shaw/SKILL.md` when using the
    plugin directory so it checks `get_credits_balance` and reports credit cost
    before spending credits.
  </Step>
</Steps>

  </Tab>
  <Tab value="Cursor">

<Steps>
  <Step title="Add Shaw to Cursor MCP config">
    Open `~/.cursor/mcp.json` (or **Cursor Settings → Tools & Integrations →
    MCP Servers**) and register the HTTP endpoint:

```json
{
  "mcpServers": {
    "shaw": {
      "url": "https://shaw.ai/mcp"
    }
  }
}
```

  </Step>
  <Step title="Authenticate with OAuth or a scoped key">
    Follow Cursor's browser OAuth prompt on `https://shaw.ai/app/connect`, or
    add `"headers": { "Authorization": "Bearer sk_..." }` using a scoped key from
    [shaw.ai/app/developers](https://shaw.ai/app/developers).
  </Step>
  <Step title="Verify Shaw tools in Agent mode">
    Confirm `get_me`, `get_credits_balance`, `search_templates`, and
    `use_template` appear in Cursor's active tool list.
  </Step>
</Steps>

  </Tab>
</Tabs>

## End-to-end agent workflow [#end-to-end-agent-workflow]

<SplitSection>
  <SplitProse>

Shaw agents follow a predictable four-step flow that inspects credit headroom
and per-page template size **for free** before committing credits:

1. **Check credit balance & unlocks (`get_credits_balance`).** Read the active
   organization's plan (`free`, `pro`, or `operator`), `monthlyRemainingCredits`,
   `packCreditsRemaining`, total `remainingCredits`, and permanently unlocked
   template pages (`unlockedTemplates`).
2. **Search the catalog (`search_templates`).** Filter by `q`, `channel`
   (`websites`, `emails`, `apps`, `ads`), `category`, or `brand` at `0` credit
   cost.
3. **Inspect per-page credit cost (`get_template`).** Read `codeMetrics`
   (`credits`, `fileCount`), `pages`, and `dna` for candidate `tpl_...` IDs (with
   optional `path`) before asking the user to spend credits. Emails start at
   `2,500` credits minimum, and website/app pages cost `5,000` to `15,000`
   credits per page.
4. **Unlock with explicit confirmation (`use_template` or
   `publish_template_to_klaviyo`).** Pass `confirmed: true` and a concise
   `reason` to unlock the page's HTML and linked CSS bundle—or import an email
   template directly into Klaviyo. Once unlocked, reusing that
   `(templateSlug, pagePath)` across future template versions costs `0` extra
   credits forever (lifetime updates).

When a page requires more credits than `remainingCredits` (and opt-in Auto
Top-Up is off, lacks a saved payment method, or has reached its monthly dollar
cap), Shaw returns status

<StatusBadge code={402} label="Payment Required" /> (`INSUFFICIENT_CREDITS`,
`"You need more credits"`) with an `upgradeUrl` to
[shaw.ai/app/account](https://shaw.ai/app/account). Do not retry automatically.

  </SplitProse>
  <SplitCode title="MCP tool responses (get_credits_balance → use_template)">

<Tabs items={["1. Credits", "2. Search", "3. Detail", "4. Use", "402 Error"]}>
  <Tab value="1. Credits">

```json
{
  "status": 200,
  "body": {
    "ok": true,
    "data": {
      "organizationId": "org_01j9x2m4p7q8w2ab",
      "plan": "free",
      "periodKey": "2026-11",
      "planCredits": 5000,
      "monthlyUsedCredits": 0,
      "monthlyRemainingCredits": 5000,
      "packCreditsRemaining": 0,
      "usedCredits": 0,
      "remainingCredits": 5000,
      "locPerCredit": 1,
      "approxRemainingLoc": 5000,
      "unlockedTemplates": [],
      "packs": [],
      "upgradeUrl": "https://shaw.ai/app/account"
    }
  }
}
```

  </Tab>
  <Tab value="2. Search">

```json
{
  "status": 200,
  "body": {
    "ok": true,
    "total": 14,
    "offset": 0,
    "limit": 1,
    "items": [
      {
        "id": "tpl_k7m2x9p4q1w8",
        "slug": "aura/landing",
        "label": "Aura Botanicals — Launch Landing",
        "channel": "websites",
        "latestVersion": "2026-11-01",
        "url": "https://shaw.ai/templates/tpl_k7m2x9p4q1w8"
      }
    ]
  }
}
```

  </Tab>
  <Tab value="3. Detail">

```json
{
  "status": 200,
  "body": {
    "ok": true,
    "pagePath": "/",
    "template": {
      "id": "tpl_k7m2x9p4q1w8",
      "slug": "aura/landing",
      "latestVersion": "2026-11-01",
      "pages": [{ "label": "Home", "path": "/" }],
      "codeMetrics": {
        "loc": 4200,
        "credits": 5000,
        "codeBytes": 184200,
        "fileCount": 3,
        "estimated": false
      }
    }
  }
}
```

  </Tab>
  <Tab value="4. Use">

```json
{
  "status": 200,
  "body": {
    "ok": true,
    "template": {
      "id": "tpl_k7m2x9p4q1w8",
      "slug": "aura/landing",
      "version": "2026-11-01",
      "path": "/"
    },
    "billing": {
      "chargedCredits": 5000,
      "monthlyChargedCredits": 5000,
      "packChargedCredits": 0,
      "alreadyUnlocked": false,
      "remainingCredits": 0,
      "monthlyRemainingCredits": 0,
      "packCreditsRemaining": 0,
      "planCredits": 5000,
      "periodKey": "2026-11"
    },
    "source": {
      "pagePath": "/",
      "html": "<!doctype html><html>...</html>",
      "stylesheets": [{ "path": "/styles/main.css", "css": ":root{...}" }],
      "truncated": false
    }
  }
}
```

  </Tab>
  <Tab value="402 Error">

```json
{
  "status": 402,
  "body": {
    "ok": false,
    "error": "You need more credits",
    "code": "INSUFFICIENT_CREDITS",
    "message": "You need more credits",
    "requiredCredits": 8500,
    "remainingCredits": 2500,
    "monthlyRemainingCredits": 2500,
    "packCreditsRemaining": 0,
    "planCredits": 5000,
    "usedCredits": 2500,
    "loc": 8500,
    "plan": "free",
    "upgradeAvailable": true,
    "upgradeUrl": "https://shaw.ai/app/account"
  }
}
```

  </Tab>
</Tabs>

  </SplitCode>
</SplitSection>

## Tool domains & API endpoints [#tool-domains--api-endpoints]

Tools register dynamically based on the scopes approved for your OAuth grant or
API key. Tools that mutate workspace state or spend credits require
`confirmed: true` and a `reason` string.

| Domain                     | MCP tools                                                                                                   | Required scopes             |
| -------------------------- | ----------------------------------------------------------------------------------------------------------- | --------------------------- |
| **Organization & Credits** | `get_me`, `get_credits_balance`                                                                             | `org:read`                  |
| **Template Code Library**  | `search_templates`, `get_template`, `list_brands`, `get_template_notes`, `use_template` (`confirmed: true`) | `pages:read`                |
| **Brand Kit**              | `get_brand_kit`, `update_brand_kit`, `import_brand_kit`                                                     | `pages:read`, `pages:write` |
| **Klaviyo Email Import**   | `publish_template_to_klaviyo` (`confirmed: true`)                                                           | `pages:write`               |

<EndpointCard
  method="GET"
  path="/api/credits"
  scope="org:read"
  href="/api-reference/credits"
>
  Read the active workspace billing plan, monthly and pack credits remaining,
  and permanently unlocked template pages.
</EndpointCard>

<EndpointCard
  method="GET"
  path="/api/templates/search"
  scope="pages:read"
  href="/api-reference/templates"
>
  Search catalog metadata and pre-flight credit costs without consuming credits.
</EndpointCard>

<EndpointCard
  method="POST"
  path="/api/templates/use"
  scope="pages:read"
  href="/api-reference/templates"
>
  Permanently unlock one template page using credits (`0` credits once unlocked)
  and return HTML plus linked stylesheets.
</EndpointCard>

<EndpointCard
  method="POST"
  path="/api/email-studio/klaviyo/publish-template"
  scope="pages:write"
  href="/api-reference/email-studio"
>
  Import a library email template directly into Klaviyo as a reusable CODE
  template or draft campaign (spends email credits on first unlock, `0` once
  unlocked, no Pro subscription required).
</EndpointCard>

## Edge-locked archive restrictions [#edge-locked-archive-restrictions]

<Callout type="warn">
  Raw browser-only archive and preview capability routes
  (`/api/templates/zip/*`, `/api/templates/ticket`,
  `/api/templates/remixes/*/view`, and `/api/builder/pages/export`) are
  **session-only** and always return HTTP `403` (`bearer_not_allowed`) to MCP
  and API-key clients. Remix creation endpoints (`/api/templates/remixes/*`) are
  hidden from MCP; inspect metadata via `get_template`, extract metered page
  code via `use_template`, and import library emails directly to Klaviyo via
  `publish_template_to_klaviyo`.
</Callout>

If your account belongs to multiple Shaw organizations, pass the optional
`tenant` parameter on any MCP tool call (or set the `X-Shaw-Tenant` header on
HTTP requests) to target a specific workspace. See
[Monthly credits](/developers/credits) for full metering rules and
[Authentication & API keys](/developers/authentication) for scope and token
details.

