โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ โ
โ โโโโโโโ โโโโโโ โโโโโโโโโโ โโโโโโโโโโโโโโโ โโโโโโโโโโ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโ โโโโโโโโโโโโ
โ โโโโโโโโโโโโโโโโโโโ โโโโโโโ โโโโโโ โโโโโโ โโโโโโ โโโโ
โ โโโโโโโโโโโโโโโโโโโ โโโโโโโ โโโโโโ โโโโโโโโโโโโโ โโโโ
โ โโโโโโโโโโโ โโโโโโโโโโโโโโ โโโโโโโโโโโโโโ โโโโโโโโโโโโโโโ
โ โโโโโโโ โโโ โโโ โโโโโโโโโโ โโโโโโโโโโโโโโ โโโโโโโโโโโโโ
โ โ
โ โโโโ โโโโ โโโโโโ โโโ โโโ โ
โ โโโโโ โโโโโโโโโโโโโโโโโโโโโ โ
โ โโโโโโโโโโโโโโโโโโโ โโโโโโ โ
โ โโโโโโโโโโโโโโโโโโโ โโโโโโ โ
โ โโโ โโโ โโโโโโ โโโโโโโ โโโ โ
โ โโโ โโโโโโ โโโโโโ โโโ โ
โ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
The backend bugs your linter can't see. The contract drift your tests don't cover. Caught before deploy.
Quick Start ยท Features ยท Tools ยท Roadmap
Backend Max is a Model Context Protocol (MCP) server that gives Claude deep diagnostic vision into your backend. It statically analyzes your codebase โ both frontend and backend โ to surface bugs, contract drift, missing validation, security gaps, and performance anti-patterns that no other single tool catches.
Think of it as a senior backend engineer that reviews every route, checks every contract, and never goes on vacation.
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ โ
โ ๐ Your Codebase ๐ฉบ Backend Max ๐ Report โ
โ โ
โ โโโโโโโโโโโโโ โโโโโโโโโโโโโโโโ โโโโโโโโโโโโโ โ
โ โ Frontend โโโโโโโโโโถ โ Cross- โ โ Health โ โ
โ โ API Calls โ โ Boundary โโโโโโโโถ โ Score โ โ
โ โโโโโโโโโโโโโ โ Analysis โ โโโโโโโโโโโโโค โ
โ โ โ โ Issues โ โ
โ โโโโโโโโโโโโโ โ โโโโโโโโโโโโ โ โโโโโโโโโโโโโค โ
โ โ Backend โโโโโโโโโโถ โ โ 6 Audit โ โโโโโโโโถ โ API Docs โ โ
โ โ Routes โ โ โ Engines โ โ โโโโโโโโโโโโโค โ
โ โโโโโโโโโโโโโ โ โโโโโโโโโโโโ โ โ Fixes โ โ
โ โ โ โ Guide โ โ
โ โโโโโโโโโโโโโ โ โโโโโโโโโโโโ โ โโโโโโโโโโโโโ โ
โ โ Config โโโโโโโโโโถ โ โ Intent โ โ โ
โ โ & Env โ โ โ Engine โ โ โ
โ โโโโโโโโโโโโโ โ โโโโโโโโโโโโ โ โ
โ โโโโโโโโโโโโโโโโ โ
โ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Existing tools catch syntax errors and type mismatches. Backend Max catches the bugs that ship to production.
| Bug Category | TypeScript | ESLint | Jest/Vitest | Backend Max |
|---|---|---|---|---|
Frontend calls /api/user but backend exposes /api/users |
โ | โ | โ | โ |
Frontend sends { name } but backend expects { username } |
โ | โ | โ | โ |
| Route handler missing try/catch | โ | โ | โ | โ |
| Zod schema missing on POST route | โ | โ | โ | โ |
process.env.SECRET used but not in .env |
โ | โ | โ | โ |
| Auth middleware missing on sensitive route | โ | โ | โ | โ |
| N+1 query in a loop | โ | โ | โ | โ |
| API docs out of date | โ | โ | โ | โ |
๐ก Backend Max doesn't replace your existing tools. It catches what they architecturally cannot โ cross-boundary issues that require understanding both sides of the stack.
Claude Code (recommended)
claude mcp add backend-max -- npx -y backend-maxDone. Open any project and type /backendmax run a full diagnosis.
Claude Desktop
Add to your claude_desktop_config.json:
{
"mcpServers": {
"backend-max": {
"command": "npx",
"args": ["-y", "backend-max"]
}
}
}VS Code / Cursor
Add to .vscode/settings.json:
{
"mcp.servers": {
"backend-max": {
"command": "npx",
"args": ["-y", "backend-max"]
}
}
}Windsurf
Add to your MCP config:
{
"mcpServers": {
"backend-max": {
"command": "npx",
"args": ["-y", "backend-max"]
}
}
}From source (for development)
git clone https://github.com/rish-e/backend-max.git
cd backend-max
npm install && npm run buildThen add to your MCP client config:
{
"command": "node",
"args": ["/path/to/backend-max/dist/server.js"]
}Open your MCP client in any project and ask:
/backendmax run a full diagnosis on my project
That's it. Backend Max will analyze your project and return a full diagnostic report with health score, issues, and fix suggestions.
Run diagnostics from the command line or GitHub Actions:
# Basic diagnosis
npx backend-max-cli diagnose ./my-project
# CI mode โ fail if health score drops below 75 or critical issues found
npx backend-max-cli diagnose ./my-project --ci --min-score 75 --fail-on critical
# Output formats
npx backend-max-cli diagnose ./my-project --format markdown # PR comments
npx backend-max-cli diagnose ./my-project --format sarif # GitHub Code Scanning
npx backend-max-cli diagnose ./my-project --format json # Raw dataAudit any website with just a URL โ no source code, no credentials, no access needed.
| Tool | Description |
|---|---|
๐ audit_headers |
HTTP security header analysis with A-F grading. Deep CSP parsing (unsafe-inline/eval, wildcards), HSTS validation (max-age, preload), COEP/COOP/CORP checks |
๐ audit_cors |
CORS misconfiguration detection. Tests origin reflection, wildcard + credentials conflicts, overly permissive methods, missing preflight cache |
๐ audit_ssl |
TLS/certificate analysis. Chain validation, expiry warnings, protocol version check (TLS 1.2+), cipher grading, HTTPโHTTPS redirect |
๐ช audit_cookies |
Cookie security flags audit. Checks Secure, HttpOnly, SameSite on all cookies. Detects exposed session tokens |
๐ audit_dns |
DNS & infrastructure fingerprinting. CDN detection, SPF/DMARC/CAA records, email security posture |
๐ฅ probe_error_handling |
Error response probing. Tests for stack trace leakage, framework disclosure, database errors, debug mode exposure |
๐ audit_auth_flow |
Authentication surface analysis. Discovers login endpoints, detects auth mechanisms, tests rate limiting, checks account enumeration |
๐ scan_public_api |
API surface discovery. Extracts endpoints from frontend JS bundles, maps auth requirements, finds unprotected APIs |
# Audit any website โ no source code needed
Use audit_headers on https://example.com
Use scan_public_api on https://example.com
| Feature | Description |
|---|---|
| โก Fastify Support | Full route analysis with built-in JSON Schema validation detection, error handler checks, param extraction |
| ๐ฅ Hono Support | Route analysis with basePath resolution, zValidator detection, middleware arg parsing |
| ๐ฆ Rate Limiting Audit | Detects rate limiting packages/patterns, flags unprotected auth endpoints, checks caching coverage |
| ๐ API Versioning | Detects path/header versioning, finds version gaps, flags inconsistent versioning |
| ๐ Middleware Visualization | Maps global/inline middleware chains per route, checks ordering, generates markdown visualization |
| ๐ Multi-Layer Type Tracing | Traces types across frontend โ route โ service โ repository โ DB, finds cross-layer mismatches |
| Feature | Description |
|---|---|
| ๐ง Auto-Fix Engine | Generates real unified diff patches for common issues โ try/catch wrapping, Zod validation, auth guards, pagination. Apply with git apply |
| ๐๏ธ Watch Mode | Incremental analysis โ shows new issues, fixed issues, and health score delta since last run. No full re-scan needed |
| ๐ tRPC Support | Full router analysis โ procedures, input validation, protected/public, queries vs mutations. 3 tRPC-specific checks |
| ๐ธ๏ธ GraphQL Analysis | Resolver scanning for Apollo, Yoga, Mercurius, type-graphql, NestJS. N+1 detection, auth checks, input validation |
| ๐ฆ Dependency Scanner | Built-in vulnerability database (12+ packages), deprecated package detection, lock file checks, npm audit integration |
| Feature | Description |
|---|---|
| ๐๏ธ Prisma Schema Integration | Parses your .prisma schema and cross-references every database call โ catches nonexistent models, fields, and missing indexes |
| ๐ Deep Type Flow Analysis | Traces frontend response variables to check property access against backend return types โ catches data.user.firstName vs data.user.first_name |
| โก Server Actions | Full audit of Next.js Server Actions ('use server') โ validation, auth, error handling, database patterns |
| ๐ CI/CD Mode | CLI entry point with --ci, --min-score, --fail-on, and 4 output formats (text, markdown, JSON, SARIF) |
| ๐ข Express.js Support | Route scanning, middleware detection, Express-specific checks (error middleware, 404, helmet/CORS) |
| ๐ Pages Router | Next.js Pages Router API routes (pages/api/) fully supported |
| ๐งช Live Testing | Optional HTTP endpoint testing against running dev server (GET-only, safety-first) |
| ๐ธ๏ธ API Graph | Queryable relationship graph โ ask "unprotected routes" or "routes writing to users" |
| ๐ Pattern Learning | Local cross-project pattern tracking โ identifies the most common issues across your projects |
| ๐ SARIF Output | GitHub Code Scanning integration via SARIF format |
The #1 feature. No other tool does this.
Backend Max reads your frontend fetch/axios calls and your backend route handlers, then cross-references them to find:
- URL mismatches โ frontend calls
/api/user, backend serves/api/users - Method mismatches โ frontend sends
POST, backend expectsPUT - Payload drift โ frontend sends
{ name, email }, backend expects{ username, email } - Response shape drift โ frontend destructures
data.items, backend returnsdata.results
// Frontend: lib/api.ts
const user = await fetch('/api/user', { // โ "/user" (singular)
method: 'POST',
body: JSON.stringify({ name: 'Alice' }) // โ sends "name"
});
// Backend: app/api/users/route.ts // โ "/users" (plural)
export async function POST(req: Request) {
const { username } = await req.json(); // โ expects "username"
// ...
}โ ๏ธ CONTRACT DRIFT DETECTED
Route Mismatch:
Frontend calls โ /api/user (POST)
Backend serves โ /api/users (POST)
Payload Mismatch:
Frontend sends โ { name: string }
Backend expects โ { username: string }
Backend Max doesn't just scan code โ it understands what you're building. By analyzing your project structure, route names, and data models, it builds an intent map:
- Identifies your domains (auth, billing, users, etc.)
- Understands relationships between entities
- Flags issues that are contextually wrong, not just syntactically wrong
๐ฏ "This route handles payments but doesn't validate the amount field" is more useful than "missing validation on line 47".
Six audit engines run in parallel, each targeting a category of bugs that commonly ship to production:
| # | Audit Engine | What It Catches |
|---|---|---|
| 1 | ๐ API Contract Drift | Frontendโbackend URL, method, payload, and response mismatches |
| 2 | ๐จ Error Handling | Missing try/catch, inconsistent error response formats, unhandled promise rejections |
| 3 | โ Input Validation | Routes without Zod schemas, raw req.body access, missing type coercion |
| 4 | ๐ Environment Variables | Undefined refs, missing .env entries, NEXT_PUBLIC_ prefix misuse |
| 5 | ๐ Security | Auth middleware gaps, permissive CORS, SQL/NoSQL injection patterns, exposed secrets |
| 6 | โก Performance | N+1 queries, unbounded SELECT *, large payload serialization, missing pagination |
Each issue includes:
- Severity โ
criticalยทwarningยทinfo - Location โ exact file and line number
- Explanation โ what's wrong and why it matters
- Fix suggestion โ actionable code-level guidance
Backend Max auto-generates API documentation by reading your actual route handlers. No annotations needed. No Swagger decorators. Just your code.
## POST /api/auth/login
Authentication endpoint for user login.
**Request Body:**
| Field | Type | Required | Validation |
|----------|--------|----------|------------------|
| email | string | โ
| Valid email |
| password | string | โ
| Min 8 characters |
**Response (200):**
| Field | Type |
|-------|--------|
| token | string |
| user | object |
**Error Responses:** 401, 422, 500The docs update every time you run a diagnosis. They can never go stale.
Every issue is tracked through its full lifecycle:
Found โ Acknowledged โ Fixed โ Verified โ (Regressed?)
Backend Max maintains a ledger in .backend-doctor/history/ so you can:
- See what was fixed and when
- Detect regressions (issues that come back)
- Track your backend health score over time
- Review historical audit reports
A single number, 0โ100, representing your backend's overall health:
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Backend Health Score: 73/100 ๐ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฃ
โ Contracts โโโโโโโโโโ 80% โ
โ Error Handling โโโโโโโโโโ 60% โ
โ Validation โโโโโโโโโโ 70% โ
โ Env Vars โโโโโโโโโโ 90% โ
โ Security โโโโโโโโโโ 60% โ
โ Performance โโโโโโโโโโ 80% โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Track it over time to see your backend getting healthier with every commit.
All tools are exposed via MCP and available directly in Claude Code:
| Tool | Description |
|---|---|
run_diagnosis |
Full diagnostic pipeline โ scans routes, checks contracts, runs all audits, generates docs, calculates health score |
watch_diagnosis |
Incremental analysis โ compares against last report, shows new/fixed issues and health delta |
check_changes |
Quick check โ shows changed files since last diagnosis without re-running analysis |
init_context |
Analyze project structure, identify domains, frameworks, and architecture |
check_contracts |
Cross-reference frontend API calls against backend routes |
scan_routes |
Discover all API routes/endpoints across all supported frameworks |
audit_errors |
Check error handling โ try/catch coverage, consistent error formats |
audit_env |
Verify environment variables โ missing refs, prefix misuse |
audit_security |
Security scan โ auth gaps, CORS, injection patterns |
audit_performance |
Performance anti-patterns โ N+1 queries, unbounded queries, missing pagination |
audit_prisma |
Prisma schema cross-referencing โ nonexistent models/fields, missing indexes |
audit_server_actions |
Next.js Server Actions audit โ validation, auth, error handling |
scan_dependencies |
Dependency vulnerability scanner โ known CVEs, deprecated packages, lock file checks |
fix_issue |
Generate a unified diff patch for a specific issue |
fix_all_issues |
Batch-generate patches for all open issues |
get_api_docs |
Auto-generated living API documentation |
get_ledger |
Full issue lifecycle ledger โ filter by status, severity, category |
live_test |
Optional HTTP endpoint testing (GET-only, localhost-only, safety-first) |
query_api |
Query the API relationship graph โ "unprotected routes", "routes writing to users" |
get_patterns |
Cross-project pattern insights โ most common issues by framework |
audit_rate_limiting |
Rate limiting & caching audit โ detects packages, code patterns, flags unprotected auth endpoints |
audit_versioning |
API versioning detection โ path/header versioning, version gaps, consistency checks |
visualize_middleware |
Middleware chain visualization โ maps execution order, checks ordering, markdown output |
trace_types |
Multi-layer type tracing โ traces types across frontend โ route โ service โ DB layers |
run_safety_check |
Validate project safety constraints before diagnosis |
// In Claude Code, these are called automatically.
// Direct MCP usage:
// Full diagnosis (the /doctor command runs this)
await client.callTool('diagnose', { projectPath: '.' });
// Just check contracts
await client.callTool('verify_contracts', { projectPath: '.' });
// Generate fresh API docs
await client.callTool('generate_docs', { projectPath: '.', outputFormat: 'markdown' });The simplest way to use Backend Max. Just type /doctor in Claude Code.
- ๐ง Scans your project to understand its intent and architecture
- ๐ Verifies all frontendโbackend contracts
- ๐ Runs all 6 audit engines
- ๐ Generates/updates API documentation
- ๐ฏ Calculates your health score
- ๐ Returns a prioritized report
๐ฉบ Backend Max Diagnosis Complete
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
๐ Health Score: 73/100 (โ 5 from last run)
๐จ Critical Issues (2)
โโ AUTH_GAP: /api/billing/charge has no auth middleware
โ โ app/api/billing/charge/route.ts:1
โ
โโ CONTRACT_DRIFT: Frontend calls DELETE /api/user/:id
but backend only exposes GET, POST on /api/users
โ lib/api/users.ts:45 โ app/api/users/route.ts
โ ๏ธ Warnings (5)
โโ VALIDATION: POST /api/posts missing input validation
โโ ERROR_FORMAT: 3 routes return inconsistent error shapes
โโ ENV_VAR: DATABASE_URL referenced but not in .env.example
โโ PERFORMANCE: N+1 query pattern in /api/users (line 23)
โโ SECURITY: CORS allows * in production config
โน๏ธ Info (3)
โโ 2 routes could benefit from response caching
โโ API docs regenerated (12 endpoints documented)
โโ 1 previously fixed issue verified as resolved โ
๐ API docs updated: .backend-doctor/api-docs.md
๐ Issue ledger updated: .backend-doctor/history/
Backend Max creates a .backend-doctor/ directory in your project root:
.backend-doctor/
โโโ project-intent.json # Understanding of your project's purpose & domains
โโโ api-docs.md # Auto-generated API documentation
โโโ health-score.json # Current & historical health scores
โโโ issues/
โ โโโ current.json # Active issues from latest run
โ โโโ ledger.json # Full issue lifecycle history
โโโ contracts/
โ โโโ frontend-calls.json # Extracted frontend API calls
โ โโโ backend-routes.json # Extracted backend route definitions
โโโ history/
โโโ 2026-03-27.json # Historical audit snapshots
๐ Add
.backend-doctor/to your.gitignoreor commit it โ your choice. Committing it gives your team shared visibility into backend health.
Create a backend-max.config.json in your project root to customize behavior:
Backend Max is built with a safety-first philosophy. Every operation โ from file scanning to report generation โ passes through multiple safety layers. Your code is never executed, your secrets are never stored, and all output is sanitized before it touches disk. Backend Max is designed so that even in the worst case, it cannot leak sensitive data or damage your project.
| System | What It Does | Default |
|---|---|---|
| Path Guardian | Validates project paths, blocks sensitive directories (.ssh, .aws, .gnupg), prevents path traversal attacks | Always on |
| Output Sanitizer | Detects and redacts secrets in reports โ AWS keys, GitHub tokens, Stripe keys, JWTs, connection strings, private keys, Slack tokens, and 12+ more patterns | Always on |
| Scope Limiter | Caps file count (5,000), file size (1MB), scan depth (15 levels). Prevents memory exhaustion on large monorepos | Configurable |
| Auto-Gitignore | Automatically adds .backend-doctor/ to .gitignore on first run. Prevents diagnostic data from being committed |
On by default |
| Report Pruning | Auto-deletes diagnosis reports older than 30 days | Configurable |
| Env Value Stripping | Environment variable VALUES are never read or stored โ only variable NAMES. Impossible to leak secrets through reports | Always on |
| Write Protection | Fix engine validates every write target: must be a source file, must be in project, must not be generated/config/lock files | Always on |
- โ Backend Max NEVER reads environment variable values โ only names
- โ Backend Max NEVER executes your code โ pure static analysis
- โ Backend Max NEVER sends data externally โ everything stays local
- โ All diagnostic output is scrubbed for 15+ secret patterns before writing to disk
- โ
.backend-doctor/is auto-gitignored to prevent accidental commits - โ File writes (fix engine) are sandboxed to source files within the project only
Safety limits can be tuned via backend-max.config.json:
{
"maxFiles": 5000,
"maxFileSizeBytes": 1048576,
"maxScanDepth": 15,
"reportRetentionDays": 30,
"autoGitignore": true
}- MCP server with stdio transport
- Next.js App Router support
- 6 core audit engines
- Cross-boundary contract verification
- Auto-generated API documentation
- Health score calculation
- Issue lifecycle tracking
-
/doctorslash command
- Safety & sandboxing
- Express.js support
- CI/CD integration (GitHub Actions via SARIF)
- Watch mode / incremental analysis
- Auto-fix engine with code patches
- tRPC support
- GraphQL resolver analysis
- Dependency vulnerability scanning
- Fastify + Hono framework support
- Multi-layer type tracing (frontend โ route โ service โ DB)
- API versioning analysis
- Rate limiting & caching audit
- Middleware chain visualization
- OpenAPI/Swagger spec generation
- Dead code detection (unused routes/exports)
- Test coverage mapping
- VS Code extension โ inline diagnostics
- Monorepo support (Turborepo/Nx)
- Database query complexity analyzer
- API changelog between commits
- Webhook/event auditor
- Multi-service contract verification (microservices)
Contributions are welcome! See CONTRIBUTING.md for guidelines.
Quick summary:
- Fork & clone
npm install && npm run build- Create a feature branch
- Write your code (TypeScript strict, ESM, JSDoc comments)
- Open a PR
MIT ยฉ 2026 Rishi Kolisetty
{ // Which audit engines to run (default: all) "audits": { "contracts": true, "errorHandling": true, "validation": true, "envVars": true, "security": true, "performance": true }, // Paths to scan (globs) "include": ["app/api/**", "src/routes/**"], // Paths to ignore "exclude": ["**/*.test.ts", "**/__mocks__/**"], // Frontend paths for contract verification "frontendPaths": ["app/**", "components/**", "lib/**"], // Minimum severity to report: "info" | "warning" | "critical" "minSeverity": "info", // Custom environment variable file paths "envFiles": [".env", ".env.local", ".env.production"] }