mcp-stripe-revenue-server
Read-only MCP server for Stripe revenue reporting, exposing four tools that return per-currency figures without mixing currencies.
get_mrr: current MRR/ARR per currency, subscription and customer counts, and skipped non-fixed-price items.get_churn: subscription and customer churn rates over a 1–365 day window, plus churned MRR per currency.list_failed_payments: attempted but unpaid/open/uncollectible invoices over a 1–365 day window, with optional limit, totals per currency, and customer/attempt details.revenue_summary: one-call overview combining current MRR, collected cash, failed payment totals, and churn.Supports deterministic demo data without a Stripe key or live Stripe data via a restricted read-only API key; tools are read-only and idempotent, with amounts in minor units and formatted strings.
Provides read-only revenue analytics for a Stripe account, including current MRR/ARR by currency, subscription and customer churn, failed payment listings, and a combined revenue summary covering collected cash, failed payments, and churn.
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., "@mcp-stripe-revenue-server show me my current MRR and ARR by currency"
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.
mcp-stripe-revenue-server
A Model Context Protocol server that answers revenue questions about a Stripe account: current MRR, churn, failed payments and a one-call summary. It is read-only, speaks MCP over stdio, and ships with a deterministic demo dataset so you can try every tool without a Stripe key.
Four tools:
get_mrr,get_churn,list_failed_payments,revenue_summary.Correct MRR: monthly, quarterly, yearly, weekly and daily prices are normalized; quantities and active
percent_off/amount_offdiscounts are applied; canceled and incomplete subscriptions are ignored.Never mixes currencies: every figure is grouped per currency.
Read-only by construction: the Stripe client is only ever used for
listandretrievecalls.Testable: all data access sits behind a
RevenueSourceinterface; the calculations are pure functions.
Quick start (no Stripe key needed)
Requires Node.js 20 or newer to run the server (engines in package.json). Running the tests and building from source needs Node.js 22.12 or newer, because the test runner does; it was developed and tested on Node 22.19.
git clone https://github.com/kienpt91/mcp-stripe-revenue-server.git
cd mcp-stripe-revenue-server
npm install
npm run build
node dist/cli.js --demo--demo serves built-in sample data with a fixed clock (2025-06-15 12:00 UTC), so the output below is identical on every run. The server waits for an MCP client on stdin/stdout; point a client at it as shown next.
Related MCP server: indie-metrics-mcp
Connect an MCP client
Any MCP client that can launch a stdio server accepts a configuration of this shape. Use the absolute path to dist/cli.js:
{
"mcpServers": {
"stripe-revenue": {
"command": "node",
"args": ["/absolute/path/to/mcp-stripe-revenue-server/dist/cli.js"],
"env": {
"STRIPE_API_KEY": "rk_live_your_restricted_key"
}
}
}
}To try it with sample data instead, drop the env block and add the flag:
{
"mcpServers": {
"stripe-revenue-demo": {
"command": "node",
"args": ["/absolute/path/to/mcp-stripe-revenue-server/dist/cli.js", "--demo"]
}
}
}Without --demo the process exits with an error unless STRIPE_API_KEY is set. Diagnostics go to stderr; stdout is reserved for the protocol.
Tools
All tools are annotated readOnlyHint: true. Amounts are integers in the currency's minor unit (cents), each with a ...Formatted decimal string next to it. Currency codes are lowercase ISO 4217.
Tool | Arguments | Returns |
| none | MRR and ARR per currency, subscription and customer counts, and |
|
| Subscription churn, customer churn and churned MRR per currency over the window |
|
| Unpaid invoices that were attempted, newest first, with totals per currency |
|
| MRR, cash collected, failed payment totals and churn in one response |
The JSON below is the real output of node dist/cli.js --demo.
get_mrr
{
"asOf": "2025-06-15T12:00:00.000Z",
"byCurrency": [
{
"currency": "eur",
"mrr": 7800,
"mrrFormatted": "78.00 EUR",
"arr": 93600,
"arrFormatted": "936.00 EUR",
"subscriptions": 2,
"customers": 2
},
{
"currency": "gbp",
"mrr": 5000,
"mrrFormatted": "50.00 GBP",
"arr": 60000,
"arrFormatted": "600.00 GBP",
"subscriptions": 1,
"customers": 1
},
{
"currency": "jpy",
"mrr": 30000,
"mrrFormatted": "30000 JPY",
"arr": 360000,
"arrFormatted": "360000 JPY",
"subscriptions": 1,
"customers": 1
},
{
"currency": "usd",
"mrr": 67133,
"mrrFormatted": "671.33 USD",
"arr": 805600,
"arrFormatted": "8056.00 USD",
"subscriptions": 11,
"customers": 10
}
],
"skippedItems": 1
}The usd figure is 11 subscriptions, including a yearly plan (1200.00/year counts as 100.00/month), a weekly plan, a 5-seat plan with 20% off until October, a plan with 10.00 off every invoice, one past-due subscription, and one subscription with a flat item plus a metered item (the metered item is counted in skippedItems).
get_churn
{
"period": {
"from": "2025-05-16T12:00:00.000Z",
"to": "2025-06-15T12:00:00.000Z"
},
"subscriptions": {
"activeAtStart": 16,
"canceled": 3,
"churnRate": 0.1875,
"newInPeriod": 3
},
"customers": {
"activeAtStart": 15,
"churned": 2,
"churnRate": 0.1333
},
"revenueByCurrency": [
{
"currency": "eur",
"mrrAtStart": 11700,
"mrrAtStartFormatted": "117.00 EUR",
"mrrChurned": 3900,
"mrrChurnedFormatted": "39.00 EUR",
"churnRate": 0.3333
},
{
"currency": "gbp",
"mrrAtStart": 5000,
"mrrAtStartFormatted": "50.00 GBP",
"mrrChurned": 0,
"mrrChurnedFormatted": "0.00 GBP",
"churnRate": 0
},
{
"currency": "jpy",
"mrrAtStart": 30000,
"mrrAtStartFormatted": "30000 JPY",
"mrrChurned": 0,
"mrrChurnedFormatted": "0 JPY",
"churnRate": 0
},
{
"currency": "usd",
"mrrAtStart": 62133,
"mrrAtStartFormatted": "621.33 USD",
"mrrChurned": 6800,
"mrrChurnedFormatted": "68.00 USD",
"churnRate": 0.1094
}
]
}list_failed_payments
Called with { "limit": 2 }. totalCount and byCurrency cover every match; limit only truncates invoices.
{
"period": {
"from": "2025-05-16T12:00:00.000Z",
"to": "2025-06-15T12:00:00.000Z"
},
"totalCount": 4,
"customers": 4,
"byCurrency": [
{
"currency": "eur",
"count": 1,
"amountDue": 3900,
"amountDueFormatted": "39.00 EUR"
},
{
"currency": "usd",
"count": 3,
"amountDue": 10800,
"amountDueFormatted": "108.00 USD"
}
],
"invoices": [
{
"id": "in_demo_failed_2",
"customerId": "cus_demo_05",
"customerEmail": "ops@fabrikam.example",
"amountDue": 3900,
"amountDueFormatted": "39.00 EUR",
"currency": "eur",
"attemptCount": 1,
"status": "open",
"created": "2025-06-14T09:00:00.000Z",
"nextPaymentAttempt": "2025-06-16T09:00:00.000Z"
},
{
"id": "in_demo_failed_1",
"customerId": "cus_demo_10",
"customerEmail": "billing@northwind.example",
"amountDue": 4900,
"amountDueFormatted": "49.00 USD",
"currency": "usd",
"attemptCount": 2,
"status": "open",
"created": "2025-06-10T09:00:00.000Z",
"nextPaymentAttempt": "2025-06-17T09:00:00.000Z"
}
]
}revenue_summary
{
"period": {
"from": "2025-05-16T12:00:00.000Z",
"to": "2025-06-15T12:00:00.000Z"
},
"mrr": {
"asOf": "2025-06-15T12:00:00.000Z",
"byCurrency": [
{
"currency": "eur",
"mrr": 7800,
"mrrFormatted": "78.00 EUR",
"arr": 93600,
"arrFormatted": "936.00 EUR",
"subscriptions": 2,
"customers": 2
},
{
"currency": "gbp",
"mrr": 5000,
"mrrFormatted": "50.00 GBP",
"arr": 60000,
"arrFormatted": "600.00 GBP",
"subscriptions": 1,
"customers": 1
},
{
"currency": "jpy",
"mrr": 30000,
"mrrFormatted": "30000 JPY",
"arr": 360000,
"arrFormatted": "360000 JPY",
"subscriptions": 1,
"customers": 1
},
{
"currency": "usd",
"mrr": 67133,
"mrrFormatted": "671.33 USD",
"arr": 805600,
"arrFormatted": "8056.00 USD",
"subscriptions": 11,
"customers": 10
}
],
"skippedItems": 1
},
"collected": [
{
"currency": "eur",
"collected": 3900,
"collectedFormatted": "39.00 EUR",
"invoices": 1,
"customers": 1
},
{
"currency": "gbp",
"collected": 15000,
"collectedFormatted": "150.00 GBP",
"invoices": 1,
"customers": 1
},
{
"currency": "jpy",
"collected": 30000,
"collectedFormatted": "30000 JPY",
"invoices": 1,
"customers": 1
},
{
"currency": "usd",
"collected": 45000,
"collectedFormatted": "450.00 USD",
"invoices": 9,
"customers": 8
}
],
"failedPayments": {
"totalCount": 4,
"customers": 4,
"byCurrency": [
{
"currency": "eur",
"count": 1,
"amountDue": 3900,
"amountDueFormatted": "39.00 EUR"
},
{
"currency": "usd",
"count": 3,
"amountDue": 10800,
"amountDueFormatted": "108.00 USD"
}
]
},
"churn": {
"subscriptions": {
"activeAtStart": 16,
"canceled": 3,
"churnRate": 0.1875,
"newInPeriod": 3
},
"customers": {
"activeAtStart": 15,
"churned": 2,
"churnRate": 0.1333
}
}
}How the numbers are calculated
MRR
Subscriptions in status
activeorpast_duecount.trialing,unpaid,paused,incomplete,incomplete_expiredandcanceleddo not.Each item contributes
unit_amount x quantity, converted to a month:year/ 12,weekx 52/12,dayx 365/12, andinterval_countdivides further (a quarterly price ismonthwithinterval_count3).Discounts attached to the subscription apply in order when active at the time of the call:
percent_offscales the running total,amount_offis taken off each invoice and converted to a monthly amount using the billing interval.foreverdiscounts always apply;repeatingdiscounts apply between theirstartandend;oncediscounts never recur, so they are ignored. Anamount_offin a different currency than the subscription is ignored. The result never goes below zero.Totals are summed per currency and rounded once at the end. ARR is 12 x MRR.
Prices that have no fixed amount (tiered, volume-transformed or metered) cannot be turned into MRR; they are left out and counted in
skippedItems.Prices are taken as stored on the price object, so tax is not included. Item-level and customer-level discounts are not applied.
Churn over [now - days, now)
The cohort is every subscription that existed when the window began (never-started
incompleteandincomplete_expiredexcluded). A cohort subscription is churned if it ended inside the window.churnRateisnullwhen the cohort is empty instead of dividing by zero.A customer churns only if they had a subscription at the start and have none at the end, so moving between plans is not churn.
mrrChurnedvalues churned subscriptions at the start of the window, including discounts active then.
Failed payments: invoices in status open or uncollectible with at least one payment attempt, created inside the window. amountDue is the remaining balance.
Collected revenue (in revenue_summary): amount_paid of invoices paid inside the window. For Stripe data, invoices created up to 60 days before the window are considered so that late-paid invoices are not missed. Refunds are not subtracted.
Use it with live Stripe data
In the Stripe Dashboard, create a restricted key with read-only access to Subscriptions, Invoices and Coupons. Nothing else is needed.
Put it in
STRIPE_API_KEYin your MCP client configuration (see above), or export it and runnode dist/cli.js.
Subscriptions and invoices are fetched with automatic pagination (100 per page). The server makes list and retrieve calls only. The Stripe-backed source is covered by tests against a fake client with the same list / retrieve surface; try it against a test-mode key first.
Settings, all optional environment variables:
Variable | Default | Effect |
|
| Stripe lists (subscriptions, failed and paid invoices) are cached in memory for this long, so a burst of tool calls costs one scan. Results can be that stale. |
|
| A single list read stops with a clear error once it has seen more than this many objects, instead of scanning an unbounded account. |
|
|
|
Security
Use a restricted, read-only key (
rk_...). The server never writes, but a full secret key (sk_...) would let anything with access to the process do far more; the server prints a warning to stderr when it is given one.The key is read from the environment only. It is not logged, and anything that looks like a Stripe key is redacted from error messages returned to the client.
Tool results contain customer ids and billing emails. Set
REDACT_EMAILS=trueto mask the emails, and only connect clients you trust with the rest.Dependencies are pinned to exact versions that were published at least 7 days before the pin date, installed with
--ignore-scriptsinside a throwaway container, andnpm run check:deps-ageverifies that for the whole lockfile. Advisories whose fixes are newer than that are tracked in SECURITY.md.
Project layout
Path | Purpose |
| Pure calculations: interval normalization, discounts, MRR, churn, failed payments, summary |
| Domain model and the |
|
|
| In-memory source and the deterministic demo dataset |
| TTL cache decorator for any |
| MCP tool registration, JSON presentation, email masking and key redaction |
| Argument and environment handling, and the stdio entry point |
To plug in another data source, implement RevenueSource (three async methods) and pass it to createRevenueServer({ source }).
Development
npm install
npm run typecheck
npm testThe tests need no network or API keys. They cover:
the calculations (interval normalization, discount windows and edge cases, per-currency grouping, zero-division in churn);
the Stripe mapping, using a fake client;
the MCP layer through the SDK client over a linked in-memory transport, and against a real
--demochild process over stdio;the cache (TTL expiry, shared in-flight requests, no cached failures) and the max-items guard;
this README: every JSON example above is compared with the live tool output.
npm run demo runs the CLI in demo mode straight from the TypeScript sources.
Secrets and hooks
Never commit
.envfiles or credentials. Copy.env.exampleto.envfor local settings;.envis gitignored.Install lefthook and run
lefthook installonce per clone. This enables two hooks fromlefthook.yml:pre-commitrunssh scripts/secret-scan.sh --stagedand blocks a commit that stages a secret.pre-pushrunssh scripts/secret-scan.sh --treeand blocks a push if the working tree contains one.
The scanner (
scripts/secret-scan.sh) has no dependencies. It flags secret-shaped values and forbidden file names, and prints the file, line and rule but never the value. CI also scans the tree and the full history.A reviewed false positive can be listed in
.secret-scan-allow, one line per file and rule:<path> <rule> # reason. A single line can be allowed with the inline markersecret-scan: allow. Keep entries specific and never allow a real credential.If a secret is ever committed, rotate it first (assume it is compromised), then remove it from history.
Releasing
Releases are cut by pushing a vMAJOR.MINOR.PATCH tag. The release workflow then verifies the code, builds the files, writes SHA256SUMS, attests where they were built and creates the GitHub release. See RELEASING.md for how to cut a release and how to verify a download with gh attestation verify.
License
MIT
Available Tools
4 toolsget_churnSubscription and customer churnARead-onlyIdempotent
Churn over the last N days: subscriptions and customers that existed at the start of the window and had ended by its close, as a rate (null when nothing existed at the start), plus churned MRR per currency.
Inputs: days.
get_mrrMonthly recurring revenueARead-onlyIdempotent
Current MRR and ARR per currency. Counts active and past_due subscriptions, normalizes yearly/weekly/daily/multi-month prices and quantities to a monthly amount, and applies percent_off / amount_off discounts that are active right now. Amounts are in minor units (cents); currencies are never combined.
Inputs: no named parameters.
list_failed_paymentsFailed paymentsARead-onlyIdempotent
Invoices from the last N days that Stripe tried to collect at least once and that are still unpaid (open or uncollectible), newest first, with amount, customer and attempt count. Totals cover every match; limit only truncates the invoice list.
Inputs: days, limit.
revenue_summaryRevenue summaryARead-onlyIdempotent
One-call overview for the last N days: current MRR, cash collected from paid invoices, failed payment totals and churn. Every money figure is grouped per currency.
Inputs: days.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 4 tools
Each tool has a distinct primary purpose: MRR, churn, failed payments, and an aggregate overview. The only overlap is that revenue_summary repeats metrics available from the individual tools, but its description clearly frames it as a one-call overview, making selection mostly clear.
Names are all snake_case and mostly follow a verb_noun pattern (get_mrr, get_churn, list_failed_payments). revenue_summary is a noun phrase rather than verb_noun, which is a minor deviation but still understandable and predictable.
Four tools is well-scoped for a focused Stripe revenue metrics server. Each tool covers a distinct metric area, and the aggregate summary tool adds convenience without overwhelming the surface.
The set covers core revenue analytics: MRR/ARR, churn, failed payments, and a summary with cash collected. Minor gaps exist around deeper drill-downs such as per-customer revenue or successful invoice listings, but the main metrics are fully represented.
Related MCP Connectors
Read-only revenue analytics from Stripe, Paddle, Polar, Lemon Squeezy, Creem and Freemius.
Read-only MCP over your own revenue and net margin across 14 billing rails
Read-only revenue, subscriptions, customers, and experiments tools for ZeroSettle accounts.
Stripe MCP Pack — read-only access to Stripe data via API key.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceRead-only Stripe finance, ops, and risk reporting exposed via MCP, HTTP API, and CLI. Enables querying balances, payments, customers, payouts, reconciliation, and risk alerts without mutating Stripe state.MIT
- AlicenseAqualityDmaintenanceMCP server that gives AI assistants real-time access to Stripe business metrics like MRR, churn, and revenue forecasts via natural language queries.7MIT
- AlicenseAqualityDmaintenanceProvides real-time Stripe subscription analytics including MRR, churn, failed payments, and expiring trials. Enables AI assistants to answer business health questions like 'How's my business doing?'8MIT
- AlicenseAqualityCmaintenanceEnables AI agents to query Stripe operations such as customers, recent charges, duplicate charges, and revenue summaries through read-only MCP tools.4MIT