subscribe-mcp
Click on "Install 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., "@subscribe-mcpshow platform statistics"
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.
Subscribe MCP - SaaS Subscription Backend
A TypeScript/Express backend for a SaaS subscription workflow with Razorpay test payments, PostgreSQL persistence, Redis-backed background jobs, invoice emails, cached platform statistics, and an MCP server that exposes subscription insights to AI clients.
What This Project Includes
Plan catalog seeded with Basic, Pro, and Premium subscription plans.
Checkout API that creates Razorpay test orders.
Verified Razorpay webhook endpoint for successful payment events.
Subscription lifecycle handling with trial, active, failed, refunded, and expired states.
PDF invoice generation and Mailtrap email delivery.
Daily renewal scanner plus a BullMQ worker for renewal reminder emails.
Redis-cached platform statistics.
MCP tools for AI clients:
get_platform_statsget_plans
Related MCP server: Shopify MCP Server
Tech Stack
Area | Technology |
Runtime | Node.js, TypeScript |
API | Express |
Database | PostgreSQL, Prisma |
Cache and jobs | Redis, BullMQ |
Payments | Razorpay test mode |
Email testing | Mailtrap SMTP |
Background scheduling | node-cron |
AI integration | Model Context Protocol over stdio |
Prerequisites
Install these before running the project:
Local Setup
Install dependencies:
npm installStart PostgreSQL and Redis:
docker compose up -dThe Compose file starts:
Service | Host URL |
PostgreSQL |
|
Redis |
|
Create your local environment file:
cp .env.example .envOn Windows PowerShell:
Copy-Item .env.example .envFill in
.envusing the credential guide below.Apply database migrations:
npx prisma migrate deploySeed the subscription plans:
npx prisma db seedStart the API server:
npm run devThe server runs at:
http://localhost:3000Environment Configuration
Use .env.example as the safe template. Never commit your real .env file.
Database and Redis
These values work with the included Docker Compose setup:
DATABASE_URL="postgresql://saas_user:saas_password@localhost:5433/saas_db?schema=public"
REDIS_URL="redis://localhost:6379"Razorpay Test Credentials
Create or log in to a Razorpay account.
Switch to test mode in the Razorpay dashboard.
Go to Account & Settings > API Keys.
Generate a test key pair.
Copy the values into
.env:
RAZORPAY_KEY_ID="rzp_test_xxxxxxxxxxxxx"
RAZORPAY_KEY_SECRET="your_test_secret"For webhook testing, first run the API and ngrok tunnel. For the complete payment test, see Webhook Flow. ngrok prints a public Forwarding URL in the terminal, for example:
Forwarding https://abc123.ngrok-free.app -> http://localhost:3000Copy that HTTPS URL and add /api/webhooks/payment at the end. Then add the full URL in the Razorpay dashboard:
Webhook URL: https://abc123.ngrok-free.app/api/webhooks/payment
Events: payment.captured, payment.failedYou can also see the full step-by-step Razorpay webhook instructions in .env.example.
Then copy the webhook signing secret into:
RAZORPAY_WEBHOOK_SECRET="your_webhook_secret"Mailtrap SMTP Credentials
Create or log in to Mailtrap.
Open an Email Testing inbox.
Copy the SMTP host, port, username, and password.
Add them to
.env:
MAILTRAP_HOST="sandbox.smtp.mailtrap.io"
MAILTRAP_PORT="2525"
MAILTRAP_USER="your_mailtrap_username"
MAILTRAP_PASS="your_mailtrap_password"
MAILTRAP_FROM="billing@taskflow-demo.test"Running the Application
Always open Docker Desktop first. PostgreSQL and Redis must be running before the app starts:
docker compose up -dFor the complete local demo, run everything together with one command:
npm run dev:allThis starts:
API server on
http://localhost:3000ngrok tunnel for Razorpay webhooks
renewal reminder worker
If you want to run each process separately, use the commands below.
Run the API only:
npm run devRun the renewal reminder worker in a separate terminal:
npm run workerRun the ngrok tunnel in another terminal:
npm run tunnelOpen Prisma Studio to view database tables in the browser:
npx prisma studioBuild and run production output:
npm run build
npm startVerify Everything Works
1. Check infrastructure
docker compose psYou should see saas_postgres and saas_redis running.
2. Check the API
curl http://localhost:3000/healthExpected response:
{
"status": "ok",
"timestamp": "..."
}You can also open the application in your browser:
http://localhost:3000From there, select a plan and complete a Razorpay test payment. After payment succeeds, Razorpay sends the webhook to the ngrok URL, and the backend activates the subscription, generates the invoice, and sends the confirmation email.
3. Confirm plans were seeded
curl http://localhost:3000/api/plansYou should see the Basic, Pro, and Premium plans.
4. Create a checkout order
curl -X POST http://localhost:3000/api/checkout \
-H "Content-Type: application/json" \
-d "{\"name\":\"Demo User\",\"email\":\"demo@example.com\",\"planName\":\"Pro\"}"Expected result:
A new pending subscription is stored in PostgreSQL.
A Razorpay test order is returned.
The response includes the public Razorpay key id.
5. Verify platform stats
curl http://localhost:3000/api/statsThe first request computes stats from PostgreSQL. Repeated requests within 30 seconds should return cached stats from Redis.
6. Verify background processes
Start the worker:
npm run workerIn another terminal, manually trigger the renewal scanner:
curl -X POST http://localhost:3000/api/dev/trigger-renewal-scanExpected behavior:
The API activates any expired trials.
Subscriptions expiring within 3 days are queued in Redis.
The worker processes queued renewal reminders.
Renewal emails appear in Mailtrap.
Webhook Flow
For a full payment test:
Start the API:
npm run devStart ngrok:
npm run tunnelCopy the HTTPS
ForwardingURL printed by ngrok:
Forwarding https://abc123.ngrok-free.app -> http://localhost:3000Add
/api/webhooks/paymentto that URL and paste it into the Razorpay webhook settings:
https://abc123.ngrok-free.app/api/webhooks/paymentSelect these webhook events:
payment.captured
payment.failedSave the webhook and copy the webhook signing secret into
RAZORPAY_WEBHOOK_SECRETin.env.Restart the API after changing
.env.Create a checkout order through
POST /api/checkout.Complete the payment in Razorpay test mode.
Razorpay sends the webhook to the public ngrok URL, and ngrok forwards it to
http://localhost:3000/api/webhooks/payment.The API verifies the signature, activates the subscription, generates an invoice, and sends a confirmation email through Mailtrap.
API Reference
Method | Endpoint | Purpose |
|
| Health check |
|
| List available plans |
|
| Create a subscription and Razorpay order |
|
| Receive Razorpay webhook events |
|
| Get cached platform statistics |
|
| Manually run the renewal scanner |
Checkout request body:
{
"name": "Demo User",
"email": "demo@example.com",
"planName": "Pro"
}Expose the MCP Tool to an AI Client
The MCP server runs over stdio and uses the same .env values as the API.
Run it directly:
npm run mcpYou do not need to run this every time. Run npm run mcp only when you want to test the MCP server directly or connect it to an AI client.
Supported AI Desktop Clients
The easiest desktop app for this setup is Claude Desktop, because it supports local stdio MCP servers with an mcpServers JSON config.
Other MCP-compatible tools may also work, such as Claude Code, Cursor, Windsurf, VS Code MCP extensions, or any AI client that supports local stdio MCP servers. Their setup screens may be different, but the same command, args, and cwd values are used.
Add This MCP Server in Claude Desktop
Make sure the backend setup is complete:
docker compose up -d
npx prisma migrate deploy
npx prisma db seedMake sure
.envexists and has the required database, Redis, Razorpay, and Mailtrap values.Open Claude Desktop.
Open Settings > Developer > Edit Config.
On Windows, Claude Desktop opens this file:
%APPDATA%\Claude\claude_desktop_config.jsonAdd this MCP server config:
{
"mcpServers": {
"saas-platform-stats": {
"command": "npm",
"args": ["run", "mcp"],
"cwd": "/absolute/path/to/saas-backend"
}
}
}On this machine, the project path is:
D:\Bitcot-Task\saas-backendFor Windows-based clients, use escaped backslashes:
{
"mcpServers": {
"saas-platform-stats": {
"command": "npm",
"args": ["run", "mcp"],
"cwd": "D:\\Bitcot-Task\\saas-backend"
}
}
}Save the config file.
Fully quit and reopen Claude Desktop.
Start a new Claude chat and ask:
Use the saas-platform-stats MCP server and show me the available subscription plans.You should see Claude use the get_plans tool.
Example AI prompts you can ask:
How many active subscribers do we have right now?
What subscription plans do we offer?
What's the price of the Pro plan?
How much total revenue have we generated so far?You do not need to run npm run mcp manually when Claude Desktop is configured. Claude Desktop starts the MCP server automatically from the config. Run npm run mcp manually only when you want to test the MCP server directly from the terminal.
Available MCP tools:
Tool | Description |
| Returns active subscribers, trialing subscribers, total revenue, and revenue by plan |
| Returns the available subscription plans with pricing, trials, and features |
Before using MCP, make sure PostgreSQL and Redis are running and the database has been migrated and seeded.
Project Structure
src/
config/ Environment and Redis configuration
controllers/ Express request handlers
db/ Prisma client
jobs/ Cron scanner, BullMQ queue, and worker
mcp/ MCP stdio server
routes/ API route registration
services/ Business logic for payments, subscriptions, stats, invoices, email
prisma/
schema.prisma Database schema
seed.ts Default plan seed data
public/ Static assets
storage/ Generated invoice filesTroubleshooting
Problem | Fix |
| Confirm |
Cannot connect to PostgreSQL | Run |
Cannot connect to Redis | Confirm |
No plans returned | Run |
Razorpay webhook rejected | Confirm |
Emails not appearing | Confirm Mailtrap SMTP credentials and keep |
MCP client cannot start server | Use an absolute |
Author
For any queries, contact sharifasheriff26@gmail.com.
LinkedIn: sharifa-sheriff
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Latest Blog Posts
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/Sharifa26/subscribe-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server