paypal-cli
Provides tools for PayPal developers to manage webhooks and webhook events, send simulated events, create/approve/capture orders, send payouts and check payout status, run credential/feature diagnostics, and explain PayPal API errors.
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
paypal-cli
Unofficial. Not affiliated with, endorsed by or supported by PayPal. "PayPal" is a trademark of PayPal, Inc. Sandbox by default.
A command-line tool and MCP server for PayPal developers. It covers the jobs that usually send you to the developer dashboard or into a throwaway script:
Webhooks: list, create, delete, and print the ID for a URL.
Webhook events: list, show and resend.
Simulated events: send them with
trigger.Orders: create, approve and capture.
Payouts: send, then check batch and item status.
doctor: checks the app's credentials, enabled features and webhook setup.explain: turns a PayPal error into its likely cause and an exact fix. It uses built-in rules first, then Claude.mcp: exposes every operation to AI coding assistants as MCP tools. Money-moving tools need explicit human approval.
$ paypal-cli payouts get 5UXD2E8A7EBQJ
✗ 403 NOT_AUTHORIZED (debug_id 2d6f1b0e3c4a1) GET /v1/payments/payouts/5UXD2E8A7EBQJ
Authorization failed due to insufficient permissions.
Run `paypal-cli explain` for the likely cause and fix.
$ paypal-cli explain
cause: This app does not have the "Payouts" feature, so its token lacks the scope for /v1/payments/payouts/….
fix: Dashboard → Apps & Credentials → your sandbox app → Features → enable "Payouts", save,
then run `paypal-cli doctor` to confirm the new scope.Why
PayPal has no maintained general-purpose CLI. The old official one was a payments-only developer preview, and it is no longer maintained. The PayPal Agent Toolkit gives AI agents orders, invoices, subscriptions, disputes and reporting tools. It does not cover webhooks, webhook events, simulated events or payouts, and it has no interface for a person at a terminal.
This tool came out of a real hackathon build. During that build we kept leaving the IDE to:
copy a webhook ID out of the dashboard,
check "Webhooks Events" for delivery status,
guess whether Payouts was enabled on the app,
work out why a rotated secret still returned 200,
or decode a
NOT_AUTHORIZEDthat hid a missing dashboard checkbox.
paypal-cli handles each of those from the terminal, and gives an AI assistant the same tools through MCP.
It complements the official Agent Toolkit rather than replacing it.
Related MCP server: PayPal Operations Agent
Quick start (about 5 minutes)
You need Node.js 22+ and a free PayPal developer account.
Create a sandbox REST app.
Go to https://developer.paypal.com/dashboard/applications/sandbox and choose Create App (type: Merchant).
Under Features, tick Payouts.
Copy the client ID and secret.
Install:
git clone https://github.com/Mwaisaks/paypal-cli && cd paypal-cli npm install # also builds dist/ npm link # puts `paypal-cli` on your PATH (or use: node dist/cli.js …) cp .env.example .env # then paste PAYPAL_CLIENT_ID and PAYPAL_CLIENT_SECRETCheck the setup:
paypal-cli doctorIf
doctorreports that the credentials belong to live rather than sandbox, run commands with--env live.
Try it
# 1. Checkout. Opens the PayPal approval page.
# Log in as your sandbox *personal* account (Dashboard → Sandbox → Accounts → View/Edit for its password).
# The CLI waits for the approval, then captures.
paypal-cli orders create --amount 25 --description "Workshop ticket" --wait --capture
# 2. Webhooks. PayPal needs a public https URL; https://webhook.site gives you one for free.
paypal-cli webhooks create --url https://webhook.site/<your-id> --events "*"
paypal-cli webhooks list
paypal-cli trigger PAYMENT.CAPTURE.COMPLETED --webhook-id <id> # watch it arrive on webhook.site
paypal-cli events list --since 1h # real events from step 1
paypal-cli events show <WH-…> && paypal-cli events resend <WH-…>
# 3. Payouts (sandbox money). Use a sandbox personal account's email.
paypal-cli payouts send --to sb-xxxx@personal.example.com --amount 10
paypal-cli payouts get <batch-id>
# 4. Errors
paypal-cli orders capture NOT-A-REAL-ID ; paypal-cli explainEvery command takes these flags:
Flag | Effect |
| Raw JSON for scripts and |
| Logs each HTTP request. Secrets are always masked |
| Uses live credentials |
| Switches between apps |
| Explains a PayPal error as soon as it happens |
AI features
paypal-cli explain: from error payload to fix
Every PayPal error is printed as one line: status NAME/ISSUE (debug_id …) METHOD path. The full error is also
saved (masked, mode 0600) to ~/.config/paypal-cli/last-error.json.
paypal-cli explain then works in two steps:
Built-in rules (offline, no key). These cover the common failures:
wrong environment or credentials
a missing app feature behind a 403, named exactly
an order the buyer hasn't approved
insufficient funds
an unregistered payout receiver
webhook URL problems
duplicate request IDs
Claude (if
ANTHROPIC_API_KEYis set). Claude receives:the masked request and error payload
the rule hints
the app's granted OAuth scopes
It returns a cause and numbered fix steps written for this specific request: dashboard paths, field names and
paypal-clicommands.The model is
claude-opus-5-5by default. Override it withPAYPAL_CLI_MODEL.
paypal-cli mcp: the same tools for your coding assistant
Each operation is registered as an MCP tool with a typed input schema (the same zod schema the CLI uses). Tools also carry these annotations:
readOnlyHinton tools that only read.destructiveHinton tools that change things.Money-moving tools (
orders_capture,payouts_send) are gated twice.The first call only returns a preview and the exact equivalent command.
The assistant must show that preview to you and call again with
confirm: trueafter you approve.
Live-mode money movement is refused over MCP entirely.
To add it to Claude Code:
claude mcp add paypal-cli -- paypal-cli mcp --env-file /absolute/path/to/paypal-cli/.envThen ask, for example:
"Which webhook events failed delivery in the last hour? Resend them."
"Send a $5 test payout to my sandbox buyer."
No AI key ships with this tool. In MCP mode, your own assistant does the reasoning.
How it's built
Layer | Choice |
Orders | The official PayPal Server SDK ( |
Payouts, Webhooks, Events, Simulate | A small hand-written |
Shared operation registry | zod. Each operation becomes a commander CLI command and an MCP tool |
AI |
|
Safety defaults:
Timeouts. Every request has one. This includes the SDK, whose default is to wait forever.
Retries. Only idempotent GETs are retried.
Idempotency. Every POST carries a
PayPal-Request-Id, which you can set with--request-id.Secrets never reach stdout, logs or the saved error file. A unit test checks this.
Tools used to build it: Claude Code (CLI) and the APIMatic Context Plugin for PayPal, which supplied
PayPal SDK context to the coding agent. At runtime, explain uses Claude through the Anthropic API.
Known limits
Simulated events (
trigger) contain mock data. By PayPal's design they:fail
verify-webhook-signature,don't appear in
events list,and can't be resent.
Use a real sandbox event to test signature verification.
Sandbox accounts can only be created in the dashboard. PayPal has no public API for this.
Roadmap:
listen: a tunnel plus a temporary webhook that forwards events to localhostwebhooks verifyrefunds
balance
Development
npm run dev -- doctor # run from source with tsx
npm test # vitest
npm run typecheckLicense
MIT
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
This server cannot be deployed
Maintenance
Related MCP Connectors
MCP server for your apps' tools and custom tools, plus hosted AI agents and approval-gated workflows
Build, validate, deploy — HTTP APIs, cron jobs, webhooks and MCP tools — from your AI client.
Zero-setup MCP gateway securely connecting AI to your tools with authentication and workflows
Pay-per-use tool marketplace for AI agents. Search, price-check, and call APIs via MCP.
Related MCP Servers
AlicenseNot gradedqualityDmaintenanceEnables integration with PayPal APIs for managing invoices, payments, disputes, subscriptions, and more through natural language.1,227 npm13Apache 2.0- AlicenseNot gradedqualityBmaintenanceExposes four stdio MCP tools that let an AI client read sandbox disputes and unpaid invoices, draft persistent payment reminders, and execute reminders only after a human approves them in a separate terminal CLI. This lets finance teams triage PayPal issues and prepare outreach while keeping sending behind explicit human approval.MIT
- AlicenseNot gradedqualityCmaintenanceExposes payment authorization and decision-retrieval tools to MCP clients, letting AI agents request spending approvals, inspect verdicts, enforce recipient allowlists, and keep signed tokens out of model context.Apache 2.0
- AlicenseNot gradedqualityBmaintenanceEnables AI agents to create orders, capture payments, issue refunds and send payouts against the PayPal sandbox through four guarded MCP tools, where every call is authenticated, validated, risk-scored and policy-checked, risky actions wait for human approval, and all state changes land in a tamper-evident hash-chained audit log.MIT