# CodeDiag

> CodeDiag is an open-source MCP server for developer tools. Scan Node.js projects for unprotected API routes and get an explained health score. It runs locally on your machine and is started by your AI client.

- **Kind:** MCP server
- **Pricing:** Open source
- **Platforms:** CLI, vscode, API
- **Website:** https://sabahattink.github.io/codediag/
- **Repository:** https://github.com/sabahattink/codediag
- **MCP Registry name:** io.github.sabahattink/codediag
- **Categories:** developer tools, security
- **Listing updated:** 2026-11-14

## About

The question it starts from is which routes anyone can call. CodeDiag parses a project into one ts-morph syntax tree and checks routes for missing auth and missing input validation. It follows NestJS guards, Express middleware across router mounts, Fastify hooks and plugins, tRPC procedures, Hono and Elysia middleware order, SvelteKit hooks and Next.js middleware per route.

Results roll up into a 0-100 health score from five weighted analyzers: security (30%), API health (25%), dependencies, testing and structure. Every finding has a stable rule ID, a file and line where one exists, and a suggested fix. The tool recommends changes and never edits your files. Security rules include dynamic SQL, path traversal, reflected XSS, SSRF, open redirects, missing Helmet and rate limiting.

It runs on your machine with no account or upload, and a --no-audit flag keeps it fully offline. It needs Node.js 20.19 or later, is MIT licensed, and also ships SARIF output, a GitHub Action and a VS Code extension.

## Features

- **Route auth and validation:** Finds API routes with no auth check or input validation across nine frameworks.
- **Explained health score:** A 0-100 score with weights per analyzer and a breakdown of every lost point.
- **Taint-style security rules:** Traces request data into shell commands, raw SQL, file paths, redirects and HTML.
- **Stable rule IDs:** Each finding links to a rule you can explain or suppress.
- **SARIF and CI:** Outputs SARIF and provides a GitHub Action and VS Code extension.
- **Offline by default:** No account or upload; --no-audit avoids network calls entirely.

## Good for

- Audit an Express or NestJS API for unauthenticated endpoints before release
- Gate pull requests on a minimum health score in CI
- Upload SARIF results to code scanning
- Find missing rate limiting or Helmet in a Node service
- Let a coding agent check its own route changes

## Install

### Claude Code (Terminal)

```sh
claude mcp add codediag -- npx -y @sabahattink/codediag
```

### Claude Desktop (claude_desktop_config.json)

```json
{
  "mcpServers": {
    "codediag": {
      "command": "npx",
      "args": [
        "-y",
        "@sabahattink/codediag"
      ]
    }
  }
}
```

### Cursor (~/.cursor/mcp.json)

```json
{
  "mcpServers": {
    "codediag": {
      "command": "npx",
      "args": [
        "-y",
        "@sabahattink/codediag"
      ]
    }
  }
}
```

### VS Code (.vscode/mcp.json)

```json
{
  "servers": {
    "codediag": {
      "type": "stdio",
      "command": "npx",
      "args": [
        "-y",
        "@sabahattink/codediag"
      ]
    }
  }
}
```

### Windsurf (~/.codeium/windsurf/mcp_config.json)

```json
{
  "mcpServers": {
    "codediag": {
      "command": "npx",
      "args": [
        "-y",
        "@sabahattink/codediag"
      ]
    }
  }
}
```

### Other clients (your client's MCP settings (most use this shape))

```json
{
  "mcpServers": {
    "codediag": {
      "command": "npx",
      "args": [
        "-y",
        "@sabahattink/codediag"
      ]
    }
  }
}
```

## FAQ

### Does it send my code anywhere?

No. It scans on your machine with no account or upload, and --no-audit keeps it fully offline.

### Which frameworks does it understand?

NestJS, Express, Fastify, Hono, Elysia, tRPC, Next.js, SvelteKit and React Router; plain Node.js projects get every analyzer except API health.

### Will it change my files?

No, it recommends fixes but never edits files.

### What does it need to run?

Node.js 20.19 or later; run it with npx @sabahattink/codediag scan .

### Is CodeDiag free?

Yes. CodeDiag is open source, so you can use and self-host it for free.

### How do I add CodeDiag to Claude Code?

Run this command in your terminal: claude mcp add codediag -- npx -y @sabahattink/codediag

### What are the best alternatives to CodeDiag?

The closest alternatives to CodeDiag are REA, Codebase Memory, GitHub, Serena MCP: the IDE for your agent and XERJ.

## Alternatives

- [REA](https://ai-powered.com/mcp/rea): REA is an open-source MCP server for developer tools.
- [Codebase Memory](https://ai-powered.com/mcp/codebase-memory): Codebase Memory is an open-source MCP server for knowledge and memory.
- [GitHub](https://ai-powered.com/mcp/github-2): GitHub is an open-source MCP server for developer tools.
- [Serena MCP: the IDE for your agent](https://ai-powered.com/mcp/serena-mcp-the-ide-for-your-agent): Serena MCP: the IDE for your agent is an open-source MCP server for developer tools.
- [XERJ](https://ai-powered.com/mcp/xerj): XERJ is an open-source MCP server for knowledge and memory.
- [Ouroboros](https://ai-powered.com/mcp/ouroboros): Ouroboros is an open-source MCP server for developer tools.
- [Claude Code Ultimate Guide](https://ai-powered.com/mcp/claude-code-ultimate-guide): Claude Code Ultimate Guide is an open-source MCP server for ai models and llm tooling.
- [Concord MCP](https://ai-powered.com/mcp/concord-mcp): Concord MCP is a freemium MCP server for developer tools.

---
Source: https://ai-powered.com/mcp/codediag
