Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.paybridgenp.com/llms.txt

Use this file to discover all available pages before exploring further.

The official Model Context Protocol (MCP) server for PayBridgeNP. Lets any MCP-compatible AI assistant - Claude Desktop, Cursor, Claude Code, VS Code, Continue, and (soon) ChatGPT + claude.ai - talk to your PayBridgeNP account through 69 typed tools. The MCP server runs locally as an npm package. Your token never leaves your machine. Tool calls go directly to api.paybridgenp.com over HTTPS - the model only sees JSON results, never your raw API key.
Source code is open at github.com/paybridgenp/paybridgenp-mcp. Audit exactly what runs against your key before installing.

Quickstart

1. Generate a scoped token

Open dashboard.paybridgenp.com/mcp. Click Generate token. The new-token form lets you pick:
  • Description - a label so you can find this token later in the audit log (e.g., “Claude Desktop on my laptop”).
  • Scopes - grouped Read / Write / Sensitive. Read-only is the safe default; opt in to writes per category.
  • Expires - 7d, 30d, 90d, or never. 30d is recommended.
  • Spend cap (paisa, 24h rolling) - auto-prefilled to Rs 50,000 when any write scope is enabled. Hard cap on the rolling 24-hour sum of refunds + checkout sessions originated by this token.
Hit Generate. The raw sk_test_… or sk_live_… token is shown once - copy it immediately. We can’t show it again.

2. Paste into your AI assistant

Claude Desktop

Add to ~/Library/Application Support/Claude/claude_desktop_config.json (macOS) or %APPDATA%\Claude\claude_desktop_config.json (Windows):
{
  "mcpServers": {
    "paybridge": {
      "command": "npx",
      "args": ["-y", "@paybridge-np/mcp@latest"],
      "env": { "PAYBRIDGE_API_KEY": "sk_live_..." }
    }
  }
}
Restart Claude Desktop.

Cursor

Same JSON in .cursor/mcp.json (or via Settings → MCP).
{
  "mcpServers": {
    "paybridge": {
      "command": "npx",
      "args": ["-y", "@paybridge-np/mcp@latest"],
      "env": { "PAYBRIDGE_API_KEY": "sk_live_..." }
    }
  }
}

Claude Code

claude mcp add paybridge \
  --env PAYBRIDGE_API_KEY=sk_live_... \
  -- npx -y @paybridge-np/mcp@latest

VS Code

.vscode/mcp.json:
{
  "servers": {
    "paybridge": {
      "type": "stdio",
      "command": "npx",
      "args": ["-y", "@paybridge-np/mcp@latest"],
      "env": { "PAYBRIDGE_API_KEY": "sk_live_..." }
    }
  }
}

ChatGPT / claude.ai web

Remote (HTTP) MCP requires OAuth - shipping at mcp.paybridgenp.com next. Watch this page for status.

3. Try it

Open your assistant and type something natural:
Refund the last successful payment from customer@example.com.
The agent picks the right tool calls (list_paymentsget_paymentcreate_refund), and PayBridgeNP’s MCP server pops up a confirmation modal asking you to approve the refund before it executes. You see the refund result inline.

What you can ask

The agent figures out the right tool calls. You don’t write them by hand.
  • “Show me payments above Rs 5,000 from this week, grouped by provider.”
  • “Why did the webhook to checkout.acme.com fail yesterday at 3pm?”
  • “Create a payment link for Rs 2,500 titled ‘Course access - December batch’.”
  • “What’s my analytics overview for the last 30 days - gross volume, success rate, refunds?”
  • “List all subscriptions that are past due, with the customer email.”
  • “Pause the subscription for ram@sherpa.com until the end of the month.”

Tools

69 tools across read + write. Read tools cover the entire account surface; write tools cover refunds, checkout creation, payment-link CRUD, webhook CRUD, and the full billing surface - plans, customers, subscriptions, invoices, coupons, promotions, tax, dunning, and usage metering.

Read (31 tools)

ToolScopeWhat it does
get_accountaccount:readMerchant + project + key context (PII masked unless pii:read)
list_payments / get_paymentpayments:readInspect payments with full provider + customer detail
list_refunds / get_refundrefunds:readRefund history, status, failure reason
list_checkout_sessions / get_checkout_sessionsessions:readIn-flight + abandoned checkouts
list_payment_links / get_payment_linklinks:readLinks + view/conversion stats inline
list_webhook_endpoints / list_webhook_deliverieswebhooks:readEndpoint config + per-delivery debug
list_plans / get_planbilling:readSubscription billing plans
list_customers / get_customerbilling:readBilling customers
list_subscriptions / get_subscriptionbilling:readActive + past-due subscriptions
list_invoices / get_invoicebilling:readSubscription invoices
list_coupons / get_couponbilling:readDiscount coupons and their redemption stats
list_promotion_codes / get_promotion_code / validate_promotion_codebilling:readPromotion codes - list, inspect, or validate a code before applying
get_tax_settingsbilling:readActive tax configuration for the account
list_dunning_policies / get_dunning_invoice_statusbilling:readDunning policy definitions + per-invoice dunning state
preview_subscription_prorationbilling:readEstimate the prorated credit/charge before a plan change
get_subscription_usage_summary / list_usage_recordsbilling:readMetered usage totals and raw usage record history
get_analytics_overviewanalytics:readHeadline KPIs (total / success rate / volume / funnel / per-provider) over a 1–90 day window

