mcp server
saas-master-builder
π The Autonomous Engineering OS & Breakthrough Toolkit for Unbreakable Multi-Tenant SaaS. 21 Blueprints, Postgres RLS, Stripe Idempotency, Ed25519 Licensing, Native MCP Server & Zero-Hallucination AI
Set up
Runs on your computer. Pick your agent and operating system.
Before you start
- Node.js 20 or newer
{
"mcpServers": {
"saas-master-builder": {
"command": "npx",
"args": [
"-y",
"saas-master-builder"
]
}
}
}same format Cursor, GitHub Copilot CLI, Junie, JetBrains AI Assistant, Augment (Auggie CLI), Factory Droid, Kiro, Devin CLI +12
Values in angle brackets are placeholders. Restart Claude Desktop after editing its config.Claude Desktop docs
README
synced Oct 21, 2026SaaS Master Builder (SMB) π
____ ____ __ __ _
/ ___| __ _ __ _ / ___| | \/ | __ _ ___| |_ ___ _ __
\___ \ / _` |/ _` |\___ \ | |\/| |/ _` / __| __/ _ \ '__|
___) | (_| | (_| | ___) | | | | | (_| \__ \ || __/ |
|____/ \__,_|\__,_|____/ |_| |_|\__,_|___/\__\___|_|
B U I L D E R
The Autonomous Engineering OS, Decision Framework & Production Breakthrough Toolkit for Unbreakable Multi-Tenant SaaS.
Engineered by JME TECHNOLOGIES LLP β’ Official Cloud & VPS Partner: JME VPS (jmevps.com)
Turn any AI Coding Agent into a 10x Principal SaaS Architect.
Zero Hallucinations. Zero Cross-Tenant Leaks. Zero Payment Race Conditions. 100% Client Satisfaction.
Quickstart β’ Architecture β’ Blueprints β’ VPS Hosting β’ Anti-Hallucination Gate β’ VS Code Extension β’ Sponsor
π₯ Why 99% of AI-Built SaaS Projects Crash in Production
When developers let AI coding agents build SaaS apps without guardrails, catastrophic failure modes consistently emerge:
- Cross-Tenant Data Leaks: The AI relies on developers remembering
WHERE tenant_id = ?in raw queries. One missed filter exposes Customer A's sensitive financial data to Customer B. - Stripe Webhook Double-Charges: The AI builds simple webhook routes without idempotency tables. Stripe's at-least-once delivery fires retries, causing double-charges, duplicated credits, and billing disputes.
- The "100% Done" Hallucination: AI agents routinely declare tasks "tested and complete" when tests were never executed, APIs were hallucinated, and builds don't even compile.
- Fragile Licensing: Offline or desktop apps hard-lock the moment a user's Wi-Fi drops for 10 seconds, triggering wave after wave of angry support tickets.
- Client Handoff Nightmares: Freelancers and agencies hand over a messy repo with no documentation, no ADRs, and no security audit proof. Clients feel cheated and refuse final milestone payments.
SaaS Master Builder (SMB) solves all five problems permanently.
β‘ The SaaS Master Builder Difference
| Feature | Standard AI Coding (Unassisted) | With SaaS Master Builder (SMB) |
|---|---|---|
| Multi-Tenancy | Developer discipline (WHERE tenant_id = ?) | Postgres Row-Level Security (RLS) at database kernel level |
| Payment Handling | Naive webhook handler (vulnerable to duplicate events) | Cryptographic signature check + Idempotency table + DLQ |
| AI Verification | AI says "I have tested this and it works" (Guesswork) | Evidence Gate (npx saas-master check-evidence) |
| Rate Limiting | In-memory counters (resets on server restart) | Distributed Redis Sliding Window (Atomic Lua Script) |
| Licensing | Simple API ping on every click (breaks offline) | Ed25519 Asymmetric Signed JWT + 7-Day Grace Cache |
| Audit Logs | Mutable table or plain text files | Append-only immutable table with SHA-256 hash chains |
| Client Delivery | Messy .zip file with broken .env instructions | Executive Client Handoff Certificate + ADRs + Runbooks |
ποΈ System Architecture
graph TD
subgraph Clients
WEB[Web Dashboard - Next.js / SvelteKit]
MOBILE[Mobile App - React Native / Flutter]
ADMIN[Internal Admin Panel]
end
subgraph Edge & Gateway
GW[API Gateway / BFF - tRPC & OpenAPI 3.1]
RATELIMIT[Redis Sliding Window Rate Limiter]
GW --- RATELIMIT
end
subgraph Core Services
AUTH[Auth & Session Service - JWT Claims]
TENANT[Tenant & RLS Scoping Middleware]
BILLING[Stripe Idempotent Billing Engine]
LICENSE[Ed25519 Cryptographic License Engine]
AIGATEWAY[AI SaaS Gateway - Token Meter & Cache]
end
subgraph Persistence Layer
DB[(PostgreSQL - RLS Multi-Tenant Isolated)]
REDIS[(Redis - Session, Sliding Window, Semantic Cache)]
AUDIT[(Immutable Audit Log - SHA-256 Hash Chain)]
end
WEB --> GW
MOBILE --> GW
ADMIN --> GW
GW --> AUTH
GW --> TENANT
GW --> BILLING
GW --> LICENSE
GW --> AIGATEWAY
TENANT --> DB
BILLING --> DB
AUTH --> REDIS
AIGATEWAY --> REDIS
TENANT --> AUDIT
π¦ Production Blueprints (blueprints/)
Battle-tested, enterprise-grade code that can be injected into any project instantly using the CLI:
1. Multi-Tenant Row-Level Security (RLS)
- Files:
blueprints/01-multi-tenant-rls/ - Features: Native PostgreSQL RLS policies, Drizzle ORM schema, Prisma transaction extension, and an automated Vitest cross-tenant leak test suite.
- Guarantee: Even if application code forgets a
WHEREclause, Postgres rejects unauthorized tenant queries.
2. Indestructible Stripe Webhook Handler
- Files:
blueprints/02-bulletproof-stripe/ - Features: HMAC-SHA256 signature verification, atomic
processed_webhook_eventsdatabase idempotency guard, subscription lifecycle state machine (trialing,active,past_due,grace_period,canceled). - Guarantee: Zero duplicate charges, zero lost events, 100% resilient to network retries.
3. Distributed Redis Sliding Window Rate Limiter
- Files:
blueprints/03-redis-sliding-window/ - Features: Atomic Lua script executing within Redis. Supports per-tenant, per-user, and per-IP rate limits with standard HTTP response headers (
X-RateLimit-Remaining,X-RateLimit-Reset). - Guarantee: Eliminates noisy-neighbor syndrome; protects against DDoS and API scrapers.
4. Asymmetric Cryptographic Offline Licensing
- Files:
blueprints/04-cryptographic-licensing/ - Features: Ed25519 private-key license issuer + public-key offline verifier. Includes anti-tamper system clock rollback detection and graceful offline degradation.
- Guarantee: Software works seamlessly during flights, field operations, and network dropouts.
5. Tamper-Proof Audit Trail & RBAC Matrix
- Files:
blueprints/05-rbac-audit-trail/ - Features: Append-only PostgreSQL audit table protected by database triggers. Generates a blockchain-like SHA-256 hash chain for SOC 2 Type II, ISO 27001, and HIPAA compliance.
6. Enterprise AI SaaS Gateway
- Files:
blueprints/06-ai-saas-gateway/ - Features: Pre-flight prompt injection shield, per-tenant token usage budget limiter, semantic caching (slashing 40β70% of LLM costs), and multi-provider fallback.
7. Self-Healing Dual-Slot Binary Auto-Updater
- Files:
blueprints/07-bulletproof-auto-updater/ - Features: Transactional update staging (
staging/->current/), Windows file-lock bypass trampoline (trampoline.bat), UAC elevation handler, and 30-second automatic healthcheck rollback. - Guarantee: Zero crashed updates, zero manual folder deletion requests to customers.
8. Universal Print & Invoice Engine
- Files:
blueprints/08-universal-print-and-invoice-engine/ - Features: Pre-printed letterhead dynamic margin offset calibrator, multi-tax breakdowns, concurrency-safe zero-gap fiscal invoice sequence generator (
get_next_fiscal_number), and ESC/POS raw byte generator for 58mm/80mm thermal receipt printers.
9. Enterprise SSO & SCIM 2.0 Identity Directory
- Files:
blueprints/09-enterprise-sso-scim/ - Features: SAML 2.0 assertion validator (Okta / Azure AD / Google Workspace), automated SCIM 2.0 user provisioning/deprovisioning webhooks, and short-lived, tamper-proof superadmin impersonation token guard.
10. Universal Outbound Webhooks Dispatcher
- Files:
blueprints/10-outbound-webhooks-engine/ - Features: Cryptographic HMAC-SHA256 request signing (
X-Hub-Signature-256), SSRF IP blocklist protection, exponential backoff retries, and delivery logging.
11. Direct-to-Storage Presigned Upload Pipeline
- Files:
blueprints/11-secure-storage-uploads/ - Features: Client direct-to-S3/R2 presigned upload URLs (zero API server memory overhead), strict MIME/magic byte validation, and sandboxed tenant folder isolation.
12. In-Memory Feature Flags & Plan Entitlements
- Files:
blueprints/12-feature-flags-entitlements/ - Features: Sub-millisecond in-memory flag evaluation, deterministic percentage canary rollouts (Murmur/SHA-256 hash), emergency kill switches, and plan tier quota gating.
13. Omni-Channel Notification Hub & In-App Inbox
- Files:
blueprints/13-omnichannel-notifications/ - Features: Compound-indexed in-app notification center inbox, unread counter management, transactional vs promotional preference checking, and digest batching.
14. High-Volume Streaming CSV Data Export Pipeline
- Files:
blueprints/14-async-export-data-pipeline/ - Features: Memory-efficient cursor-based database streaming, zero-heap-exhaustion chunking, automatic GZIP compression, and Excel CSV formula injection sanitization.
15. Observability Probes & Health Checks
- Files:
blueprints/15-observability-health-probes/ - Features: Production
/healthzliveness and/readyzreadiness endpoints, database/redis connection pool probes, memory leak warning thresholds, and W3C distributed trace correlation IDs.
16. Universal Search & pgvector Semantic Engine
- Files:
blueprints/16-universal-search-vector/ - Features: Multi-tenant full-text search (
tsvector), typo-tolerant fuzzy matching (pg_trgm), and semantic vector similarity search viapgvectorHNSW indexes with Reciprocal Rank Fusion (RRF).
17. Distributed Cron Scheduler & Leader Election
- Files:
blueprints/17-distributed-cron-scheduler/ - Features: Zero-downtime, multi-replica background job coordinator using PostgreSQL 64-bit advisory locks (
pg_try_advisory_lock), persistent execution heartbeats, and lock leak prevention.
18. B2B Developer Platform & API Key Management
- Files:
blueprints/18-api-key-management/ - Features: Enterprise developer API key generation (
sk_live_...), immutable SHA-256 hash storage, fine-grained permission scopes, usage metrics tracking, and instant zero-downtime revocation.
19. Linear-Grade Design System & State Machine
- Files:
blueprints/19-saas-design-system-tokens/ - Features: CSS custom properties design tokens, seamless dark/light modes, accessible WCAG 2.1 AA contrast, and zero-dependency React state components (EmptyState, Skeleton, ErrorBoundary, SubscriptionPaywallModal).
20. GDPR/CCPA Tenant Offboarding & Data Scrubber
- Files:
blueprints/20-gdpr-tenant-offboarding/ - Features: Lawful Right-to-be-Forgotten workflow, PII pseudonymization while preserving gapless statutory fiscal audit journals, S3/MinIO tenant prefix purging, and cryptographic HMAC-SHA256 Certificates of Destruction.
π‘οΈ The Anti-Hallucination Evidence Gate
AI agents are notorious for marking checklists [x] while generating broken code.
SaaS Master Builder enforces an automated Anti-Hallucination Gate:
npx saas-master check-evidence
The Rule:
No task in TASKS.md or LAUNCH_CHECKLIST.md can be marked complete unless accompanied by an explicit evidence: <proof> string containing actual command output, test traces, or scan links.
<!-- β REJECTED BY CLI (Fails Build) -->
- [x] Implemented multi-tenant isolation
<!-- β REJECTED BY CLI (Fails Build) -->
- [x] Implemented multi-tenant isolation β evidence: none / TODO
<!-- β
VERIFIED & APPROVED BY CLI -->
- [x] Implemented multi-tenant isolation β evidence: vitest cross-tenant-leak-test.spec.ts passed 4/4 tests in 182ms
π οΈ Quickstart in 60 Seconds
Step 1: Install or Run via NPX
# In your SaaS project root:
npx saas-master help
Step 2: Deep-Dive Domain Architecture (Stop Shallow MVPs)
# Expand any generic concept into an enterprise specification & architecture contract:
npx saas-master deep-dive "SaaS platform for private dental clinics"
Step 3: Compile God-Tier AI Agent Prompt
# Force Claude, Cursor, Devin, or Antigravity to build complete enterprise depth:
npx saas-master prompt "build dental clinic EHR with appointment locks and e-prescriptions"
Step 4: Initialize or Scaffold Your Project
# Scaffolds full repo structure with all 20 blueprints and docker stack:
npx saas-master init my-saas-platform
# Or inject specific blueprints directly into an existing project:
npx saas-master scaffold rls
npx saas-master scaffold stripe
npx saas-master scaffold search
npx saas-master scaffold all
Step 5: Connect AI IDEs via Model Context Protocol (MCP) & Git Hooks
# Start native zero-dependency MCP server for Cursor, Claude Code, and Windsurf:
npx saas-master mcp
# Install deterministic git pre-commit & pre-push verification gates:
npx saas-master hooks
Step 6: Real-Time AI Agent Code Guard
# Catches the 10 Deadly AI Coding Sins (unscoped queries, float money rounding, fake mock tests, destructive commands):
npx saas-master guard
Step 8: Autonomous System Verification & Local Event Simulator
# Verify all 6 core subsystems in 4ms (RLS, Stripe, Ed25519, Audit Hash, Gapless sequence):
npx saas-master verify
# Run local mock event simulator (test Stripe webhooks, licensing, SSO without external keys):
npx saas-master simulate all
# Run 60-second guided executive architectural tour:
npx saas-master demo
Step 9: Compile Master Architecture Handbook & Run Diagnostics
# Generates complete 33-chapter unified architecture book:
npx saas-master docs
# Verifies architecture, evidence integrity, and security gates:
npx saas-master doctor
npx saas-master benchmark
π€ Enterprise Client Handoff Kit
Want clients to give you 5-star reviews, pay final milestones without hesitation, and sign lucrative retainers?
Run:
npx saas-master report "Acme Analytics Inc."
This generates CLIENT_HANDOFF_REPORT.mdβan executive sign-off certificate including:
- Architecture Decision Records (ADRs) explaining technical choices.
- Security and Multi-Tenancy Isolation Verification proofs.
- Target Service Level Agreement (SLA) with 99.9% uptime commitment.
- Disaster Recovery Runbook with RPO < 5 mins and RTO < 30 mins.
- Formal Engineering Acceptance Sign-Off signatures.
π€ Universal AI Agent OS
SaaS Master Builder includes native configuration files that instruct ANY AI coding agent to operate as a Principal Staff Architect:
- Google Antigravity / Devin / Codex:
AGENTS.md - Claude Code (Anthropic):
CLAUDE.md&SKILL.md - Cursor IDE:
.cursorrules - Windsurf IDE:
.windsurfrules - GitHub Copilot:
.github/copilot-instructions.md
Simply drop this repository into your workspace, and your AI assistant will automatically adopt these unbreakable engineering standards!
π Complete Reference Library
Deep-dive engineering guides located in saas-master-builder/references/:
01-architecture.mdβ System layers, hexagonal design, 12-factor rules.02-multi-tenancy.mdβ Pooled vs Silo isolation, Postgres RLS, tenant identification.03-licensing-system.mdβ Asymmetric Ed25519 token licensing & offline grace periods.04-admin-panel-audit-logs.mdβ Internal admin tooling, impersonation safety, audit logs.05-web-app-sync-architecture.mdβ Eliminating client-server validation drift with OpenAPI/tRPC.06-compliance.mdβ GDPR, SOC 2, ISO 27001, and India's DPDP Act 2023.07-app-store-readiness.mdβ Play Store & Apple App Store one-shot review clearance.08-security-vulnerability-scanning.mdβ OWASP Top 10, SAST/DAST/SCA automation.09-frontend-quality.mdβ High-converting UI/UX, empty/loading/error states.10-anti-hallucination-protocol.mdβ Evidence-based software development.11-stripe-billing-and-monetization.mdβ Webhooks, dunning, proration, dispute defense.12-ai-agent-saas-integration.mdβ Semantic caching, prompt shields, token metering.13-database-migrations-disaster-recovery.mdβ Zero-downtime expand/contract, PgBouncer, PITR.14-client-handoff-enterprise-satisfaction.mdβ 5-star client satisfaction, ADRs, runbooks.15-zero-breakage-auto-update-and-distribution.mdβ Dual-slot atomic auto-updates, Windows file-lock bypass trampoline & self-healing rollback.16-universal-document-printing-hardware-engine.mdβ Pre-printed letterhead dynamic calibration, zero-gap fiscal invoice sequence generator & thermal ESC/POS printing.17-enterprise-identity-sso-scim-security.mdβ Enterprise SAML 2.0 / OIDC SSO, SCIM 2.0 automated directory sync & cryptographic superadmin impersonation.18-offline-first-crdt-sync-engine.mdβ Offline-first local mutation outbox queue, CRDTs, vector clocks & deterministic state convergence.19-bulletproof-versioning-backward-compatibility.mdβ Stripe-style date-based API transformations, additive-only evolution & 100-year backward compatibility.20-universal-outbound-webhooks.mdβ Outbound webhook dispatcher, HMAC-SHA256 signatures, SSRF IP filtering & retry queues.21-secure-object-storage-and-large-file-uploads.mdβ Direct-to-S3/R2 presigned upload pipeline with tenant sandboxing & MIME validation.22-feature-flags-remote-config-entitlements.mdβ In-memory feature flag evaluator, percentage canary rollouts & plan tier limits.23-omnichannel-notifications-and-in-app-inbox.mdβ Omni-channel notification hub, compound-indexed in-app notification center inbox.24-async-data-exports-and-etl-streaming.mdβ Streaming CSV data export worker, cursor pagination & Excel formula injection sanitization.25-internationalization-i18n-currencies-timezones.mdβ Universal UTC timestamps, integer minor-unit currencies (no float bugs) & RTL layouts.26-high-performance-search-and-pgvector.mdβ Hybrid full-text (GIN/trigram) + pgvector semantic search with Reciprocal Rank Fusion.27-distributed-cron-and-background-schedulers.mdβ PostgreSQL advisory lock leader election, singleton workers & heartbeat healthchecks.28-public-api-keys-and-developer-platform.mdβ B2B developer platform API keys, SHA-256 hashing, fine-grained scopes & key rotation.29-design-systems-and-premium-user-experience.mdβ Linear/Vercel grade design tokens, 4 canonical UI states & WCAG 2.1 AA accessibility.30-gdpr-ccpa-tenant-offboarding-and-data-scrubbing.mdβ Lawful tenant offboarding, PII anonymization, S3 purge & Certificates of Destruction.31-deep-dive-domain-expansion-and-enterprise-productization.mdβ Deep-dive domain expansion, 8 non-negotiable core modules, and eliminating toy MVPs.32-agentic-governance-surgical-editing-and-mcp.mdβ The 17 Constitutional Laws, Surgical Scope (MVD), 3-Strike Circuit Breaker, Zero Data Loss & Native MCP Server.33-fullstack-production-app-shell-and-local-sandbox.mdβ Full-stack multi-tenant dashboard app shell, 4 canonical UI states & local webhook sandbox simulator.
π§© VS Code & Cursor Extension
SaaS Master Builder includes a native editor extension in extensions/vscode-saas-master/ that exposes all verification gates directly into the Command Palette (Ctrl+Shift+P) and Status Bar:
- Status Bar Hub: Click
$(shield) SaaS Master: 100%in the bottom right to trigger any tool. - Autonomous E2E Verification: Run
SaaS Master: Autonomous E2E System Verification (4ms). - AI Agent Diff Guard: Check recent edits for the 10 Deadly AI Sins.
- Local Event Simulator: Dispatch mock Stripe webhooks, SAML assertions, and thermal print streams.
- 1-Click Blueprints: Inject any of the 21 enterprise blueprints into your workspace.
# Package into a VSIX extension:
cd extensions/vscode-saas-master
npx vsce package
π Recommended Cloud Infrastructure & VPS Hosting: JME VPS
When deploying a production multi-tenant SaaS built with SaaS Master Builder, database write performance, PostgreSQL Row-Level Security throughput, and Redis rate-limiting latency depend entirely on your underlying cloud compute and disk I/O.
We officially recommend JME VPS (jmevps.com), operated by JME TECHNOLOGIES LLP, for high-performance Linux cloud servers and container hosting:
π Why Host on JME VPS?
- Ultra-Fast PCIe Gen4 NVMe Storage: Eliminates disk I/O bottlenecks when executing PostgreSQL RLS queries, fiscal sequence locking, and SHA-256 audit log hash chains.
- Dedicated Compute Allocation: Zero noisy-neighbor CPU throttling, guaranteeing uninterrupted Redis sliding-window operations and background queue processing.
- Production Linux Stacks: Clean, pre-hardened Ubuntu/Debian environments ready for 1-click Docker Compose and Kubernetes deployments.
- Low Latency & High Bandwidth: Unmetered uplinks ensuring lightning-fast outbound webhook dispatches and real-time dashboard subscriptions.
- 24/7 Enterprise Reliability: Engineered for unbreakable 99.99% SaaS SLA uptime.
π‘ Get Your Linux Server / Cloud VPS: Visit jmevps.com to launch your SaaS Master production server in under 60 seconds!
β Support & Sponsorship (Buy Me a Coffee / India UPI)
If SaaS Master Builder saved you weeks of architectural headaches, prevented catastrophic cross-tenant data leaks, or helped you ship a multi-million-dollar SaaS product, consider supporting independent open-source engineering!
Payment Policy: We strictly do NOT accept cryptocurrency. For supporters in India or internationally via UPI-enabled applications (BHIM, Google Pay, PhonePe, Paytm), we support direct zero-fee UPI transfers.
π² Pay via UPI (India / BHIM / GPay / PhonePe / Paytm):
VPA (UPI ID): jmetechno@ybl
Payee Name: SaaS Master Builder
Company: JME TECHNOLOGIES LLP
Currency: INR (βΉ)
Accepted Apps: Google Pay, PhonePe, Paytm, BHIM, Cred, Any UPI App
π Click here to Pay directly via UPI App on Mobile
Thank you for fueling the next generation of unbreakable, zero-hallucination SaaS development!
π€ Contributing & Community
Contributions, issues, and feature requests are welcome! Feel free to check the issues page.
π License & Corporate Custody
This project is licensed under the MIT License and maintained by JME TECHNOLOGIES LLP (https://jmevps.com). Use, modify, and build unbreakable SaaS products freely for personal and commercial ventures.