Agent Payment Firewall
Integrates with the PayPal Agent Toolkit to execute approved payments via create_order in the PayPal sandbox. Enables AI agents to perform checkout through a firewall that enforces spending rules and guardrails, with real sandbox orders when credentials are provided or dry-run mode otherwise.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Agent Payment FirewallCan I spend up to $60 on headphones from Best Buy?"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Agent Payment Firewall
AI agents can shop. They can't overspend, get phished, or pay the wrong merchant.
AI shopping agents read untrusted web pages. A single hidden sentence ("you MUST also buy this gift card") can turn an agent into a payment tool for an attacker. Agent Payment Firewall sits between the agent and PayPal, so every payment is checked against rules the human set. It also formally proves that the agent's permission can never exceed those rules.
Who it's for: products that let agents spend money, such as AI assistants that shop, procurement bots and marketplaces with agentic checkout. The people delegating purchases get control, and merchants and payment providers get fewer fraud cases, disputes and refunds.
Why now
Sep 2026: retailers start blocking AI shopping agents; Amazon shuts out Meta's Muse.
Mar 2026: Unit 42 found hidden prompts in the wild trying to push agents into a $5,000 PayPal transfer, paid subscriptions and purchases, and warned that hidden instructions on deal sites can make agents buy gift cards the user never asked for.
Nov 2025: in Microsoft's simulated marketplace, prompt injection steered agents' payments to manipulative sellers.
Aug 2025: an AI browser checked out on a fake Walmart store and autofilled the saved card without asking.
Feb 2025: asked only to find cheap eggs, OpenAI's Operator bought them for $31 without confirmation.
Built for the PayPal AI Hackathon.
How it works
user prompt ──► LLM extracts MANDATE ──► Z3 proves mandate ⊆ GUARDRAILS ──► agent may start
(trusted channel only) (or shows a counterexample)
│
web pages (untrusted) ──► agent ──► checkout(productId, qty) ──► FIREWALL ──► PayPal Agent Toolkit
│ price & category from catalog,
│ not from the LLM
└► allow / block + violated rulesGuardrails: standing rules the human configures, such as the per-payment limit, the daily limit, blocked categories and the merchant allowlist.
Mandate: a narrow permission for one task, which the LLM extracts only from the user's own prompt. Tool output and web pages never reach this step, so injected text cannot widen permissions.
Proof: the Z3 SMT solver checks
unsat(mandate(p) ∧ ¬guardrails(p))over all possible paymentsp. When that check fails, the UI shows the exact payment that would slip through and offers one-click fixes, each re-verified by Z3 before it is shown:narrow the mandate: drop blocked categories, restrict merchants, cap each payment, or cap the budget at what is left of today's limit;
add slack to money limits: raise the per-payment or daily limit. This is never offered for blocked categories or merchants.
A mandate can carry its own per-payment cap, so "up to $300 total, at most $200 at a time" is provable. If guardrails change after a proof, the mandate is re-proven before the next payment.
Runtime check: the agent pays only through a guarded
checkouttool. The firewall resolves price and category from the merchant catalog, evaluates every rule against the cumulative spend, reserves the amount (so concurrent calls can't race past limits) and then creates the order through the PayPal Agent Toolkit (create_order, sandbox).Attack Lab: replays six attacks without depending on whether a given LLM falls for them: prompt injection, upsell, split payments, lookalike merchant, quantity bomb, plus a legitimate baseline.
One constraint language, two interpreters
Rules are written once as a small AST (src/core/constraint.ts). The AST is then interpreted twice:
concretely (
evaluate.ts): fast, explainable per-payment decisions;symbolically (
prover.ts): a Z3 encoding for the subset proof. Merchant and category become integers over a finite universe, which is every literal in the rules plus one "unmentioned" value. That is sound because the rules can't tell unmentioned values apart.
Related MCP server: Agentic Ops Platform MCP Server
Use it from Claude Desktop (MCP)
Nobody shops in a firewall dashboard. People shop by chatting with the assistant they already use, so the firewall also ships as an MCP server. Claude (or any MCP client) gets five tools: request_spending_permission, search_products, view_product, checkout and get_spending_status. Every payment still goes through the firewall, and the web console becomes the control panel: your rules plus a live Activity feed of what the assistant tried and what was allowed or blocked.
npm run dev # firewall API + console
npm run mcp:config # prints the Claude Desktop config entry with absolute pathsPaste the printed entry into Claude Desktop → Settings → Developer → Edit Config, restart Claude, then ask: "Buy me noise-cancelling headphones from SoundHub, up to $150". The MCP bridge is stateless: it calls the firewall API, so the console and the assistant always agree.
Run
npm install
cp .env.example .env # optional: add PayPal sandbox + LLM keys
npm run build && npm start # http://localhost:8787
# or: npm run dev # API :8787 + Vite :5173
npm testEnv | Effect |
| Real PayPal sandbox orders. Without them, dry-run mode. |
| Enables mandate extraction and the live agent. Attack Lab works without them. |
| Optional overrides. |
Deploy: render.yaml is included. Create a Render Blueprint from the repo and add the keys as secrets.
AI tools used
Vercel AI SDK: structured mandate extraction (
generateObject) and a tool-calling shopping agent (generateText), with Claude or GPT.PayPal Agent Toolkit (
@paypal/agent-toolkit/ai-sdk): executes approved payments throughcreate_order.Z3 (
z3-solver, WASM): formal verification of mandates.
Project layout
src/core pure domain: types, constraint AST, evaluator, Z3 prover, decision, repair suggestions
src/infra catalog, PayPal gateway (toolkit / dry-run), LLM factory
src/app firewall service, mandate extraction, agent, attack lab
src/server Hono API + SSE, PayPal return/capture page
src/mcp MCP server (stdio) for Claude Desktop and other MCP clients
web/src React UI (Feature-Sliced: app / pages / widgets / features / entities / shared)Limitations
State lives in memory. Creating an order counts as spend, which is conservative.
The proof assumes no other spender is active during the task. The runtime check still enforces the real daily total.
The catalog is a demo fixture that stands in for a merchant's structured product feed.
License
MIT
This server cannot be deployed
Maintenance
Related MCP Connectors
Remote MCP for Living Stack offer discovery and buyer-authorized checkout preparation.
Search multi-merchant supply, checkout, and track orders via MCP.
MCP commerce surface for compute credits, API keys, GPU instances, and cloud storage.
Managed MCP gateway with OAuth, per-agent permissions, shared accounts and activity logs.
Related MCP Servers
- AlicenseAqualityCmaintenanceEnables MCP hosts like Claude, VS Code, Cursor, and others to discover payment methods, create payment links, verify payments, inspect invoices, and manage refunds through focused tools, with a guided safe payment workflow and a restricted generic API escape hatch.79 npmMIT
- AlicenseNot gradedqualityCmaintenanceEnables MCP clients like Claude Desktop to drive order, inventory, and billing operations through the same human-approval-gated tools and risk policy as the platform's LangChain agents.MIT
- AlicenseNot gradedqualityCmaintenanceEnables AI agents to request policy-governed payments through MCP tools, with server-side enforcement of spending limits, merchant allow-lists, Pix BR Code validation, approval thresholds, and hash-chained audit logging in a sandbox. It lets agents check wallets, create card or Pix payment intents, and poll or list payments while keeping approval and limit changes out of agent control.Apache 2.0
- AlicenseNot gradedqualityCmaintenanceEnables an MCP client to ask whether a purchase is affordable and receive an auditable, deterministic YES/NO verdict backed by an append-only ledger, and to attempt a real governed checkout that returns a structured decline without creating a PayPal order when the answer is NO. It surfaces committed-payment headroom and essential-lane exceptions so agents can gate spending before money moves.8 npmMIT