Stripe MCP Server in Cursor IDE: Query Payments & Debug Billing Code (2026)
Connect Stripe to Cursor IDE using MCP and let your AI query customers, subscriptions, invoices, and payment intents directly while you write billing code. Full setup guide.
Stripe MCP Server Setup for Cursor IDE (2026)
Building Stripe integrations — subscriptions, webhooks, billing portals, payment intents — means constantly switching between your editor, the Stripe Dashboard, and the docs. The Stripe MCP server collapses all of that into your Cursor IDE session.
With it connected, you can query live Stripe data, look up customers and invoices, inspect webhook event structures, and ask Cursor to write billing code with real context from your actual Stripe account.
What You Can Do with Stripe + Cursor MCP
Once connected:
This is invaluable when debugging billing issues, writing webhook handlers, or building new Stripe features — you get real data as context while generating code.
Prerequisites
Step 1: Create a Stripe Restricted Key
Use a restricted key — not your full secret key — for MCP access. This limits the blast radius if the key is ever exposed.
1. Go to Stripe Dashboard → Developers → API Keys
2. Click Create restricted key
3. Name it (e.g., "Cursor MCP - Read Only")
4. Set permissions:
5. Click Create key and copy the
rk_live_... or rk_test_... valueFor development, use your test mode key (rk_test_...). Never put live keys in config files that might be committed to git.
Step 2: Add to Your Cursor mcp.json
Stripe maintains an official MCP server. Add it to ~/.cursor/mcp.json:
{
"mcpServers": {
"stripe": {
"command": "npx",
"args": ["-y", "@stripe/agent-toolkit"],
"env": {
"STRIPE_SECRET_KEY": "rk_test_your_restricted_key_here"
}
}
}
}
Important security note: Don't put your live Stripe secret key here. Use a restricted key with read-only permissions. If you use environment variables in your shell, you can reference them:
{
"mcpServers": {
"stripe": {
"command": "npx",
"args": ["-y", "@stripe/agent-toolkit"],
"env": {
"STRIPE_SECRET_KEY": "${STRIPE_RESTRICTED_KEY}"
}
}
}
}
On Windows, use the full npx path:
"command": "C:\\Program Files\\nodejs\\npx.cmd"
Step 3: Restart Cursor and Test
Quit and reopen Cursor. Then test in Cursor chat:
List the 5 most recent Stripe customers in my account
Or, if you're using test mode:
Show me all failed payment intents from the last 24 hours in Stripe test mode
Practical Workflows
Debugging a Stripe Webhook
I'm writing a webhook handler for the invoice.payment_failed event.
Show me the actual structure of that event from a recent occurrence
in my Stripe account so I know exactly what fields are available.
Instead of reading docs and guessing at field names, Cursor pulls a real event and helps you write the handler against actual data.
Building a Subscription Feature
Look up the customer cus_abc123 in Stripe, show me their current
subscription and plan details, then help me write a function that
upgrades them from the Starter to Pro plan using the Stripe API.
Investigating a Billing Issue
A customer is saying they were charged twice last month.
Their email is john@company.com. Find their Stripe customer ID,
then show me all charges and invoices for them in the last 45 days.
Writing Idiomatic Stripe Code
Write a Node.js endpoint that creates a Stripe Checkout Session
for a $49/month subscription to the price ID price_xyz123.
Include webhook endpoint validation and handle payment_intent.payment_failed.
With your actual Stripe account accessible, Cursor can verify price IDs, pull your webhook endpoint configuration, and generate accurate code rather than placeholder values.
Available Stripe MCP Tools
The @stripe/agent-toolkit exposes tools including:
stripe_list_customers — List customers with optional email filterstripe_get_customer — Get customer by IDstripe_list_subscriptions — List subscriptions with status/plan filtersstripe_get_subscription — Get subscription details by IDstripe_list_payment_intents — List payment intents with status filtersstripe_list_invoices — List invoices for a customerstripe_list_charges — List charges with filtersstripe_retrieve_event — Get a specific webhook event by IDstripe_list_events — List recent webhook events by typeThe toolkit is actively maintained by Stripe — check the npm package for the current full list.
Test Mode vs. Live Mode
Configure separate MCP entries for test and live Stripe:
{
"mcpServers": {
"stripe-test": {
"command": "npx",
"args": ["-y", "@stripe/agent-toolkit"],
"env": {
"STRIPE_SECRET_KEY": "rk_test_your_test_key"
}
},
"stripe-live": {
"command": "npx",
"args": ["-y", "@stripe/agent-toolkit"],
"env": {
"STRIPE_SECRET_KEY": "rk_live_your_restricted_key"
}
}
}
}
Then specify in your prompt: "Using stripe-test, list all customers" or "Check stripe-live for the customer record..."
Troubleshooting
"No such customer" errors
You're querying test mode data with a live key or vice versa. Test customers only exist in test mode, live customers only in live mode.
"Invalid API Key"
The key was pasted incorrectly or has been revoked. Go to Stripe Dashboard → API Keys and verify the key is active.
"Insufficient permissions"
Your restricted key doesn't have access to the resource you're querying. Go back to the key settings in Stripe Dashboard and add the required read permission.
Server starts but no tools appear
Check the MCP output panel in Cursor for startup errors. Usually a missing environment variable or failed npx package download.
---