Skip to content

rish-e/BackendMax

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

11 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

โ•”โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•—
โ•‘                                                              โ•‘
โ•‘   โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•—  โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•—  โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•—โ–ˆโ–ˆโ•—  โ–ˆโ–ˆโ•—โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•—โ–ˆโ–ˆโ–ˆโ•—   โ–ˆโ–ˆโ•—โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•— โ•‘
โ•‘   โ–ˆโ–ˆโ•”โ•โ•โ–ˆโ–ˆโ•—โ–ˆโ–ˆโ•”โ•โ•โ–ˆโ–ˆโ•—โ–ˆโ–ˆโ•”โ•โ•โ•โ•โ•โ–ˆโ–ˆโ•‘ โ–ˆโ–ˆโ•”โ•โ–ˆโ–ˆโ•”โ•โ•โ•โ•โ•โ–ˆโ–ˆโ–ˆโ–ˆโ•—  โ–ˆโ–ˆโ•‘โ–ˆโ–ˆโ•”โ•โ•โ–ˆโ–ˆโ•—โ•‘
โ•‘   โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•”โ•โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•‘โ–ˆโ–ˆโ•‘     โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•”โ• โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•—  โ–ˆโ–ˆโ•”โ–ˆโ–ˆโ•— โ–ˆโ–ˆโ•‘โ–ˆโ–ˆโ•‘  โ–ˆโ–ˆโ•‘โ•‘
โ•‘   โ–ˆโ–ˆโ•”โ•โ•โ–ˆโ–ˆโ•—โ–ˆโ–ˆโ•”โ•โ•โ–ˆโ–ˆโ•‘โ–ˆโ–ˆโ•‘     โ–ˆโ–ˆโ•”โ•โ–ˆโ–ˆโ•— โ–ˆโ–ˆโ•”โ•โ•โ•  โ–ˆโ–ˆโ•‘โ•šโ–ˆโ–ˆโ•—โ–ˆโ–ˆโ•‘โ–ˆโ–ˆโ•‘  โ–ˆโ–ˆโ•‘โ•‘
โ•‘   โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•”โ•โ–ˆโ–ˆโ•‘  โ–ˆโ–ˆโ•‘โ•šโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•—โ–ˆโ–ˆโ•‘  โ–ˆโ–ˆโ•—โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•—โ–ˆโ–ˆโ•‘ โ•šโ–ˆโ–ˆโ–ˆโ–ˆโ•‘โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•”โ•โ•‘
โ•‘   โ•šโ•โ•โ•โ•โ•โ• โ•šโ•โ•  โ•šโ•โ• โ•šโ•โ•โ•โ•โ•โ•โ•šโ•โ•  โ•šโ•โ•โ•šโ•โ•โ•โ•โ•โ•โ•โ•šโ•โ•  โ•šโ•โ•โ•โ•โ•šโ•โ•โ•โ•โ•โ•โ•‘
โ•‘                                                              โ•‘
โ•‘           โ–ˆโ–ˆโ–ˆโ•—   โ–ˆโ–ˆโ–ˆโ•— โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•— โ–ˆโ–ˆโ•—  โ–ˆโ–ˆโ•—                        โ•‘
โ•‘           โ–ˆโ–ˆโ–ˆโ–ˆโ•— โ–ˆโ–ˆโ–ˆโ–ˆโ•‘โ–ˆโ–ˆโ•”โ•โ•โ–ˆโ–ˆโ•—โ•šโ–ˆโ–ˆโ•—โ–ˆโ–ˆโ•”โ•                        โ•‘
โ•‘           โ–ˆโ–ˆโ•”โ–ˆโ–ˆโ–ˆโ–ˆโ•”โ–ˆโ–ˆโ•‘โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•‘ โ•šโ–ˆโ–ˆโ–ˆโ•”โ•                         โ•‘
โ•‘           โ–ˆโ–ˆโ•‘โ•šโ–ˆโ–ˆโ•”โ•โ–ˆโ–ˆโ•‘โ–ˆโ–ˆโ•”โ•โ•โ–ˆโ–ˆโ•‘ โ–ˆโ–ˆโ•”โ–ˆโ–ˆโ•—                         โ•‘
โ•‘           โ–ˆโ–ˆโ•‘ โ•šโ•โ• โ–ˆโ–ˆโ•‘โ–ˆโ–ˆโ•‘  โ–ˆโ–ˆโ•‘โ–ˆโ–ˆโ•”โ• โ–ˆโ–ˆโ•—                        โ•‘
โ•‘           โ•šโ•โ•     โ•šโ•โ•โ•šโ•โ•  โ•šโ•โ•โ•šโ•โ•  โ•šโ•โ•                        โ•‘
โ•‘                                                              โ•‘
โ•šโ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•

