Code Auditor

MCP serverDev tools

The Code Quality Auditor helps your AI review the quality of your code. Once added, your AI can analyze code for SOLID design principle issues and DRY violations, along with other quality problems. Use it to find areas worth cleaning up before they become harder to maintain.

Use Code Auditor in Claude, ChatGPT or Ahel Desktop

Free. Sign in, add Code Auditor and connect your AI. About a minute.

Also: Claude Code · Cursor · Codex

Then ask your AI: use Code Auditor

Details

Available today. Use it from your connected AI after setup.

After adding it, point your AI at a file or code snippet and ask it to check the quality. It will report issues like SOLID and DRY problems so you know what to fix first.

Code AuditorStart free

What your AI can do with it

  • Check code against SOLID design principles
  • Spot duplicated code and DRY violations
  • Analyze code for quality issues
  • Flag parts of your code worth improving

Install Code Auditor

The server’s own address, for the clients that take one directly. Or connect Ahel once and every client you use reads it from one address, with the account kept on Ahel rather than in each client’s config.

  • Claude Code

    claude mcp add --transport http --scope user code-auditor 'https://www.codeauditormcp.com/api/mcp'

    Run it once in your project, then open /mcp to approve any sign-in the server asks for.

  • Claude Desktop

    https://www.codeauditormcp.com/api/mcp

    Add a custom connector in Settings, paste this address, and approve the sign-in.

  • Cursor

    cursor://anysphere.cursor-deeplink/mcp/install?name=code-auditor&config=eyJ1cmwiOiJodHRwczovL3d3dy5jb2RlYXVkaXRvcm1jcC5jb20vYXBpL21jcCJ9

    Open the link and Cursor adds the server at that address.

  • ChatGPT

    https://www.codeauditormcp.com/api/mcp

    In Settings, enable Developer mode, create an MCP app, and paste this address. Your plan and workspace must allow custom apps.

  • Codex

    codex mcp add code-auditor --url 'https://www.codeauditormcp.com/api/mcp'

    Run it once, then sign in with codex mcp login code-auditor if the server asks for an account.

From the project's README

As published by benahammond/code-auditor-mcp in README.md.

Architectural invariants enforced inside your AI agent's edit loop. When the agent writes code that breaks a project rule, Code Auditor catches it and blocks the edit. The agent sees the rule's message and fixes itself.

Install

npm install -g code-auditor-mcp
code-audit install --agent all

Two commands to install everywhere. code-audit install --agent all copies the skill to every AI coding tool on your machine. Use --agent for specific tools.

What you get per tool: the skill (SKILL.md), MCP server access, and hook wiring where the tool supports it (blocking on Claude Code and Codex, advisory on Cursor).

code-audit install --list   # see the support matrix

Claude Code users can also install via plugin:

claude plugin marketplace add BenAHammond/code-auditor-mcp
claude plugin install code-auditor

The hook auto-installs the auditor on first use via npx.

Requirements

  • Node 18+ to run. Node 23.4+ gets the zero-native-install path: Code Auditor uses the built-in node:sqlite module, so nothing needs to compile or download a prebuilt binary on install.
  • On older Node (18–23.3), Code Auditor falls back to better-sqlite3, an optional dependency whose install script must be approved once on npm 11.2+/12 (they block dependency install scripts by default): npm install-scripts approve better-sqlite3 && npm rebuild better-sqlite3 (with pnpm: pnpm approve-builds, then select better-sqlite3).

Prompt examples

"Index the codebase and run a full audit, then walk the violations file-by-file with code-audit next-file."

"Create a .codeauditor.json that bans lodash imports and prevents src/languages/ from importing anything in src/analyzers/."

"Run a full audit, fix the highest-priority file, and repeat code-audit next-file until the tree is clean."

"Sync the code index and audit only what changed vs main."

"Add an ast-pattern rule that blocks new Function(...)."

"Add a naming rule requiring hooks in src/hooks/ to start with use."

"Add a call-constraint so chargeCustomer() in src/services/payment.ts can only be called from src/api/."

Rule kinds

Seven kinds. The agent writes them to .codeauditor.json. Bad configs fail the audit, not silently.

KindWhat it blocks
import-banBanned module imports
call-constraintFunction calls from unauthorized files
module-boundaryImports across module boundaries
namingExported symbols not matching a pattern
ast-patternAST nodes matching an ast-grep pattern
style-mechanismUnapproved style mechanisms per file/glob
no-raw-valuesHardcoded values for specific CSS properties

Works with your agent

One skill, one CLI, one MCP server. Every agent gets the same audit engine — the hook contract is the only difference.

AgentSkillHooks / BlockingMCPVerified
Claude CodePlugin or code-audit installYes — blockingYes2026-07-19
Cursorcode-audit install --agent cursor (project-only)AdvisoryYes2026-07-19
Codexcode-audit install --agent codex + pluginYes — blockingYes2026-07-19
Gemini CLIcode-audit install --agent geminiNoYes2026-07-19
VS Code / Copilotcode-audit install --agent agentsNoYes2026-07-19
Other SKILL.md toolscode-audit install --agent agentsNoYes2026-07-19
ZCodecode-audit install --agent zcodeNo (plugin-scoped)Yes2026-09-10

