Skip to main content
Glama
Billstrato MCP Server

Billstrato MCP Server

Official
by billstrato
README.md
# @billstrato/mcp

The [Billstrato](https://billstrato.com) MCP server. It lets coding agents (Claude Code, Cursor, Codex, Windsurf and every other MCP client) integrate Billstrato the way a careful developer would: read the docs, look facts up in the atlas, set up the catalog, look up customers and test billing in the sandbox.

```bash
npx -y @billstrato/mcp
```

## Install

Get a **sandbox** secret key (`sk_test_…`) in the Billstrato console under Keys. Without a key the docs tools still work.

**Claude Code**

```bash
claude mcp add billstrato -e BILLSTRATO_SECRET_KEY=sk_test_… -- npx -y @billstrato/mcp
```

**Cursor** (`.cursor/mcp.json`), **Windsurf** (`~/.codeium/windsurf/mcp_config.json`), **Claude Desktop** and other JSON-configured clients

```json
{
  "mcpServers": {
    "billstrato": {
      "command": "npx",
      "args": ["-y", "@billstrato/mcp"],
      "env": { "BILLSTRATO_SECRET_KEY": "sk_test_…" }
    }
  }
}
```

**Codex** (`~/.codex/config.toml`)

```toml
[mcp_servers.billstrato]
command = "npx"
args = ["-y", "@billstrato/mcp"]
env = { BILLSTRATO_SECRET_KEY = "sk_test_…" }
```

Then tell your agent: *"I want Billstrato."* The [prompt in the agent kit](https://github.com/billstrato/billstrato-agent-kit/blob/main/PROMPT.md) gives it the whole workflow.

## Tools

| Tool | What it does | Key |
|---|---|---|
| `search_docs` | Full-text search over all docs, the API reference and the atlas | none |
| `get_atlas` | Events with payloads, subscription states and transitions, every error code with what to do, provider limits, retry rules, edge cases | none |
| `generate_integration_plan` | Step-by-step plan with code for `nextjs`, `node`, `react`, `go`, `python`, `flutter`, `ios`, `android` | none |
| `verify_webhook_signature` | Checks a `Billstrato-Signature` header against a raw body and secret | none |
| `get_project` | Project, environment, rights of the key, setup progress | any |
| `list_catalog` | Entitlements, products with prices, offerings | any |
| `upsert_entitlement`, `upsert_product`, `upsert_offering` | Declarative catalog writes | sandbox; production with `confirm: "production"` |
| `get_customer` | Entitlements, credits, subscriptions, orders of one customer | any |
| `adjust_credits` | Grant or consume credits (idempotent) | sandbox only |
| `simulate_scenario` | Play renewal, billing issue, refund, chargeback, Family Sharing … without a provider | sandbox only |
| `create_checkout_link` | A hosted checkout URL for a customer and price | sandbox; production with `confirm: "production"` |

Errors come back with the atlas' "what to do" for their code.

## Safety

- Sandbox keys (`sk_test_…`) work right away.
- Live keys (`sk_live_…`) are refused unless the human sets `BILLSTRATO_ALLOW_PRODUCTION=1`. Even then every production write needs `confirm: "production"` in the call, and credits and scenarios stay sandbox-only.
- The key never leaves your machine except towards the Billstrato API. The docs, atlas and OpenAPI spec are bundled in `data/` and searched offline.

## Environment

| Variable | |
|---|---|
| `BILLSTRATO_SECRET_KEY` | `sk_test_…` (or `sk_live_…` with the next one) |
| `BILLSTRATO_ALLOW_PRODUCTION` | `1` to accept a live key |
| `BILLSTRATO_API_URL` | Default `https://api.billstrato.com/api/v1` |

## Development

```bash
npm install           # needs @billstrato/sdk; in the Billstrato monorepo: npm install --no-save ../typescript
npm run typecheck && npm test
npm run bundle-docs   # monorepo only: refresh data/ from the website's sources
BILLSTRATO_TEST_ENV=../.test-env.json npm run test:integration   # against a local API, see ../scripts/setup_test_project.py
```

MIT licensed.