@guillaume_code_2012/stripe-mcp 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +428 -0
- package/dist/index.js +6141 -0
- package/dist/index.js.map +1 -0
- package/package.json +56 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 stripe-mcp contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,428 @@
|
|
|
1
|
+
```
|
|
2
|
+
⚡
|
|
3
|
+
███████ ███████ ███████ ███████ ███████ ███████ ███████ ███████████
|
|
4
|
+
░███░░░ ░███░░░ ░███░░░ ░███░░░ ░███░░░ ░███░░░ ░███░░░ ░░░░░███░░░░
|
|
5
|
+
░███ ░███ ░███ ░███ ░███ ░███ ░███ ░███
|
|
6
|
+
░███████░██████ ░███████░███████░███████░███████░███████ ░███
|
|
7
|
+
░███░░░ ░███░░░ ░███░░░ ░███░░░ ░███░░░ ░███░░░ ░███░░░ ░███
|
|
8
|
+
░███ ░███ ░███ ░███ ░███ ░███ ░███ ░███
|
|
9
|
+
░███████░██████ ███████░███████░███ ░███ ░██████ ░███
|
|
10
|
+
░░░░░░░ ░░░░░░ ░░░░░░░ ░░░░░░░ ░░░ ░░░ ░░░░░░ ░░░
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
# stripe-mcp
|
|
14
|
+
|
|
15
|
+
> **The most complete open-source MCP server for Stripe.**
|
|
16
|
+
|
|
17
|
+

|
|
18
|
+

|
|
19
|
+

|
|
20
|
+

|
|
21
|
+

|
|
22
|
+

|
|
23
|
+
|
|
24
|
+
**Manage your entire Stripe account — customers, subscriptions, invoices, and analytics — with natural language. 79 tools. One command. Works with Claude Desktop, Cursor, and Windsurf.**
|
|
25
|
+
|
|
26
|
+
---
|
|
27
|
+
|
|
28
|
+
## Why this exists
|
|
29
|
+
|
|
30
|
+
- **No other Stripe MCP has analytics.** MRR, churn, revenue summaries, top customers, failed-payment reports — all computed client-side. Stripe has no native MRR endpoint; we implemented the canonical Baremetrics/ChartMogul methodology.
|
|
31
|
+
- **One command to install.** `npm install -g @guillaume_code_2012/stripe-mcp` and you're talking to Stripe from Claude in 30 seconds. No servers, no ports, no auth headers.
|
|
32
|
+
- **Typed end-to-end.** TypeScript strict mode, zod runtime validation on every input, zero `any`. Stripe SDK types flow all the way through to the LLM.
|
|
33
|
+
|
|
34
|
+
## Quick start
|
|
35
|
+
|
|
36
|
+
**1. Install**
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
npm install -g @guillaume_code_2012/stripe-mcp
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
**2. Get a Stripe secret key**
|
|
43
|
+
|
|
44
|
+
Grab a restricted test key from the [Stripe dashboard](https://dashboard.stripe.com/apikeys). It starts with `sk_test_`.
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
export STRIPE_SECRET_KEY=sk_test_...
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
**3. Wire it into your MCP client**
|
|
51
|
+
|
|
52
|
+
**Claude Desktop** — edit `claude_desktop_config.json` (macOS:
|
|
53
|
+
`~/Library/Application Support/Claude/claude_desktop_config.json`):
|
|
54
|
+
|
|
55
|
+
```json
|
|
56
|
+
{
|
|
57
|
+
"mcpServers": {
|
|
58
|
+
"stripe": {
|
|
59
|
+
"command": "stripe-mcp",
|
|
60
|
+
"env": { "STRIPE_SECRET_KEY": "sk_test_..." }
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
**Cursor** — `Settings → MCP → Add new MCP server`:
|
|
67
|
+
|
|
68
|
+
```json
|
|
69
|
+
{
|
|
70
|
+
"mcpServers": {
|
|
71
|
+
"stripe": {
|
|
72
|
+
"command": "stripe-mcp",
|
|
73
|
+
"env": { "STRIPE_SECRET_KEY": "sk_test_..." }
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
**Windsurf** — `Settings → MCP Servers → Add Server`, same JSON shape.
|
|
80
|
+
|
|
81
|
+
Restart your client. You should see `stripe-mcp` log `✓ Test mode (no real charges).` and you're live.
|
|
82
|
+
|
|
83
|
+
## Compatible with
|
|
84
|
+
|
|
85
|
+
✅ Claude Desktop · ✅ Cursor · ✅ Windsurf · ✅ Any MCP-compatible client
|
|
86
|
+
|
|
87
|
+
---
|
|
88
|
+
|
|
89
|
+
## The 79 tools
|
|
90
|
+
|
|
91
|
+
Grouped by category. Every tool takes JSON input, validates it with zod, calls Stripe, and returns pretty-printed JSON or a human-readable error. List tools auto-paginate and return `{ total_count, has_more, data }`.
|
|
92
|
+
|
|
93
|
+
### Customers (6)
|
|
94
|
+
|
|
95
|
+
| Tool | What it does | Example prompt |
|
|
96
|
+
| --- | --- | --- |
|
|
97
|
+
| `stripe_customers_create` | Create a new customer with email, name, address, metadata. | "Create a customer for jane@acme.com with the name Jane Doe." |
|
|
98
|
+
| `stripe_customers_get` | Retrieve a single customer by ID, with optional expansions. | "Show me everything about customer cus_abc123." |
|
|
99
|
+
| `stripe_customers_update` | Update email, name, phone, description, or metadata. | "Update cus_abc123's email to jane@newco.com." |
|
|
100
|
+
| `stripe_customers_delete` | Permanently delete a customer (cancels active subscriptions). | "GDPR delete request — wipe customer cus_abc123." |
|
|
101
|
+
| `stripe_customers_list` | List customers, auto-paginated, optional exact-email filter. | "List all customers with the email support@acme.com." |
|
|
102
|
+
| `stripe_customers_search` | Search customers with Stripe Search Query Language. | "Find customers whose name contains 'Acme'." |
|
|
103
|
+
|
|
104
|
+
### Products (5)
|
|
105
|
+
|
|
106
|
+
| Tool | What it does | Example prompt |
|
|
107
|
+
| --- | --- | --- |
|
|
108
|
+
| `stripe_products_create` | Create a new product (name, description, images, default price). | "Create a product called 'Pro Plan' with description 'For teams'." |
|
|
109
|
+
| `stripe_products_get` | Retrieve a single product by ID. | "Show me product prod_abc123." |
|
|
110
|
+
| `stripe_products_update` | Update name, description, images, metadata, or default price. | "Rename prod_abc123 to 'Pro Plan v2'." |
|
|
111
|
+
| `stripe_products_archive` | Archive a product by setting active=false (recommended over delete). | "Archive prod_abc123 — we no longer sell it." |
|
|
112
|
+
| `stripe_products_list` | List products, optional active/ids filters. | "List all active products." |
|
|
113
|
+
|
|
114
|
+
### Prices (4)
|
|
115
|
+
|
|
116
|
+
| Tool | What it does | Example prompt |
|
|
117
|
+
| --- | --- | --- |
|
|
118
|
+
| `stripe_prices_create` | Create a one-time or recurring price (cents + currency + product). | "Create a $29/month recurring price for prod_pro." |
|
|
119
|
+
| `stripe_prices_get` | Retrieve a single price by ID. | "Show me price price_abc123." |
|
|
120
|
+
| `stripe_prices_update` | Update nickname, lookup_key, metadata, or active flag. | "Set the nickname of price_abc123 to 'Pro Monthly'." |
|
|
121
|
+
| `stripe_prices_list` | List prices, optional active/product/type filters. | "List all recurring prices for prod_pro." |
|
|
122
|
+
|
|
123
|
+
### Subscriptions (8)
|
|
124
|
+
|
|
125
|
+
| Tool | What it does | Example prompt |
|
|
126
|
+
| --- | --- | --- |
|
|
127
|
+
| `stripe_subscriptions_create` | Subscribe a customer to one or more prices, with optional trial/coupon. | "Subscribe cus_abc to price_pro with a 14-day trial." |
|
|
128
|
+
| `stripe_subscriptions_get` | Retrieve a subscription by ID. | "Show me sub_abc123 with its latest invoice expanded." |
|
|
129
|
+
| `stripe_subscriptions_update` | Change items, coupon, proration, or schedule cancel-at-period-end. | "Upgrade sub_abc123 from Pro to Enterprise." |
|
|
130
|
+
| `stripe_subscriptions_cancel` | Cancel immediately with optional proration and feedback. | "Cancel sub_abc123 — customer said it was too expensive." |
|
|
131
|
+
| `stripe_subscriptions_pause` | Pause collection cycle (void / mark_uncollectible / keep_as_draft). | "Pause sub_abc123 for 30 days starting today." |
|
|
132
|
+
| `stripe_subscriptions_resume` | Resume a paused subscription. | "Resume sub_abc123 — customer is back from vacation." |
|
|
133
|
+
| `stripe_subscriptions_list` | List subscriptions, filter by status/customer/price. | "List all past_due subscriptions." |
|
|
134
|
+
| `stripe_subscriptions_search` | Search subscriptions with Stripe Search Query Language. | "Find subscriptions with metadata.team_id='42'." |
|
|
135
|
+
|
|
136
|
+
### Invoices (6)
|
|
137
|
+
|
|
138
|
+
| Tool | What it does | Example prompt |
|
|
139
|
+
| --- | --- | --- |
|
|
140
|
+
| `stripe_invoices_get` | Retrieve a single invoice by ID. | "Show me invoice in_abc123 with line items expanded." |
|
|
141
|
+
| `stripe_invoices_list` | List invoices, filter by customer/status/subscription. | "List all open invoices for cus_abc123." |
|
|
142
|
+
| `stripe_invoices_pay` | Pay a draft or open invoice, optionally out-of-band. | "Pay invoice in_abc123 with the customer's default payment method." |
|
|
143
|
+
| `stripe_invoices_void` | Mark an open invoice as void (irreversible). | "Void invoice in_abc123 — it was issued in error." |
|
|
144
|
+
| `stripe_invoices_finalize` | Advance a draft invoice to open status. | "Finalize invoice in_abc123 so we can email it." |
|
|
145
|
+
| `stripe_invoices_send` | Email an invoice to the customer. | "Send invoice in_abc123 to the customer now." |
|
|
146
|
+
|
|
147
|
+
### Payment Intents (5)
|
|
148
|
+
|
|
149
|
+
| Tool | What it does | Example prompt |
|
|
150
|
+
| --- | --- | --- |
|
|
151
|
+
| `stripe_payment_intents_create` | Create a PaymentIntent for a one-time charge. | "Create a $49 PaymentIntent in USD for cus_abc123." |
|
|
152
|
+
| `stripe_payment_intents_get` | Retrieve a PaymentIntent by ID. | "Show me payment intent pi_abc123 — what's the status?" |
|
|
153
|
+
| `stripe_payment_intents_confirm` | Confirm a PaymentIntent to kickstart payment processing. | "Confirm pi_abc123 with payment method pm_card_visa." |
|
|
154
|
+
| `stripe_payment_intents_cancel` | Cancel an uncaptured PaymentIntent. | "Cancel pi_abc123 — the customer abandoned checkout." |
|
|
155
|
+
| `stripe_payment_intents_list` | List PaymentIntents, filter by customer or status. | "List all succeeded PaymentIntents for cus_abc123." |
|
|
156
|
+
|
|
157
|
+
### Refunds (3)
|
|
158
|
+
|
|
159
|
+
| Tool | What it does | Example prompt |
|
|
160
|
+
| --- | --- | --- |
|
|
161
|
+
| `stripe_refunds_create` | Refund a charge or PaymentIntent (full or partial). | "Refund $25 from pi_abc123 — customer was overcharged." |
|
|
162
|
+
| `stripe_refunds_get` | Retrieve a single refund by ID. | "Show me refund re_abc123 — has it settled?" |
|
|
163
|
+
| `stripe_refunds_list` | List refunds, filter by charge or PaymentIntent. | "List all refunds issued against pi_abc123." |
|
|
164
|
+
|
|
165
|
+
### Disputes (4)
|
|
166
|
+
|
|
167
|
+
| Tool | What it does | Example prompt |
|
|
168
|
+
| --- | --- | --- |
|
|
169
|
+
| `stripe_disputes_get` | Retrieve a single dispute by ID. | "Show me dispute dp_abc123 — what's the evidence deadline?" |
|
|
170
|
+
| `stripe_disputes_update` | Attach evidence or metadata; optionally submit. | "Submit this shipping tracking number as evidence for dp_abc123." |
|
|
171
|
+
| `stripe_disputes_close` | Close (forfeit) a dispute. | "We're not contesting dp_abc123 — close it." |
|
|
172
|
+
| `stripe_disputes_list` | List disputes, filter by charge or PaymentIntent. | "List all open disputes from the last 30 days." |
|
|
173
|
+
|
|
174
|
+
### Webhooks (5)
|
|
175
|
+
|
|
176
|
+
| Tool | What it does | Example prompt |
|
|
177
|
+
| --- | --- | --- |
|
|
178
|
+
| `stripe_webhooks_create` | Register a webhook endpoint with a list of events. | "Create a webhook at https://api.acme.com/stripe for charge.succeeded and invoice.paid." |
|
|
179
|
+
| `stripe_webhooks_get` | Retrieve a webhook endpoint by ID. | "Show me webhook we_abc123 — what events is it subscribed to?" |
|
|
180
|
+
| `stripe_webhooks_update` | Update URL, events, description, disabled flag. | "Disable webhook we_abc123 — we're migrating endpoints." |
|
|
181
|
+
| `stripe_webhooks_delete` | Permanently delete a webhook endpoint. | "Delete webhook we_abc123 — receiver is decommissioned." |
|
|
182
|
+
| `stripe_webhooks_list` | List all webhook endpoints. | "List all webhooks on this account." |
|
|
183
|
+
|
|
184
|
+
### Coupons (4)
|
|
185
|
+
|
|
186
|
+
| Tool | What it does | Example prompt |
|
|
187
|
+
| --- | --- | --- |
|
|
188
|
+
| `stripe_coupons_create` | Create a percent-off or amount-off coupon (once / repeating / forever). | "Create a 50% off coupon that lasts 3 months." |
|
|
189
|
+
| `stripe_coupons_get` | Retrieve a coupon by ID. | "Show me coupon 25OFF — how many times has it been redeemed?" |
|
|
190
|
+
| `stripe_coupons_delete` | Delete a coupon (existing customers keep their discount). | "Delete coupon SUMMER24 — promo is over." |
|
|
191
|
+
| `stripe_coupons_list` | List all coupons. | "List every coupon on the account." |
|
|
192
|
+
|
|
193
|
+
### Promotion Codes (3)
|
|
194
|
+
|
|
195
|
+
| Tool | What it does | Example prompt |
|
|
196
|
+
| --- | --- | --- |
|
|
197
|
+
| `stripe_promotion_codes_create` | Create a customer-redeemable code backed by a coupon. | "Create promo code WELCOME20 from coupon 25OFF, max 100 redemptions." |
|
|
198
|
+
| `stripe_promotion_codes_get` | Retrieve a promotion code by ID. | "Show me promo_abc123 — how many times has it been redeemed?" |
|
|
199
|
+
| `stripe_promotion_codes_list` | List promotion codes, optional coupon/active filter. | "List all active promotion codes for coupon 25OFF." |
|
|
200
|
+
|
|
201
|
+
### Payment Links (4)
|
|
202
|
+
|
|
203
|
+
| Tool | What it does | Example prompt |
|
|
204
|
+
| --- | --- | --- |
|
|
205
|
+
| `stripe_payment_links_create` | Create a hosted Payment Link URL for one or more products. | "Create a payment link for the Pro plan, quantity 1." |
|
|
206
|
+
| `stripe_payment_links_get` | Retrieve a Payment Link by ID. | "Show me plink_abc123 — what's the URL?" |
|
|
207
|
+
| `stripe_payment_links_update` | Update active state, line items, or metadata. | "Deactivate plink_abc123 — we're sold out." |
|
|
208
|
+
| `stripe_payment_links_list` | List all Payment Links. | "List every payment link on the account." |
|
|
209
|
+
|
|
210
|
+
### Checkout (4)
|
|
211
|
+
|
|
212
|
+
| Tool | What it does | Example prompt |
|
|
213
|
+
| --- | --- | --- |
|
|
214
|
+
| `stripe_checkout_create_session` | Create a Checkout Session (payment / subscription / setup mode). | "Create a checkout session for $49 USD, success URL /thanks, cancel /cart." |
|
|
215
|
+
| `stripe_checkout_get_session` | Retrieve a Checkout Session by ID. | "Show me cs_test_abc123 — did the customer pay?" |
|
|
216
|
+
| `stripe_checkout_expire_session` | Expire an open Checkout Session. | "Expire cs_test_abc123 — customer abandoned it." |
|
|
217
|
+
| `stripe_checkout_list_sessions` | List Checkout Sessions, filter by status/customer/payment_link. | "List all completed checkout sessions from last week." |
|
|
218
|
+
|
|
219
|
+
### Billing Portal (1)
|
|
220
|
+
|
|
221
|
+
| Tool | What it does | Example prompt |
|
|
222
|
+
| --- | --- | --- |
|
|
223
|
+
| `stripe_billing_portal_create_session` | Create a short-lived Customer Portal URL for self-service billing. | "Give cus_abc123 a link to update their payment method." |
|
|
224
|
+
|
|
225
|
+
### Balance (2)
|
|
226
|
+
|
|
227
|
+
| Tool | What it does | Example prompt |
|
|
228
|
+
| --- | --- | --- |
|
|
229
|
+
| `stripe_balance_get` | Retrieve the current account balance across all currencies. | "What's my available Stripe balance right now?" |
|
|
230
|
+
| `stripe_balance_list_transactions` | List transactions contributing to the balance, filter by type/payout. | "Show me every refund transaction from the last 30 days." |
|
|
231
|
+
|
|
232
|
+
### Payouts (4)
|
|
233
|
+
|
|
234
|
+
| Tool | What it does | Example prompt |
|
|
235
|
+
| --- | --- | --- |
|
|
236
|
+
| `stripe_payouts_create` | Manually payout funds to a bank account or card. | "Payout $5000 to my default bank account in USD." |
|
|
237
|
+
| `stripe_payouts_get` | Retrieve a payout by ID. | "Show me po_abc123 — has it arrived yet?" |
|
|
238
|
+
| `stripe_payouts_cancel` | Cancel a pending payout (automatic payouts can't be canceled). | "Cancel po_abc123 — I made a mistake." |
|
|
239
|
+
| `stripe_payouts_list` | List payouts, filter by status/arrival_date/destination. | "List every failed payout this month." |
|
|
240
|
+
|
|
241
|
+
### Tax (3)
|
|
242
|
+
|
|
243
|
+
| Tool | What it does | Example prompt |
|
|
244
|
+
| --- | --- | --- |
|
|
245
|
+
| `stripe_tax_create_rate` | Create a manual tax rate (display name, percentage, inclusive flag). | "Create an 8.5% exclusive California sales tax rate." |
|
|
246
|
+
| `stripe_tax_get_rate` | Retrieve a tax rate by ID. | "Show me tax rate txr_abc123." |
|
|
247
|
+
| `stripe_tax_list_rates` | List tax rates, optional active filter. | "List every active tax rate." |
|
|
248
|
+
|
|
249
|
+
### Meters (3)
|
|
250
|
+
|
|
251
|
+
| Tool | What it does | Example prompt |
|
|
252
|
+
| --- | --- | --- |
|
|
253
|
+
| `stripe_meters_create` | Create a billing meter for usage-based pricing. | "Create a meter called 'API Calls' on event api_calls, sum aggregation." |
|
|
254
|
+
| `stripe_meters_get` | Retrieve a billing meter by ID. | "Show me meter_abc123 — what's its event name?" |
|
|
255
|
+
| `stripe_meters_list` | List all billing meters. | "List every billing meter on the account." |
|
|
256
|
+
|
|
257
|
+
### ⚡ Analytics (5) — the crown jewel
|
|
258
|
+
|
|
259
|
+
These are the killer feature. **No other Stripe MCP server has them.** They compute MRR, churn, revenue summaries, top customers, and failed-payment reports by paginating Stripe resources client-side and aggregating locally — Stripe has no native MRR endpoint, so we implement the canonical Baremetrics/ChartMogul methodology ourselves.
|
|
260
|
+
|
|
261
|
+
| Tool | What it does | Example prompt |
|
|
262
|
+
| --- | --- | --- |
|
|
263
|
+
| `stripe_analytics_get_mrr` | Compute Monthly Recurring Revenue with by-plan, by-currency, and top-customer breakdowns. | "Show me my MRR and which plan is growing fastest." |
|
|
264
|
+
| `stripe_analytics_get_churn_rate` | Compute subscription churn rate for any period, with per-customer LTV estimates. | "What's my churn rate over the last 90 days?" |
|
|
265
|
+
| `stripe_analytics_get_revenue_summary` | Aggregate gross/net revenue, refunds, payment counts, failure rate, and a time series. | "Give me a revenue summary for the last 30 days." |
|
|
266
|
+
| `stripe_analytics_get_top_customers` | Rank customers by lifetime value, MRR, or payment count. | "Who are my top 10 customers by lifetime value?" |
|
|
267
|
+
| `stripe_analytics_get_failed_payments_report` | Break down failed charges by decline code with per-customer recovery suggestions. | "List all failed payments from the last 30 days with failure reasons." |
|
|
268
|
+
|
|
269
|
+
---
|
|
270
|
+
|
|
271
|
+
## Analytics spotlight
|
|
272
|
+
|
|
273
|
+
Stripe exposes no MRR endpoint, no churn endpoint, no "revenue summary" endpoint. Every other Stripe MCP server punts on analytics. We didn't.
|
|
274
|
+
|
|
275
|
+
### What each tool returns
|
|
276
|
+
|
|
277
|
+
**`stripe_analytics_get_mrr`** — `{ total_mrr, total_mrr_formatted, mrr_by_plan, mrr_by_currency, top_customers_by_mrr, active_subscription_count, currency, computed_at }`
|
|
278
|
+
|
|
279
|
+
**`stripe_analytics_get_churn_rate`** — `{ churn_rate_percent, churned_count, active_at_period_start, period_start, period_end, interval, churned_customers: [{ subscription_id, customer_id, email, canceled_at, canceled_at_iso, lifetime_value_estimate, cancellation_reason }] }`
|
|
280
|
+
|
|
281
|
+
**`stripe_analytics_get_revenue_summary`** — `{ gross_revenue, net_revenue, refund_amount, refund_rate_percent, successful_payments, failed_payments, failure_rate_percent, avg_transaction_value, time_series: [{ date, gross, net, count }] }`
|
|
282
|
+
|
|
283
|
+
**`stripe_analytics_get_top_customers`** — `{ metric, metric_label, period_days, ranked: [{ rank, customer_id, email, name, value, value_formatted, metric_label }] }`
|
|
284
|
+
|
|
285
|
+
**`stripe_analytics_get_failed_payments_report`** — `{ total_failed_amount, count, failure_reasons_breakdown: { [decline_code]: { count, amount } }, affected_customers: [{ customer_id, email, failed_count, failed_amount, last_failure_decline_code, last_failure_at_iso, recovery_suggestion }] }`
|
|
286
|
+
|
|
287
|
+
### Sample conversation
|
|
288
|
+
|
|
289
|
+
> **You**: Show me my MRR and which plan is growing fastest.
|
|
290
|
+
|
|
291
|
+
`stripe_analytics_get_mrr` runs, paginates every active subscription, normalizes yearly/weekly/daily prices to monthly, and returns:
|
|
292
|
+
|
|
293
|
+
```json
|
|
294
|
+
{
|
|
295
|
+
"total_mrr": 5280.00,
|
|
296
|
+
"total_mrr_formatted": "$5280.00",
|
|
297
|
+
"mrr_by_plan": {
|
|
298
|
+
"Pro": { "mrr": 3000.00, "customer_count": 150 },
|
|
299
|
+
"Annual": { "mrr": 2280.00, "customer_count": 190 }
|
|
300
|
+
},
|
|
301
|
+
"mrr_by_currency": { "usd": 5280.00, "eur": 1190.00 },
|
|
302
|
+
"top_customers_by_mrr": [
|
|
303
|
+
{ "customer_id": "cus_1", "email": "acme@example.com", "name": "Acme", "mrr": 499.00, "mrr_formatted": "$499.00" },
|
|
304
|
+
{ "customer_id": "cus_2", "email": "globex@example.com", "name": "Globex", "mrr": 299.00, "mrr_formatted": "$299.00" }
|
|
305
|
+
],
|
|
306
|
+
"active_subscription_count": 340,
|
|
307
|
+
"currency": "usd",
|
|
308
|
+
"computed_at": "2025-01-15T10:30:00.000Z"
|
|
309
|
+
}
|
|
310
|
+
```
|
|
311
|
+
|
|
312
|
+
The LLM reads the JSON, you get a natural-language answer: _"Your MRR is $5,280.00 across 340 active subscriptions. The Pro plan is growing fastest — it's contributing $3,000/mo across 150 customers vs the Annual plan at $2,280/mo across 190 customers. You also have €1,190/mo in EUR. Your top MRR customer is Acme at $499/mo."_
|
|
313
|
+
|
|
314
|
+
No CSV exports, no SQL, no ChartMogul subscription. Just ask.
|
|
315
|
+
|
|
316
|
+
---
|
|
317
|
+
|
|
318
|
+
## Example prompts
|
|
319
|
+
|
|
320
|
+
Curated power-user prompts. Drop these into Claude/Cursor/Windsurf and watch them chain multiple tools together.
|
|
321
|
+
|
|
322
|
+
1. **"Show me my MRR and which plan is growing fastest."**
|
|
323
|
+
2. **"Cancel the subscription for john@example.com and refund his last invoice."**
|
|
324
|
+
3. **"List all failed payments from the last 30 days with failure reasons."**
|
|
325
|
+
4. **"Create a 3-month 50% off coupon and generate a payment link for the Pro plan."**
|
|
326
|
+
5. **"Who are my top 10 customers by lifetime value?"**
|
|
327
|
+
6. **"Pause every subscription for customer cus_abc and tell me when you're done."**
|
|
328
|
+
7. **"Finalize and send all open invoices."**
|
|
329
|
+
8. **"What's my churn rate over the last 90 days?"**
|
|
330
|
+
|
|
331
|
+
---
|
|
332
|
+
|
|
333
|
+
## Safety
|
|
334
|
+
|
|
335
|
+
### Test vs live mode
|
|
336
|
+
|
|
337
|
+
stripe-mcp detects your key prefix at startup and warns you clearly:
|
|
338
|
+
|
|
339
|
+
```
|
|
340
|
+
⚠️ LIVE MODE — real money affected. Proceed with caution.
|
|
341
|
+
```
|
|
342
|
+
|
|
343
|
+
or
|
|
344
|
+
|
|
345
|
+
```
|
|
346
|
+
✓ Test mode (no real charges).
|
|
347
|
+
```
|
|
348
|
+
|
|
349
|
+
- **`sk_test_...`** → test mode. No real charges, no real customers, no real money. Recommended for first runs.
|
|
350
|
+
- **`sk_live_...`** → live mode. Real money. stripe-mcp logs a loud warning on startup.
|
|
351
|
+
|
|
352
|
+
**Start with a test key.** Don't wire a live key into Claude Desktop until you've poked around test mode for an afternoon.
|
|
353
|
+
|
|
354
|
+
### Read-only vs destructive tools
|
|
355
|
+
|
|
356
|
+
**Read-only (safe to let the LLM run freely):**
|
|
357
|
+
|
|
358
|
+
- `*_get`, `*_list`, `*_search`
|
|
359
|
+
- `stripe_balance_get`, `stripe_balance_list_transactions`
|
|
360
|
+
- All five `stripe_analytics_*` tools
|
|
361
|
+
|
|
362
|
+
**Destructive (real money / state changes):**
|
|
363
|
+
|
|
364
|
+
- `*_create`, `*_update`, `*_delete`, `*_cancel`
|
|
365
|
+
- `stripe_refunds_create`, `stripe_invoices_pay`, `stripe_invoices_void`
|
|
366
|
+
- `stripe_subscriptions_cancel`, `stripe_customers_delete`, `stripe_webhooks_delete`
|
|
367
|
+
- `stripe_payouts_create`, `stripe_payouts_cancel`
|
|
368
|
+
- `stripe_checkout_expire_session`, `stripe_disputes_close`
|
|
369
|
+
|
|
370
|
+
The MCP protocol doesn't (yet) have a built-in read-only mode — your client
|
|
371
|
+
may. For full safety, point Claude at a test-mode key and a restricted key
|
|
372
|
+
with only the permissions you want to grant.
|
|
373
|
+
|
|
374
|
+
---
|
|
375
|
+
|
|
376
|
+
## Architecture
|
|
377
|
+
|
|
378
|
+
- **ESM-first.** Node 20+, no CommonJS interop. `tsup` builds `dist/index.js` with a `#!/usr/bin/env node` banner.
|
|
379
|
+
- **TypeScript strict.** `strict`, `exactOptionalPropertyTypes`, `noUncheckedIndexedAccess`, `noImplicitOverride`. Zero `any` anywhere.
|
|
380
|
+
- **Zod-validated inputs.** Every tool declares a zod schema, calls `safeParse`, and returns `Validation error: ...` on bad input. The JSON-Schema in the MCP manifest is mirrored by hand from the zod schema so the LLM sees accurate descriptions.
|
|
381
|
+
- **stdio transport only.** No HTTP server, no ports, no auth. Universal MCP standard for local tools.
|
|
382
|
+
- **Mocked tests.** `vi.mock()` on the Stripe client. No real Stripe calls in CI.
|
|
383
|
+
- **Auto-pagination.** `paginateAll<T>` walks every page (capped by `max_items`, default 1000) and returns `{ total_count, has_more, data }`.
|
|
384
|
+
- **`buildStripeParams<P>`** helper that drops `undefined` keys so zod-validated input flows into typed Stripe SDK calls without fighting `exactOptionalPropertyTypes`.
|
|
385
|
+
|
|
386
|
+
See [`DECISIONS.md`](./DECISIONS.md) for the why behind each of these.
|
|
387
|
+
|
|
388
|
+
---
|
|
389
|
+
|
|
390
|
+
## Development
|
|
391
|
+
|
|
392
|
+
```bash
|
|
393
|
+
git clone https://github.com/guillaumeCode2012/stripe-mcp.git
|
|
394
|
+
cd stripe-mcp
|
|
395
|
+
npm install
|
|
396
|
+
npm run build
|
|
397
|
+
npm test
|
|
398
|
+
npm run typecheck
|
|
399
|
+
npm run lint
|
|
400
|
+
```
|
|
401
|
+
|
|
402
|
+
See [`CONTRIBUTING.md`](./CONTRIBUTING.md) for the full guide — adding a new
|
|
403
|
+
tool takes about 15 minutes and follows a strict template (zod schema, mirrored
|
|
404
|
+
JSON-Schema, `buildStripeParams<P>` for the Stripe call, `formatStripeError`
|
|
405
|
+
on catch, `paginateAll` for lists).
|
|
406
|
+
|
|
407
|
+
---
|
|
408
|
+
|
|
409
|
+
## Contributing
|
|
410
|
+
|
|
411
|
+
PRs welcome. The codebase is structured so that adding a tool never causes
|
|
412
|
+
merge conflicts with other contributors — each category lives in its own
|
|
413
|
+
folder under `src/tools/`, registers itself in a category barrel, and the
|
|
414
|
+
top-level `src/tools/index.ts` simply spreads every category into
|
|
415
|
+
`allTools`. Read [`CONTRIBUTING.md`](./CONTRIBUTING.md) for the tool template,
|
|
416
|
+
code style rules, and PR checklist.
|
|
417
|
+
|
|
418
|
+
---
|
|
419
|
+
|
|
420
|
+
## License
|
|
421
|
+
|
|
422
|
+
MIT © stripe-mcp contributors. See [`LICENSE`](./LICENSE).
|
|
423
|
+
|
|
424
|
+
## Acknowledgements
|
|
425
|
+
|
|
426
|
+
- [Stripe](https://stripe.com/) — for the SDK and the platform this server wraps.
|
|
427
|
+
- [Model Context Protocol](https://modelcontextprotocol.io/) — for the protocol and TypeScript SDK.
|
|
428
|
+
- [zod](https://zod.dev) — for runtime input validation that makes this all type-safe.
|