Write (38 tools)

Every write tool is annotated destructiveHint. Money-moving tools always elicit confirmation in the host UI before executing.
ToolScopeConfirms?
create_checkout_sessionpayments:writeIf amount > 5,000 (paisa: 500,000)
create_refundrefunds:writeAlways
create_payment_linklinks:writeNo
update_payment_linklinks:writeNo
cancel_payment_linklinks:writeNo (soft-deactivate, reversible)
delete_payment_linklinks:writeAlways (only if never used)
create_webhook_endpointwebhooks:writeNo (idempotent create)
update_webhook_endpointwebhooks:writeNo
delete_webhook_endpointwebhooks:writeAlways
create_plan / update_planbilling:writeNo
create_customer / update_customerbilling:writeNo
add_customer_creditbilling:writeNo
create_subscriptionbilling:writeNo
pause_subscription / resume_subscriptionbilling:writeNo
cancel_subscriptionbilling:writeAlways
change_subscription_planbilling:writeNo
end_trial / extend_trialbilling:writeNo
create_invoice_item / delete_invoice_itembilling:writeNo
create_coupon / deactivate_couponbilling:writeNo
create_promotion_code / deactivate_promotion_codebilling:writeNo
apply_coupon_to_subscription / remove_subscription_discountbilling:writeNo
update_tax_settingsbilling:writeNo
create_dunning_policy / update_dunning_policybilling:writeNo
set_subscription_dunning_policybilling:writeNo
stop_invoice_dunningbilling:writeAlways
retry_invoice_dunning_nowbilling:writeNo
report_subscription_usage / update_subscription_quantitybilling:writeNo

Prompts

6 built-in prompt templates that appear as slash commands and menu items in Claude Desktop and Cursor. Select one, fill in any arguments, and the agent picks up from there - no need to remember tool names or craft instructions manually.
PromptWhat it doesArguments
daily_summaryEnd-of-day digest - revenue, payment counts, refunds, checkout funnel completion rate, and any failed webhook deliveriesNone
monthly_reconciliationFull month reconciliation table: gross volume, net after refunds, success rate, provider breakdown, top 5 customers. Ready to share with an accountantmonth (optional, e.g. 2026-04)
investigate_failed_paymentDiagnoses why a payment or batch of payments failed. Checks provider error codes, checkout session funnel, and recommends retry / contact customer / escalatepayment_id (optional) or customer_email (optional)
onboard_customerCreates a billing customer and subscribes them to a plan in one flow. Validates the plan, optionally validates and applies a promotion code, then confirms subscription detailsemail, name, plan_id (required); coupon_code (optional)
review_dunningLists all past-due invoices, shows retry count and next scheduled retry for each, and categorizes them as Retry now / Stop dunning / Wait. Asks for confirmation before actingNone
apply_discountValidates a promotion code, shows the before/after price, then applies the discount to a subscription after confirmationsubscription_id, promotion_code
Prompts are available in any host that supports MCP prompts - Claude Desktop ≥ 0.7, Cursor ≥ 0.42, Claude Code current. In Claude Desktop, open the prompt picker with / and type paybridge to filter to PayBridgeNP prompts.

Scope reference

16 scopes. Tokens hold an explicit allowlist - anything not in the list returns 403 insufficient_scope at the API gateway, never reaching the handler.

Read scopes (granted by default)

ScopeUnlocks
account:readget_account
payments:readlist_payments, get_payment
refunds:readlist_refunds, get_refund
sessions:readlist_checkout_sessions, get_checkout_session
links:readlist_payment_links, get_payment_link
webhooks:readlist_webhook_endpoints, list_webhook_deliveries
billing:readAll list_* / get_* billing tools
analytics:readget_analytics_overview
audit:read(reserved - list_audit_logs shipping next)
docs:read(reserved - search_docs shipping next)

Write scopes (opt in per scope)

ScopeUnlocks
payments:writecreate_checkout_session
refunds:writecreate_refund
links:writecreate_payment_link, update_payment_link, cancel_payment_link, delete_payment_link
webhooks:writewebhook CRUD
billing:writeAll billing CRUD + lifecycle

Sensitive

ScopeEffect
pii:readReturns raw customer_email and customer_phone instead of masked. Never granted by default.

Security model

Four overlapping defenses so an agent can’t bankrupt you, and a token leak is contained.

1. Scope enforcement

