Skip to main content
Glama
paystack-readonly-mcp

paystack-readonly-mcp

by pushthev1be
README.md
# paystack-readonly-mcp

A read-only [MCP](https://modelcontextprotocol.io) server for [Paystack](https://paystack.com) that **works with live keys**.
Ask Claude, Cursor, Gemini CLI or any MCP client things like *"did this customer's payment go through?"*,
*"why didn't this subscription renew?"* or *"what did we settle this week?"*, against your real account,
with no way for the AI to move money.

Paystack's official MCP server only accepts test keys, because it can call every endpoint, including
refunds and transfers. This one takes the opposite approach: it can read your live data, and it physically
cannot do anything else.

## What makes it safe on a live key

- **Fixed allowlist of 19 read endpoints.** There is no generic "make a request" tool. It cannot charge,
  refund, transfer, create, update or cancel anything, whatever arguments it is given.
- **"GET" is not trusted on its own.** Some Paystack GET endpoints change state
  (`/bulkcharge/pause/{code}`, `/bulkcharge/resume/{code}`), so they are not on the list.
- **Card authorization codes are masked** (`authorization_code`, `signature`) in every response. With your
  secret key, an authorization code can charge a saved card, so it should never end up in a chat log.
  Last4, card type and bank still show.
- **Your key only goes to `api.paystack.co`.** It is scrubbed from error messages and never returned.
- **Ids are validated** (no `/`, no `..`), and unknown arguments are dropped.
- **Runs on your machine.** Your key never touches anyone else's server.

Every tool description starts with `[Paystack live, read-only]` or `[Paystack test, read-only]`, so you
always know which account you're reading.

## Tools

| Area | Tools |
|---|---|
| Transactions | `list_transactions`, `get_transaction`, `verify_transaction`, `transaction_timeline`, `transaction_totals` |
| Customers | `list_customers`, `get_customer` |
| Subscriptions | `list_plans`, `get_plan`, `list_subscriptions`, `get_subscription` |
| Money | `get_balance`, `balance_ledger`, `list_settlements`, `settlement_transactions` |
| Problems | `list_refunds`, `get_refund`, `list_disputes`, `get_dispute` |

Amounts are in the smallest currency unit (kobo for NGN: ₦1 = 100). Endpoints and parameters follow
Paystack's own OpenAPI spec.

## Setup

You need Node.js 20 or newer and a Paystack **secret** key (Settings → API Keys & Webhooks).

Store the key in a file that holds only the key, outside any git repo, for example
`~/.paystack/live_key` (Windows: `C:\Users\you\.paystack\live_key`). That keeps it out of your MCP
config files. You can also pass it as `PAYSTACK_SECRET_KEY` instead.

**Claude Code**

```sh
claude mcp add paystack --scope user \
  -e PAYSTACK_KEY_FILE=/home/you/.paystack/live_key \
  -- npx -y paystack-readonly-mcp
```

**Claude Desktop, Cursor, and other JSON configs**

```json
{
  "mcpServers": {
    "paystack": {
      "command": "npx",
      "args": ["-y", "paystack-readonly-mcp"],
      "env": { "PAYSTACK_KEY_FILE": "/home/you/.paystack/live_key" }
    }
  }
}
```

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

```toml
[mcp_servers.paystack]
command = "npx"
args = ["-y", "paystack-readonly-mcp"]
env = { PAYSTACK_KEY_FILE = "/home/you/.paystack/live_key" }
```

Restart your client, then try: *"List my last 5 successful Paystack transactions."*

## Things to know

- Responses include your customers' names and emails, so the conversation that uses this tool contains
  customer data. Use it with an AI provider and account you trust with that.
- Refunds, cancellations and payouts stay in the Paystack dashboard, where you approve them yourself.
- `PAYSTACK_BASE_URL` exists only for tests and only accepts `localhost`.

## Development

```sh
npm install
npm test   # 30 checks against a local stand-in for Paystack; never calls the real API
```

## License

MIT © Simon Olawuyi. Not affiliated with or endorsed by Paystack.