> ## Documentation Index
> Fetch the complete documentation index at: https://docs.pocketsflow.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Windsurf + Pocketsflow

> Connect Windsurf's Cascade agent to the Pocketsflow MCP server and docs to build integrations against the Pocketsflow API.

[Windsurf](https://windsurf.com) is an AI-native editor whose **Cascade** agent
can call tools and edit code. Connect it to the Pocketsflow **MCP server** so
Cascade can act on your account, and add a workspace rule so it writes
integration code correctly.

<Info>
  **Prerequisites**

  * Windsurf installed.
  * A Pocketsflow API key from **Developers → API keys** (use `pk_test_…` while
    building).
</Info>

## Connect the Pocketsflow MCP server

Add the [Pocketsflow MCP server](/api-reference/mcp-server) to Windsurf's MCP
config (Cascade → **MCP servers** → *Configure*, which edits
`~/.codeium/windsurf/mcp_config.json`):

```json theme={null}
{
  "mcpServers": {
    "pocketsflow": {
      "serverUrl": "https://api.pocketsflow.com/mcp",
      "headers": {
        "Authorization": "Bearer pk_test_xxxxxxxxxxxxxxxxxxxxxxxx"
      }
    }
  }
}
```

Refresh the server list in Cascade. It can now run Pocketsflow tools — *"list my
last 10 orders"*, *"create a \$29 product and give me the checkout link"*,
*"cancel subscription sub\_123"*. Each call runs as your account, scoped by the
key.

<Warning>
  The MCP config holds your API key — keep it out of shared repos. Prefer a
  `pk_test_…` key while developing, and never expose `pk_live_…` keys.
</Warning>

## Add a workspace rule

Give Cascade project context and standards. Create `.windsurf/rules/pocketsflow.md`
in your workspace root:

```markdown theme={null}
# Pocketsflow integration rules

## Project
Server-side integration with the Pocketsflow API: create checkout sessions,
redirect buyers, and settle orders from signed webhooks.

## Facts
- Base URL: https://api.pocketsflow.com
- Auth: `Authorization: Bearer <API key>` (`pk_live_…` / `pk_test_…`).
- Keep API keys and webhook signing secrets in env vars, never client-side.

## Checkout
- `POST /checkout/sessions` returns `{ id, url }`; redirect the buyer to `url`.
- Put our own order id in `metadata`; it is echoed back on the order and related
  webhooks for reconciliation.

## Webhooks
- Verify the `X-Pocketsflow-Signature` HMAC-SHA256 over the RAW body.
- Confirm payment from `order.completed`; make handlers idempotent.

## References
- Docs: Integrations → Custom platforms; API & Webhooks → Consuming webhooks.
- Interactive API reference: https://api.pocketsflow.com/docs
```

<Tip>
  Use the **Copy as Markdown** / open-in-editor action in the top-right of any
  docs page to paste an authoritative reference straight into Cascade as
  context.
</Tip>

## Typical workflow

<Steps>
  <Step title="Plan with Cascade">
    Ask Cascade to design the checkout + webhook flow using the workspace rule
    and docs.
  </Step>

  <Step title="Validate via MCP">
    Have it create a test product and checkout session with your `pk_test_…` key.
  </Step>

  <Step title="Exercise the webhook">
    Send a test event and confirm the handler verifies the signature and settles
    the order idempotently.
  </Step>
</Steps>

## Related topics

* [MCP setup guide](/ai-tools/mcp)
* [MCP server](/api-reference/mcp-server)
* [Integrations overview](/integrations/overview)
* [Custom platforms](/integrations/custom-platforms)
* [Consuming webhooks](/api-webhooks/consuming-webhooks)
* [Claude Code + Pocketsflow](/ai-tools/claude-code) · [Cursor + Pocketsflow](/ai-tools/cursor)