Hook behavior: Blocking means the diff-scoped changed gate is tripped — an invariant rule that declares gating: true (a binary, per-rule flag, independent of severity) blocks the edit from landing (the agent sees the violation and fixes inline). Advisory means violations are reported through the strongest available feedback channel but the edit has already occurred. Cursor's afterFileEdit hook is fire-and-forget with no output consumption. MCP is available everywhere for shell-less use.

Findings: Deterministic vs Advisory

Code Auditor's built-in rules fall into two categories:

CategoryMeaningExamples
DeterministicStructural fact — an engineer would act on every findingsingle-responsibility (300-line functions), solid/method-complexity (cyclomatic complexity > 20), solid/class-size (40+ method classes), dependency-inversion (concrete imports where an interface exists)
AdvisoryHeuristic signal — may be wrong depending on domainsql-injection-risk (AST-level string-pattern matching without type info), missing-org-filter (domain-specific — assumes SaaS tenant isolation), unknown-table (requires user-provided schema), dry/duplicate (token-identical blocks)

Deterministic rules ship at critical or warning. Advisory rules ship at warning or suggestion. Rules proven near-zero precision on a real corpus are disabled by default (off) — users opt in when the rule matches their domain.

Recalibration

Built-in severity defaults are recalibrated from real-corpus triage. The current defaults reflect measurement on three corpora: this tool's own codebase, Gin, and Excalidraw. Six data-access rules that produced near-zero precision across all three corpora are disabled by default.

Every disabled rule documents what corpus it would be useful on. Users can restore any rule via severityOverrides in .codeauditor.json:

{
  "severityOverrides": {
    "sql-injection-risk": "warning",
    "missing-org-filter": "critical",
    "loop-query": "warning"
  }
}

Severity overrides apply globally (before per-directory path profile caps). Setting a rule to "off" removes it from the output entirely.

SQL Injection Detection

The sql-injection-risk rule is disabled by default (off) after recalibration. On the self-audit corpus, it produced 0% precision — the analyzer misinterpreted TypeScript pattern-matching code (string constants like 'SELECT', 'FROM', 'WHERE' used for the tool's own SQL detection) as database queries. On the Gin and Excalidraw corpora, precision was also near zero.

When to re-enable it: your project's SQL is constructed via string concatenation or template literals in functions whose sole purpose is query assembly. The rule detects those patterns. For codebases using ORMs or parameterized queries exclusively, the rule produces noise.

To re-enable and block on SQL injection:

{
  "severityOverrides": {
    "sql-injection-risk": "critical"
  }
}

With sql-injection-risk: critical (and the rule marked gating), your agent's hook will block edits that introduce AST-level SQL injection patterns.

Style Intelligence

Code Auditor indexes every style declaration in your project — CSS, SCSS, Tailwind, inline styles, and CSS-in-JS. The styles analyzer reads global distributions and flags fragmentation that no single-file linter can see.

7 detectors, 10 rule IDs:

DetectorWhat it finds
Value driftNear-duplicate color values (delta-E < 2.0) and exact-value outliers where one value dominates
Off-scaleMargin/padding/gap/font-size values not on the inferred project scale
Undefined classclassName values with no matching CSS selector or Tailwind utility
Token bypassHardcoded values that match a design token but don't reference it
Mechanism fragmentationSame (property, value) delivered via ≥ 3 mechanisms (CSS, inline, Tailwind)
Declaration-set similarityTwo CSS rule blocks with > 90% identical declarations
Z-index sprawlProject-wide z-index inventory — too many distinct values or orphan singletons

The analyzer reads from a project-wide SQLite index, so scoped runs (changed files only) still compare against the full project baseline. A fresh #273828 drift color in a scoped run is caught against the full corpus of #1e2328 values.

Style invariant rules:

{
  "rules": [
    {
      "kind": "style-mechanism",
      "message": "Only Tailwind in src/components/",
      "allow": ["tailwind"],
      "path": "src/components/**"
    },
    {
      "kind": "no-raw-values",
      "message": "No raw colors in src/pages/ — use design tokens",
      "properties": ["color", "background-color"],
      "path": "src/pages/**"
    }
  ]
}

Style search operators — search by property, value, mechanism, or token:

code-audit search "css:margin-top value:16px"          # specific value
code-audit search "mechanism:inline css:color"          # inline color declarations
code-audit search "token:--color-primary"                # bypassing a design token

The React analyzer also gains raw-element detection: if your project has a Button wrapper, raw <button> usages outside Button's definition become warnings.

License

MIT

Signals

GitHub stars
8
Forks
2
Last commit
Oct 2026
Weekly downloads
682
Weekly_downloads
682 weekly_downloads
Advanced
Delivery
code-auditor-mcp MCP server → your Ahel connector (mcp.ahel.ai) → your AI.
Item type
mcp-server
Key
io-github-benahammond-code-auditor-mcp
Source
github.com/benahammond/code-auditor-mcp
Hosted endpoint
https://www.codeauditormcp.com/api/mcp