How to Set Up Stripe MCP Server with Claude Code
Connect Stripe to Claude Code via MCP. Query payments, manage subscriptions, check invoices, and debug webhook issues — all from your terminal. Complete setup guide.

How to Set Up Stripe MCP Server with Claude Code
By David Henderson | March 26, 2026 | 12 min read
What you will build: A working connection between your Stripe account and Claude Code. When finished, you can query payments, check subscription status, review invoices, debug webhook failures, and manage your Stripe data — all through natural language in your terminal. Setup takes about 10 minutes.
Table of Contents
- Why Connect Stripe to Claude Code?
- Prerequisites
- Step 1: Create a Restricted Stripe API Key
- Step 2: Configure Claude Code
- Step 3: Test the Connection
- Real-World Use Cases
- Security Best Practices
- Troubleshooting
- Frequently Asked Questions
Why Connect Stripe to Claude Code? {#why-connect}
I manage payments for three different projects. Every day involves Stripe in some way — checking if a payment went through, debugging a webhook that failed, looking up a customer's subscription status, pulling revenue numbers for a report.
The Stripe Dashboard is fine. But it is slow for the kind of ad-hoc queries I run daily. "Show me all failed payments in the last week" requires navigating through multiple pages. "Which customers downgraded from Pro to Basic this month" is not a filter the dashboard offers.
With the Stripe MCP server, I ask Claude Code in plain English and get answers in seconds:
- "How much revenue did we process yesterday?"
- "Which customers have failed payments in the last 7 days?"
- "What is the current MRR by plan tier?"
- "Show me the details of invoice inv_1234567"
- "List all active subscriptions that are past due"
Claude writes the Stripe API calls, runs them, and returns the results. It is faster than the dashboard for anything that is not a simple lookup.
Prerequisites {#prerequisites}
- Claude Code installed and working
- A Stripe account (test mode or live — I recommend starting with test mode)
- Node.js 18+ installed
Step 1: Create a Restricted Stripe API Key {#step-1}
Do not use your Stripe secret key with Claude Code. Create a restricted key with only the permissions you need.
- Go to https://dashboard.stripe.com/apikeys
- Click "Create restricted key"
- Name it:
Claude Code MCP - Read Only - Set permissions:
Recommended read-only permissions:
| Resource | Permission |
|---|---|
| ---------- | ----------- |
| Charges | Read |
| Customers | Read |
| Invoices | Read |
| Payment Intents | Read |
| Payment Methods | Read |
| Prices | Read |
| Products | Read |
| Subscriptions | Read |
| Balance | Read |
| Events | Read |
| Disputes | Read |
| Refunds | Read |
Leave everything else as "None."
- Click "Create key"
- Copy the key — it starts with
rk_live_(live mode) orrk_test_(test mode)
Start with test mode. Create a restricted key from your test mode dashboard first. Once you have verified everything works, create a separate key for live mode.
Step 2: Configure Claude Code {#step-2}
Add the Stripe MCP server to your Claude Code configuration.
Project-Level Configuration
Create or edit .claude/mcp.json in your project root:
{
"mcpServers": {
"stripe": {
"command": "npx",
"args": ["-y", "@anthropic/stripe-mcp-server"],
"env": {
"STRIPE_API_KEY": "rk_test_your_restricted_key_here"
}
}
}
}
Global Configuration
For access in every session, edit ~/.claude/mcp.json:
{
"mcpServers": {
"stripe": {
"command": "npx",
"args": ["-y", "@anthropic/stripe-mcp-server"],
"env": {
"STRIPE_API_KEY": "rk_test_your_restricted_key_here"
}
}
}
}
Test Mode vs Live Mode
I keep two configurations:
{
"mcpServers": {
"stripe-test": {
"command": "npx",
"args": ["-y", "@anthropic/stripe-mcp-server"],
"env": {
"STRIPE_API_KEY": "rk_test_your_test_key"
}
},
"stripe-live": {
"command": "npx",
"args": ["-y", "@anthropic/stripe-mcp-server"],
"env": {
"STRIPE_API_KEY": "rk_live_your_live_key"
}
}
}
}
This way I can explicitly tell Claude which environment to use: "Using stripe-test, create a test customer" or "Using stripe-live, show me yesterday's revenue."
Step 3: Test the Connection {#step-3}
Restart Claude Code and run a test query:
claude "List the 5 most recent payments in my Stripe account"
If connected to test mode and you have test data, you will see payments listed. If you do not have test data yet:
claude "Create a test customer in Stripe with email test@example.com and name 'Test User'"
Then verify:
claude "Show me all customers in my Stripe account"
Real-World Use Cases {#use-cases}
Here is how I use the Stripe MCP server every day across my projects.
Daily Revenue Check
"What was yesterday's total revenue? Break it down by successful charges,
refunds, and disputes."
I run this every morning. It is faster than logging into the Stripe dashboard and clicking through reports.
Failed Payment Investigation
"Show me all failed payment attempts in the last 7 days. For each one,
show the customer email, the amount, the failure reason, and whether
they have a valid payment method on file."
This is one of the most common support requests I deal with. Instead of clicking through the dashboard customer by customer, I get a complete list in seconds.
Subscription Analytics
"How many active subscriptions do we have by plan? What's the MRR for each tier?
How many subscriptions were created vs canceled this month?"
"Show me all customers who downgraded their subscription in the last 30 days.
What plan were they on before, and what are they on now?"
Invoice Management
"Are there any unpaid invoices older than 30 days? List them with customer
email and amount."
"Show me the details of invoice inv_1MtFPA2eZvKYlo2CRfRNBNmV — line items,
customer, status, and payment attempts."
Webhook Debugging
When a webhook fails and I need to figure out why:
"Show me the last 10 webhook events of type 'invoice.payment_failed'.
For each one, show the customer, the amount, and the failure code."
"Look at the event evt_1234567. What was the payload? What customer and
subscription does it relate to?"
Combining Stripe with Code
This is powerful when working on a project that uses Stripe:
"Read our webhook handler at app/api/webhooks/stripe/route.ts. Then look at
the last 5 failed webhook events in Stripe. Is our handler covering all the
event types that Stripe is sending?"
"Read our pricing page component. Compare the prices shown to the actual
Stripe prices in our account. Are they in sync?"
For other MCP servers you can combine with Stripe (Slack for payment notifications, Postgres for cross-referencing), browse the Skiln MCP directory.
Security Best Practices {#security}
Always Use Restricted Keys
Never use your Stripe secret key (sk_live_...) with any MCP server. Restricted keys let you control exactly what the MCP server can do.
Read-Only by Default
Start with read-only permissions. You can always create a second restricted key with write permissions for specific tasks, but keep your daily-use key read-only.
Separate Test and Live Keys
Use test mode keys for experimentation and development. Only use live mode keys when you need to query real data. If you are just learning the Stripe MCP server, test mode is sufficient — Stripe provides test data generators.
Do Not Commit Keys
Add your MCP config to .gitignore:
.claude/mcp.json
Monitor API Key Usage
Stripe logs every API call with the key that made it. Check your API logs periodically to verify that the MCP server is only making the calls you expect.
Rotate Keys Periodically
Delete and recreate your restricted key every few months. Update your mcp.json with the new key.
Troubleshooting {#troubleshooting}
"Invalid API Key" error
The key in your config is wrong or expired.
Fix: Go to https://dashboard.stripe.com/apikeys and verify the key exists and is active. Make sure you are using the right mode (test vs live). Test mode keys start with rk_test_, live mode with rk_live_.
"Permission denied" for a specific resource
Your restricted key does not have permission for the requested operation.
Fix: Go to your API keys in Stripe, click on the restricted key, and add the missing permission. For example, if Claude cannot list subscriptions, add "Subscriptions: Read" to the key's permissions.
MCP server fails to start
- Check Node.js:
node -v(need 18+) - Test manually:
STRIPE_API_KEY=rk_test_your_key npx @anthropic/stripe-mcp-server - Verify JSON syntax in your
mcp.json
Claude says it does not have Stripe tools
- Restart Claude Code after editing config
- Validate JSON in your config file
- Check config file location
"Rate limit exceeded"
Stripe limits API calls to 100 per second in live mode and 25 per second in test mode. If Claude is making many calls in sequence (listing large datasets), you may hit limits.
Fix: Be specific in your queries. "Show the last 10 payments" hits the API once. "Show me every payment ever" could hit it many times with pagination.
Frequently Asked Questions {#faq}
Can the Stripe MCP server process payments or charge customers?
Only if you grant write permissions on your restricted API key. With the read-only setup in this guide, the MCP server can only view data — it cannot create charges, modify subscriptions, or issue refunds. I strongly recommend keeping it read-only for daily use and creating a separate write-enabled key only when you specifically need to make changes.
Does this work with Stripe Connect (platforms with connected accounts)?
Yes. You can query connected account data by specifying the account in your queries. The restricted key needs "Connect: Read" permission to access connected account data. For platform-specific operations like transfers or payouts, you would need additional write permissions.
Is my Stripe data sent to Anthropic?
Yes. When Claude Code queries your Stripe account, the API responses (customer data, payment amounts, email addresses) are sent to Anthropic as part of the conversation. Anthropic's data policy states they do not train on API inputs. However, if your Stripe account contains sensitive customer data (PII, card details — though Stripe does not return full card numbers), be mindful of what you query.
Can I use this with Stripe's test mode to practice?
Absolutely. I recommend starting with test mode. Create a restricted key from your test mode dashboard, configure it in Claude Code, and experiment freely. Stripe provides test card numbers, test customer data, and test webhook events that let you explore every feature without touching real data.
How do I use the Stripe MCP alongside my Stripe integration code?
This is one of the best use cases. While building or debugging your Stripe integration, Claude Code can read your code AND query your Stripe account simultaneously. You can ask things like "Read my webhook handler code and compare it to the actual webhook events Stripe sent today — are we missing any event types?" This cross-referencing between code and live data is incredibly valuable for development and debugging.