๐Ÿฉบ AI-Powered Backend Diagnostics for Claude Code

The backend bugs your linter can't see. The contract drift your tests don't cover. Caught before deploy.


MIT License Version Node TypeScript MCP


Quick Start ยท Features ยท Tools ยท Roadmap


๐Ÿค” What Is This?

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.


๐Ÿ”ญ How It Works

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚                                                                     โ”‚
โ”‚   ๐Ÿ“‚ 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   โ”‚ โ”‚                       โ”‚
โ”‚   โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜             โ”‚  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ”‚                       โ”‚
โ”‚                             โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜                       โ”‚
โ”‚                                                                     โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

โšก Why Backend Max?

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.


๐Ÿš€ Quick Start

Install with your MCP client

Claude Code (recommended)
claude mcp add backend-max -- npx -y backend-max

Done. 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 build

Then add to your MCP client config:

{
  "command": "node",
  "args": ["/path/to/backend-max/dist/server.js"]
}

Run Your First Diagnosis

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.

4. CI/CD Mode (Optional)

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 data

๐Ÿ”ฌ Features Deep Dive

๐Ÿ†• v2.4 โ€” External Audit Suite (Black-Box Testing)

Audit 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

v2.2 โ€” Tier 2 Feature Drop

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

v2.1 โ€” Tier 1 Feature Drop

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

v2.0 Features

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

๐Ÿ”— Cross-Boundary Contract Verification

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 expects PUT
  • Payload drift โ€” frontend sends { name, email }, backend expects { username, email }
  • Response shape drift โ€” frontend destructures data.items, backend returns data.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 }

๐Ÿง  Intent-Aware Diagnosis

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".


๐Ÿ›ก๏ธ Pre-Deploy Safety Net

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

๐Ÿ“– Living API Documentation

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, 500

The docs update every time you run a diagnosis. They can never go stale.


๐Ÿ“’ Issue Lifecycle Tracking

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

๐Ÿ’ฏ Health Score

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.


๐Ÿ› ๏ธ Available Tools

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

Tool Usage Examples

// 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 /doctor Command

The simplest way to use Backend Max. Just type /doctor in Claude Code.

What it does:

  1. ๐Ÿง  Scans your project to understand its intent and architecture
  2. ๐Ÿ”— Verifies all frontendโ†”backend contracts
  3. ๐Ÿ” Runs all 6 audit engines
  4. ๐Ÿ“– Generates/updates API documentation
  5. ๐Ÿ’ฏ Calculates your health score
  6. ๐Ÿ“‹ Returns a prioritized report

Example Output

๐Ÿฉบ 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/

๐Ÿ“ Project Structure

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 .gitignore or commit it โ€” your choice. Committing it gives your team shared visibility into backend health.


โš™๏ธ Configuration

Create a backend-max.config.json in your project root to customize behavior:

{
  // 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"]
}

๐Ÿ›ก๏ธ Safety & Security

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.

Safety Systems

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

Security Guarantees

  • โœ… 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

Configuration

Safety limits can be tuned via backend-max.config.json:

{
  "maxFiles": 5000,
  "maxFileSizeBytes": 1048576,
  "maxScanDepth": 15,
  "reportRetentionDays": 30,
  "autoGitignore": true
}

๐Ÿ—บ๏ธ Roadmap

Phase 1 โ€” Foundation โœ…

  • 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
  • /doctor slash command

Phase 2 โ€” Expansion โœ…

  • 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

Phase 3 โ€” Intelligence ๐Ÿšง

  • 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

Phase 4 โ€” Ecosystem ๐Ÿ”ฎ

  • 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)

๐Ÿค Contributing

Contributions are welcome! See CONTRIBUTING.md for guidelines.

Quick summary:

  1. Fork & clone
  2. npm install && npm run build
  3. Create a feature branch
  4. Write your code (TypeScript strict, ESM, JSDoc comments)
  5. Open a PR

๐Ÿ“„ License

MIT ยฉ 2026 Rishi Kolisetty



Built with ๐Ÿฉบ by Rishi Kolisetty

Backend Max sees what your linter can't.


Star on GitHub

About

๐Ÿฉบ AI-powered backend diagnostic MCP server. Understands what you're building and makes sure it actually works. Cross-boundary contract verification, living API docs, issue lifecycle tracking.

Topics

Resources

License

Contributing

Security policy

Stars

Watchers

Forks

Packages

 
 
 

Contributors