Every /v1/* route checks requireApiKeyScope(...) before the handler runs. MCP-kind tokens with explicit scopes get full enforcement; legacy REST API keys retain full access for backward compatibility.

2. Elicitation gates on destructive actions

Money-moving tool calls send an MCP elicitation/create request to the host. The host shows a confirmation modal with the proposed amount, customer, and action. The tool only proceeds on accept. Hosts that don’t support elicitation - usually older clients - fail closed with elicitation_unsupported and an actionable error pointing back to the dashboard. For create_refund, the server hydrates the underlying payment first, so the modal shows the real amount + customer + provider, not just an opaque payment id.

3. 24-hour rolling spend cap

Every checkout session and refund records its originating_api_key_id. Before each POST /v1/checkout and POST /v1/refunds, the server sums the originating spend in the trailing 24 hours; if current + new > spend_cap_paisa, the call is rejected with HTTP 403:
{
  "error": "MCP token spend cap exceeded. Last 24h spend: Rs 400.00, cap: Rs 500.00, remaining: Rs 100.00.",
  "code": "over_spend_cap",
  "spent_paisa": 40000,
  "cap_paisa": 50000,
  "remaining_paisa": 10000,
  "reset_at": "2026-04-19T00:21:12.556Z"
}

4. Per-token rate limits

Three buckets, all per-token:
  • Total: 60 calls / 60s
  • Destructive: 6 calls / 60s
  • Elicitation-gated: 2 calls / 60s
Returns 429 with Retry-After and X-RateLimit-Bucket headers. REST keys are unaffected for back-compat.

Other defenses

  • Audit trail. Every tool call is recorded with mcp.tool.<name>, the token id, and the assistant’s name (captured from the MCP InitializeRequest.clientInfo.name). Visible live in your dashboard.
  • No token passthrough. The MCP server never forwards your token to upstream provider APIs. Khalti / eSewa secrets stay server-side.
  • Prompt-injection defense. Customer-controlled fields (names, descriptions, metadata) are wrapped in <untrusted>…</untrusted> fences when returned to the model. Zero-width characters are stripped. Secret patterns (sk_*, pk_*, whsec_*, Bearer …) are pattern-redacted on the way out.
  • PII masking. customer_email shows as ra***@example.com; customer_phone shows as ***1234. Unmask only by granting pii:read.
  • One-click revoke. Find the token in the dashboard and click the trash icon. The next call returns 401 within seconds.

Audit + activity feed

Open dashboard.paybridgenp.com/mcp. The Recent activity card shows the last 24h of MCP-originated events:
  • mcp_token.created / mcp_token.revoked
  • refund.created (with via: "mcp", mcp_client_name, api_key_id)
  • checkout_session.created
  • webhook_endpoint.created / .updated / .deleted
Premium-plan merchants see the full audit history at /logs with the same MCP tagging.

Configuration reference

The MCP server reads two env vars when you run it:
Env varRequiredDefault
PAYBRIDGE_API_KEYyes-
You can also pass --api-key=sk_live_... as a CLI argument instead of the env var.

Troubleshooting

Tools don’t show up in my assistant

  1. Restart the assistant after editing config - most hosts only re-read MCP configs at startup.
  2. Run npx -y @paybridge-np/mcp@latest in a terminal manually. If it errors, the message will tell you what’s wrong (usually a missing or revoked token).
  3. Check the host’s MCP log. Claude Desktop: ~/Library/Logs/Claude/mcp*.log.

Every tool call returns 401

Token is revoked, expired, or the env var didn’t survive into the host’s environment. Generate a fresh token from the dashboard and replace.

Every write call returns insufficient_scope

Your token is read-only. Generate a new token with the relevant write scopes ticked. Don’t reuse the read-only token - issue a separate write-scoped token with a tight spend cap so you can revoke it independently.

over_spend_cap after running a few refunds

Either raise the cap on the token or wait for the 24h window to roll. The error response includes reset_at - that’s when the oldest counted activity ages out.

elicitation_unsupported on a destructive tool

Your host doesn’t implement MCP elicitation. Update the host (Claude Desktop ≥ 0.7, Cursor ≥ 0.42, Claude Code current), or perform the action in the PayBridgeNP dashboard instead.

Customer names show up wrapped in <untrusted>

That’s deliberate - it tells the model not to interpret merchant-controlled free text as instructions. Defense against prompt injection in metadata / customer fields. Don’t strip the wrappers.

How do I see what the agent is actually doing?

The dashboard’s Recent activity card shows every MCP tool invocation with the assistant’s name, the action, and timestamps. Hosts also typically log tool calls - Claude Desktop shows them inline; Cursor logs them to its dev console.

Roadmap

  • Remote (HTTP) MCP with OAuth 2.1 - unlocks ChatGPT and claude.ai web (parked until demand shows up in token telemetry).
  • Audit + search tools (list_audit_logs, search_paybridge, search_docs).
  • AP2 mandate hooks for agent-initiated commerce (forward-compat).
Track progress at github.com/paybridgenp/paybridgenp-mcp.