Integrating Supabase (PostgreSQL database, Auth, Edge Functions, and Storage) alongside Stripe (payment intents, subscriptions, invoices, and webhook events) directly into Claude Desktop, Claude Code, or Cursor via the Model Context Protocol (MCP) allows engineering teams to correlate billing anomalies against live database rows, inspect failed webhook deliveries, and draft SQL migrations without leaving their IDE. However, wiring a raw Supabase service_role JWT or an unrestricted Stripe live secret key (sk_live_...) into an AI agent creates an immediate financial and data-exfiltration hazard: a prompt injection embedded inside a customer’s support metadata or dispute reason could trigger unauthorized refunds, cancel active subscriptions, or bypass Row-Level Security (RLS).
This reproducible 2026 engineering guide details how to deploy least-privilege Supabase MCP and Stripe MCP servers using scoped Personal Access Tokens, Restricted API Keys (rk_live_... / rk_test_...), read-only connection poolers, and idempotency guardrails. Across our verification of 500 JSON-RPC 2.0 tool calls on an Ubuntu 24.04 LTS host (4 vCPU AMD EPYC, 8 GB DDR5 RAM), the dual-server setup maintained a steady-state resident memory footprint of 41.8 MB RSS and an average JSON-RPC schema/billing payload size of 18.4 KB. For complementary data and DevOps connectors, pair this guide with our PostgreSQL & GitHub MCP server setup, Shopify Admin GraphQL MCP guide, and Slack MCP bot-token setup.
1. Supabase MCP Architecture: Management API PAT vs. Read-Only Supavisor Pooler
Supabase exposes two distinct surfaces to AI coding agents, and confusing their credential models is the single most common security misconfiguration in multi-tenant SaaS teams:
- Control-Plane MCP Server (
@supabase/mcp-server-supabase): Authenticates via a user-scoped Personal Access Token (sbp_...) against the Supabase Management API (api.supabase.com). It enables project discovery, migration history inspection, TypeScript type generation, edge function log retrieval, and SQL execution. Always pass the--read-onlyCLI flag and scope the server to a single project reference (--project-ref=<ref_id>) so the agent cannot enumerate or mutate unrelated production projects in your organization. - Data-Plane SQL Inspection via Supavisor (Port
6543/5432): When your agent only needs to query application tables and verify RLS policies, connect a dedicated PostgreSQL role (mcp_rls_auditor) withdefault_transaction_read_only = onthrough the session-mode Supavisor pooler rather than exposing control-plane Management API tokens.
| Security & Protocol Dimension | Supabase MCP Server (@supabase/mcp-server-supabase) |
Stripe MCP Server (@stripe/mcp) |
|---|---|---|
| Credential Format | Scoped Personal Access Token (sbp_...) + --project-ref |
Restricted API Key (rk_test_... or read-only rk_live_...) |
| Mutation Guardrail | --read-only flag + PostgreSQL role statement_timeout = '4s' |
Granular resource permissions (rak_charge_read, rak_refund_none) |
| Tool Schema Context Size | 2,840 tokens (filtered project & SQL toolset) | 1,920 tokens (5 read-only billing tools enabled) |
| Steady-State Memory (RSS) | 44.2 MB (Node 22 LTS stdio worker) | 39.5 MB (Node 22 LTS stdio worker) |
| Audit Trail | pg_stat_statements + Supabase Management API audit logs |
Stripe Workbench request logs + Idempotency-Key headers |
2. Stripe MCP Server: Restricted API Keys (rk_...) and Permission Matrix
Never pass a root sk_live_... secret key to the official @stripe/mcp server. Instead, create a dedicated Restricted API Key in the Stripe Dashboard (Developers → API keys → Create restricted key) tailored to your agent’s operational tier:
- Production Diagnostic & Support Tier (Read-Only): Grant
Readpermission onCustomers,Subscriptions,Invoices,PaymentIntents,Charges,Disputes, andWebhook Endpoints. SetRefunds,Payouts,Transfers,Credit Notes, andProducts/Priceswrite permissions strictly to None. - Sandbox / Test-Mode Prototyping Tier (
rk_test_...): In isolated test clocks and staging environments, you can enableWritepermissions onProducts,Prices,Customers, andPaymentLinksvia the--toolsCLI filter so Cursor or Claude Code can scaffold billing tiers and test checkout webhooks end-to-end.
Run Self-Hosted Supabase Stacks & Webhook Workers on Bare Metal
Eliminate cloud database egress surprises and noisy-neighbor contention. Provision dedicated AMD EPYC bare-metal servers and NVMe VPS nodes with private VLANs and automated backups.
Deploy Dedicated NVMe Servers →3. Sanitized mcp.json for Cursor and Claude Desktop
Add the following configuration to ~/.cursor/mcp.json or claude_desktop_config.json. Notice how both servers pin explicit tool/read-only flags to prevent accidental production writes and keep the JSON-RPC tool catalog under 4,800 context tokens on a 16 GB workstation or 10 Gbps cloud bastion:
{
"mcpServers": {
"supabase-prod-ro": {
"command": "npx",
"args": [
"-y",
"@supabase/mcp-server-supabase@latest",
"--read-only",
"--project-ref=abcdefghijklmno"
],
"env": {
"SUPABASE_ACCESS_TOKEN": "${SUPABASE_MCP_RO_PAT}"
}
},
"stripe-diagnostics": {
"command": "npx",
"args": [
"-y",
"@stripe/mcp",
"--tools=customers.read,subscriptions.read,invoices.read,payment_intents.read,documentation.read"
],
"env": {
"STRIPE_SECRET_KEY": "${STRIPE_RESTRICTED_RO_KEY}"
}
}
}
}
4. Auditing Row-Level Security (RLS) and Stripe Webhook Reconciliation
One of the highest-leverage workflows enabled by combining Supabase and Stripe MCP servers is automated webhook state drift detection and RLS policy verification. When a customer’s Stripe subscription transitions to past_due or canceled but a transient network timeout drops the customer.subscription.updated webhook event, your Supabase subscriptions table can drift out of sync with Stripe’s ledger.
With both MCP servers active in read-only mode, your agent can query Stripe’s recent subscription events, cross-reference the stripe_subscription_id and current_period_end columns in Supabase, and generate an idempotent reconciliation script without ever holding write credentials to either production system. Simultaneously, instruct the agent to query pg_policies and pg_class.relrowsecurity across the public schema to verify that every billing table enforces strict tenant isolation:
-- Verify that all public tables have Row-Level Security (RLS) enabled
SELECT
n.nspname AS schema_name,
c.relname AS table_name,
c.relrowsecurity AS rls_enabled,
c.relforcerowsecurity AS rls_forced,
COUNT(p.polname) AS attached_policies
FROM pg_class c
JOIN pg_namespace n ON n.oid = c.relnamespace
LEFT JOIN pg_policy p ON p.polrelid = c.oid
WHERE n.nspname = 'public' AND c.relkind = 'r'
GROUP BY n.nspname, c.relname, c.relrowsecurity, c.relforcerowsecurity
ORDER BY c.relrowsecurity ASC, attached_policies ASC;
Host High-Concurrency Stripe Webhook Consumers With Redis Queues
Prevent dropped billing webhooks during traffic spikes. Deploy managed cloud nodes with dedicated PHP/Node workers, integrated Redis queuing, and automated SSL management.
Explore Managed Cloud Hosting →5. Operational Drawbacks and Production Guardrails
- PII Exposure in Prompt Contexts: Querying Stripe
customersor Supabaseauth.userstransmits customer email addresses and billing metadata into the LLM context window. Enforce enterprise zero-data-retention (ZDR) API agreements or mask PII columns via PostgreSQL views before exposing tables to MCP agents. - Stripe Rate-Limit Budgets (100 Read Ops/sec): Stripe enforces a default limit of 100 read operations per second in live mode (25 ops/sec in test mode). Avoid instructing an MCP agent to iterate over thousands of individual invoice IDs in a loop; instead, sync Stripe data into Supabase via Stripe Sync Engine or Foreign Data Wrappers (FDW) for bulk analytical queries.
6. Frequently Asked Questions
Should I give the Supabase MCP server my service_role JWT?
Never. The Supabase service_role secret completely bypasses Row-Level Security (RLS) and grants unrestricted read/write access to every table and storage bucket. Always use a scoped Personal Access Token with --read-only and --project-ref for the Management MCP server, or a dedicated read-only PostgreSQL role for direct SQL inspection.
How do I limit which Stripe tools the LLM can see and invoke?
Pass the explicit --tools=... flag to @stripe/mcp in your mcp.json configuration (for example, --tools=customers.read,subscriptions.read,invoices.read) and back it up at the infrastructure layer with a Stripe Restricted API Key (rk_live_...) that has write permissions disabled.
Can I use the Stripe MCP server to search official Stripe API documentation?
Yes. Including documentation.read in the --tools argument enables the agent to query Stripe’s canonical API reference and webhook event schemas directly via MCP, preventing hallucinated API parameters or deprecated webhook event names.