npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

bonum-psp-mcp

v0.2.0

Published

Unofficial MCP server for Bonum PSP V2 — check payments, verify webhooks and test your webhook endpoint from Claude Code, Codex, Cursor and other MCP clients

Readme

bonum-psp-mcp

English | Монгол

npm CI license

An MCP server for Bonum PSP V2 and Bonum Gateway invoices. It lets your AI coding agent check payments, create invoices with a checkout link (QPay, cards and more), explain why a webhook was rejected, and test your webhook endpoint with genuine, forged, stale and duplicate webhooks. It works with Claude Code, Codex, Cursor, Claude Desktop, VS Code and any other MCP client. The server is the same everywhere; only the config differs.

It cannot submit Apple Pay or Google Pay payments, because wallet tokens only come from a real device. To build the integration, use the bonum-psp SDK.

Quick start

You need Node.js 22.12 or later. Add the server to Claude Code with your sandbox credentials:

claude mcp add --env BONUM_MERCHANT_KEY=... --env BONUM_WEBHOOK_SECRET=... \
  --env BONUM_GATEWAY_APP_SECRET=... --env BONUM_GATEWAY_TERMINAL_ID=... \
  --env BONUM_GATEWAY_CHECKSUM_KEY=... --env BONUM_ENV=sandbox \
  --transport stdio bonum -- npx -y bonum-psp-mcp

Then ask: "Check my Bonum connection." or "Create a 5000 MNT invoice."

Payments and invoices use different credentials. Leave out the ones you don't use:

  • Payments (PSP V2): BONUM_MERCHANT_KEY and BONUM_WEBHOOK_SECRET.
  • Invoices (Bonum Gateway): BONUM_GATEWAY_APP_SECRET and BONUM_GATEWAY_TERMINAL_ID for create_invoice and list_payment_providers, plus BONUM_GATEWAY_CHECKSUM_KEY for verify_invoice_webhook. All three come from the Bonum merchant portal.

Every variable is optional. A tool whose credentials are missing explains how to set them; the other tools still work.

Setup per client

Give the MCP server sandbox credentials only. See the safety model for why. The examples for the other clients show the payment keys; add the BONUM_GATEWAY_* variables the same way to use the invoice tools.

Claude Code

claude mcp add --env BONUM_MERCHANT_KEY=... --env BONUM_WEBHOOK_SECRET=... \
  --env BONUM_GATEWAY_APP_SECRET=... --env BONUM_GATEWAY_TERMINAL_ID=... \
  --env BONUM_GATEWAY_CHECKSUM_KEY=... --env BONUM_ENV=sandbox \
  --transport stdio bonum -- npx -y bonum-psp-mcp
  • By default the server is added for the current project and only for you (--scope local). Add --scope user to use it in all your projects.
  • Keep another option (here --transport stdio) between the last --env and the name bonum. Otherwise the CLI reads the name as one more KEY=value pair.
  • Run /mcp inside Claude Code to see the server's status and tools.

Changing the keys

claude mcp add never replaces a server that already exists: it stops with "MCP server bonum already exists". Remove the server, then add it again with all the values you want. read -s keeps the secrets out of your shell history. The terminal id is not a secret, so it is typed directly. Drop the lines for the credentials you don't use:

claude mcp remove bonum -s local
read -s BONUM_MERCHANT_KEY     # paste the key and press Enter; nothing is shown
read -s BONUM_WEBHOOK_SECRET
read -s BONUM_GATEWAY_APP_SECRET
read -s BONUM_GATEWAY_CHECKSUM_KEY
claude mcp add --env BONUM_MERCHANT_KEY="$BONUM_MERCHANT_KEY" \
  --env BONUM_WEBHOOK_SECRET="$BONUM_WEBHOOK_SECRET" \
  --env BONUM_GATEWAY_APP_SECRET="$BONUM_GATEWAY_APP_SECRET" \
  --env BONUM_GATEWAY_TERMINAL_ID=... \
  --env BONUM_GATEWAY_CHECKSUM_KEY="$BONUM_GATEWAY_CHECKSUM_KEY" --env BONUM_ENV=sandbox \
  --transport stdio bonum -- npx -y bonum-psp-mcp

