- Hosted (remote) - add PayBridgeNP as a connector in Claude (web, mobile, desktop) or ChatGPT, sign in, and approve access on a consent screen. Nothing to install. This is the only option on mobile. Jump to the hosted setup.
- Local (npm) - run the server on your own machine with a scoped token you generate. Good for Cursor, Claude Code, and VS Code. Jump to the local setup.
api.paybridgenp.com and runs through the same permission checks as our REST API.
Connect a hosted app (Claude web, mobile, ChatGPT)
No install, no token to copy. The app sends you to PayBridgeNP to sign in and approve.- In your assistant’s connector settings, add a custom connector with the URL
https://api.paybridgenp.com/mcp.- Claude: Settings → Connectors → Add custom connector.
- ChatGPT: Settings → Connectors → Add (developer mode).
- The app opens a PayBridgeNP sign-in page. Log in with your merchant account.
- On the consent screen, choose the project, the mode (sandbox or live), and tick exactly the access you want to grant - read-only by default, with write access opt-in per category. Write access needs a Pro plan.
- Approve. You are sent back to the app, connected.
dashboard.paybridgenp.com/mcp - it stops working immediately.
Actions that ask for confirmation (like refunds) are not available over the hosted connector yet, because the confirmation step needs a channel the remote protocol does not have. Use the local server for those, or wait for the confirm-in-chat fallback. Everything else - reads, payment links, billing objects - works.
Run the local server (Cursor, Claude Code, VS Code)
1. Generate a scoped token
Opendashboard.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.
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):
Cursor
Same JSON in.cursor/mcp.json (or via Settings → MCP).
Claude Code
VS Code
.vscode/mcp.json:
Claude web, mobile, or ChatGPT
These use the hosted connector instead of a local token - see Connect a hosted app above.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_payments → get_payment → create_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
70 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 (33 tools)
Write (37 tools)
Every write tool is annotateddestructiveHint. Money-moving tools always elicit confirmation in the host UI before executing.
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.
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 returns403 insufficient_scope at the API gateway, never reaching the handler.
Read scopes (granted by default)
Write scopes (opt in per scope)
Sensitive
Security model
Four overlapping defenses so an agent can’t bankrupt you, and a token leak is contained.1. Scope enforcement
Scopes are enforced on every API route before your request reaches the handler. Tokens created for MCP carry an explicit scope allowlist; classic REST API keys are unscoped and keep full access for backward compatibility.2. Elicitation gates on destructive actions
Money-moving tool calls send an MCPelicitation/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 itsoriginating_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:
4. Per-token rate limits
Three buckets, all per-token:- Total: 60 calls / 60s
- Destructive: 6 calls / 60s
- Elicitation-gated: 2 calls / 60s
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 MCPInitializeRequest.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_emailshows asra***@example.com;customer_phoneshows as***1234. Unmask only by grantingpii: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
Opendashboard.paybridgenp.com/mcp. The Recent activity card shows the last 24h of MCP-originated events:
mcp_token.created/mcp_token.revokedrefund.created(withvia: "mcp",mcp_client_name,api_key_id)checkout_session.createdwebhook_endpoint.created/.updated/.deleted
/logs with the same MCP tagging.
Configuration reference
The MCP server reads two env vars when you run it:
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
- Restart the assistant after editing config - most hosts only re-read MCP configs at startup.
- Run
npx -y @paybridge-np/mcp@latestin a terminal manually. If it errors, the message will tell you what’s wrong (usually a missing or revoked token). - 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
- Confirm-in-chat for write actions over the hosted connector, so refunds and other confirmation-gated tools work without the local server.
- More audit + search tools (
list_audit_logs,search_paybridge). - AP2 mandate hooks for agent-initiated commerce (forward-compat).