Then restart Claude Code, or reconnect bonum in /mcp: a running server keeps its old values. Ask "Check my Bonum connection." to see which values are set (never the values themselves).

Claude Code: team setup with .mcp.json

Commit this .mcp.json to the project root. Each developer keeps their own secrets in their shell environment:

{
  "mcpServers": {
    "bonum": {
      "type": "stdio",
      "command": "npx",
      "args": ["-y", "bonum-psp-mcp"],
      "env": {
        "BONUM_MERCHANT_KEY": "${BONUM_MERCHANT_KEY}",
        "BONUM_WEBHOOK_SECRET": "${BONUM_WEBHOOK_SECRET}",
        "BONUM_GATEWAY_APP_SECRET": "${BONUM_GATEWAY_APP_SECRET}",
        "BONUM_GATEWAY_TERMINAL_ID": "${BONUM_GATEWAY_TERMINAL_ID}",
        "BONUM_GATEWAY_CHECKSUM_KEY": "${BONUM_GATEWAY_CHECKSUM_KEY}",
        "BONUM_ENV": "${BONUM_ENV:-sandbox}"
      }
    }
  }
}

Claude Code fills in ${VAR} from the environment it was started in, and asks each developer to approve project servers before first use. If a variable is unset, Claude Code passes the literal ${VAR} text. The server recognizes that, ignores the value, and check_connection tells you which variable to export. Don't use claude mcp add --scope project for secrets: it writes the values into .mcp.json.

Codex

The Codex CLI, IDE extension and app share one configuration:

codex mcp add bonum --env BONUM_MERCHANT_KEY=... --env BONUM_WEBHOOK_SECRET=... --env BONUM_ENV=sandbox -- npx -y bonum-psp-mcp

That command stores the values in ~/.codex/config.toml. To keep secrets out of the file, edit ~/.codex/config.toml (or .codex/config.toml in a trusted project) instead, and forward them from your shell:

[mcp_servers.bonum]
command = "npx"
args = ["-y", "bonum-psp-mcp"]
env_vars = ["BONUM_MERCHANT_KEY", "BONUM_WEBHOOK_SECRET"]  # forwarded from your shell
default_tools_approval_mode = "writes"                     # read-only tools run without prompts

[mcp_servers.bonum.env]
BONUM_ENV = "sandbox"

With "writes", Codex asks before tools that are not marked read-only. Here that is only send_test_webhook, which sends requests to your endpoint.

Claude Desktop

Open Settings → Developer → Edit Config, or edit claude_desktop_config.json directly (~/Library/Application Support/Claude/ on macOS, %APPDATA%\Claude\ on Windows):

{
  "mcpServers": {
    "bonum": {
      "command": "npx",
      "args": ["-y", "bonum-psp-mcp"],
      "env": {
        "BONUM_MERCHANT_KEY": "mk_test_example",
        "BONUM_WEBHOOK_SECRET": "test_webhook_secret",
        "BONUM_ENV": "sandbox"
      }
    }
  }
}

Replace the placeholders with your sandbox values; Claude Desktop does not expand variables. Restart Claude Desktop afterwards. If it cannot find npx (common with nvm), use the absolute path from which npx as the command.

Cursor

Use .cursor/mcp.json in the project, or ~/.cursor/mcp.json for every project. Cursor reads ${env:NAME} from your environment:

{
  "mcpServers": {
    "bonum": {
      "type": "stdio",
      "command": "npx",
      "args": ["-y", "bonum-psp-mcp"],
      "env": {
        "BONUM_MERCHANT_KEY": "${env:BONUM_MERCHANT_KEY}",
        "BONUM_WEBHOOK_SECRET": "${env:BONUM_WEBHOOK_SECRET}",
        "BONUM_ENV": "sandbox"
      }
    }
  }
}

VS Code

VS Code's .vscode/mcp.json uses servers rather than mcpServers. It can prompt for secrets once and store them securely:

{
  "inputs": [
    {
      "type": "promptString",
      "id": "bonum-merchant-key",
      "description": "Bonum sandbox merchant key",
      "password": true
    },
    {
      "type": "promptString",
      "id": "bonum-webhook-secret",
      "description": "Bonum sandbox webhook secret",
      "password": true
    }
  ],
  "servers": {
    "bonum": {
      "type": "stdio",
      "command": "npx",
      "args": ["-y", "bonum-psp-mcp"],
      "env": {
        "BONUM_MERCHANT_KEY": "${input:bonum-merchant-key}",
        "BONUM_WEBHOOK_SECRET": "${input:bonum-webhook-secret}",
        "BONUM_ENV": "sandbox"
      }
    }
  }
}

Any other MCP client

Run npx -y bonum-psp-mcp as a stdio server, with the environment variables below. Or install it once with npm install -g bonum-psp-mcp and run bonum-psp-mcp.

Configuration

| Variable | Needed for | Default | | ---------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | --------- | | BONUM_MERCHANT_KEY | The payment tools (check_connection, get_payment*, wait_for_payment_result) | — | | BONUM_WEBHOOK_SECRET | The webhook tools (verify_webhook, create_test_webhook, send_test_webhook) | — | | BONUM_ENV | Which Bonum APIs the payment and invoice tools call: sandbox or production | sandbox | | BONUM_BASE_URL | A proxy in front of Bonum's API (https:, or http: for localhost) | — | | BONUM_MCP_ALLOW_REMOTE_WEBHOOK_TARGETS | Letting send_test_webhook reach hosts other than local ones | false | | BONUM_GATEWAY_APP_SECRET | The invoice tools (create_invoice, list_payment_providers), with the terminal id; from the Bonum merchant portal | — | | BONUM_GATEWAY_TERMINAL_ID | The invoice tools, with the app secret | — | | BONUM_GATEWAY_CHECKSUM_KEY | verify_invoice_webhook | — | | BONUM_GATEWAY_BASE_URL | A proxy in front of the Bonum Gateway API | — |

The server always starts. A missing or invalid value switches off only the tools that need it, and those tools explain what to set. check_connection lists every configuration warning, and the server prints them to stderr at startup. Values are trimmed, and are never printed.

Tools

| Tool | What it does | Needs | Hints | | ------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------- | ---------------------------- | | check_connection | Shows the environment, base URL and which credentials are set (yes/no only). Proves the key works by looking up a random payment id: Bonum answers 404 for a valid key and 401 for an invalid one. Start here. | — | read-only, idempotent | | get_payment | Gets a payment by Bonum paymentId (UUID), with isTerminal and a normalized currency. | key | read-only, idempotent | | get_payment_by_order_id | The same, by your order_id. | key | read-only, idempotent | | wait_for_payment_result | Waits up to waitMs (1–28 000, default 25 000) for the bank's answer to a PENDING payment. | key | read-only | | verify_webhook | Checks a captured webhook (exact raw body, X-PSP-Signature, X-PSP-Timestamp) and explains any failure. ignoreTimestamp replays old captures. | secret | read-only, idempotent, local | | create_test_webhook | Signs a realistic AUTHORIZED or FAILED webhook and returns the body, headers and a ready curl command. The signature is valid for 5 minutes. | secret | read-only, local | | send_test_webhook | Sends test webhooks to your endpoint and grades each answer. Scenarios: authorized, failed, duplicate, invalid_signature, stale_timestamp or all (default). | secret | sends requests, local | | create_invoice | Creates a Bonum Gateway invoice and returns its checkout link (followUpLink). amount in MNT; optional transactionId (generated when omitted), expiresIn (default 3600 s), callbackUrl, providers, items, language. | gateway credentials | creates an invoice | | list_payment_providers | Lists the payment methods (QPay, cards, WeChat Pay, …) and whether each is enabled for your terminal. | gateway credentials | read-only, idempotent | | verify_invoice_webhook | Checks a captured invoice webhook (exact raw body and X-Checksum-V2) and explains any failure. | checksum key | read-only, idempotent, local |

send_test_webhook expects a 2xx for genuine events, for both copies of a duplicate, and a 4xx for the forged and the 10-minute-old webhook. A 2xx for either of those is reported as a security failure: anyone could fake a payment. A 5xx where a 4xx is expected is a warning, because Bonum would keep retrying.

Payment results carry environment. With BONUM_ENV=production, their text starts with a production warning.

Bonum reports an invoice's result only by webhook, to the URL registered in the merchant portal, and offers no status lookup for invoices. Ask the agent to verify a captured invoice webhook with verify_invoice_webhook. check_connection also checks the gateway credentials.

Resources and prompts

Resources (Markdown, written for this project; each links to Bonum's official pages):

| URI | Contents | | ---------------------------- | --------------------------------------------------------------------------------------------------------- | | bonum://guides/integration | The V2 flow, keeping the key on the server, Apple Pay and Google Pay with waitForResult, reconciliation | | bonum://guides/webhooks | Verification, raw body per framework, two-level idempotency, the retry schedule, local testing | | bonum://reference/api | Endpoints, fields, statuses and errors | | bonum://checklists/go-live | What to check before taking real payments |

In Claude Code, mention one with @bonum:bonum://guides/webhooks.

Prompts:

| Prompt | Arguments | What it does | | -------------------------- | -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | | integrate_bonum | framework (express, nextjs, hono, fastify, nestjs, other), wallets (apple, google, both) | Adds bonum-psp to the current project, then validates the webhook with send_test_webhook. | | debug_webhook | symptom | Walks through raw body, secret and environment, clock skew, proxies and global JSON parsers, using verify_webhook. | | review_bonum_integration | — | Audits an existing integration against the go-live rules. |

In Claude Code, prompts are slash commands: /mcp__bonum__integrate_bonum nextjs both.

Example requests

  • "Check my Bonum connection."
  • "What's the status of order ORD-1001?"
  • "Wait for payment 3f0c2c8e-… to finish."
  • "Test my webhook at http://localhost:3000/webhooks/bonum."
  • "My webhook says signature mismatch. Here are the raw body and headers I logged: …"
  • "Create a signed FAILED test webhook for order ORD-7 and give me the curl command."
  • "Create a 5000 MNT invoice and give me the payment link."
  • "Which payment methods are enabled on my Bonum terminal?"

Safety model

  • One write, on request. The payment tools only look payments up. The only tool that creates something at Bonum is create_invoice. It is not marked read-only, so clients ask before running it, and its description tells the agent to confirm the amount. No tool submits, refunds or cancels anything.
  • Secrets only from the environment. No tool takes a key or secret as an argument, and none repeats one. As a last line of defense, every output passes through a redactor that removes the configured key and secrets (merchant key, webhook secret, gateway app secret and checksum key).
  • Test webhooks stay local. send_test_webhook only accepts http/https URLs without credentials, and by default only these hosts: localhost, 127.0.0.1, [::1], *.localhost and *.test. Anything else needs BONUM_MCP_ALLOW_REMOTE_WEBHOOK_TARGETS=true. It never follows redirects, and gives up on each request after 10 seconds, Bonum's own limit.
  • No signing for production. With BONUM_ENV=production, create_test_webhook and send_test_webhook refuse to run. BONUM_ENV only picks the API host, though, so the real protection is to never give this server your production webhook secret: anyone who can talk to your agent could forge valid production webhooks with it.
  • Honest hints. Tools that only read are marked read-only, so clients can run them without asking. send_test_webhook is not, so clients ask before it sends anything.
  • Quiet on stdout. The server logs only to stderr; stdout carries the MCP protocol.

Debugging

  • Start with check_connection: it shows what the server sees, and every configuration warning.

  • The server prints one startup line to stderr, such as 0.1.0 serving MCP on stdio; Bonum sandbox (https://testpsp.bonum.mn); merchant key set, webhook secret set. Claude Code shows server errors in /mcp. Claude Desktop writes server logs to ~/Library/Logs/Claude/ on macOS.

  • Explore the server with the MCP Inspector:

    npx @modelcontextprotocol/inspector -e BONUM_ENV=sandbox npx -y bonum-psp-mcp
  • npx -y bonum-psp-mcp --help lists the variables, and --version prints the version.

Use as a library

The package also exports the server factory. You can embed the server, serve it over HTTP, or test it in-process:

import { createBonumMcpServer, depsFromEnv } from 'bonum-psp-mcp';
import { serveStdio } from '@modelcontextprotocol/server/stdio';

const deps = depsFromEnv(process.env); // never throws; problems become deps.warnings
serveStdio(() => createBonumMcpServer(deps));

License

MIT © 2026 Jack Infinite