code-auditor-mcp
The Code Auditor MCP server lets AI agents enforce architectural invariants, analyze codebases, search code, and manage development tasks. Here's what you can do:
Code Auditing
Start background audits (
start_audit): Launch async audit jobs with configurable analyzers (SOLID, DRY, documentation, React, data-access), severity thresholds, worker counts, and partitioning strategiesPoll audit status (
audit_status): Check progress of a running audit jobFetch audit results (
audit,audit_results): Retrieve paginated violations from completed auditsQuick health check (
audit_health): Get a fast codebase health score with key metrics and optional code map generationEnforce rules including
import-ban,call-constraint,module-boundary,naming,ast-pattern,style-mechanism, andno-raw-values
Code Search & Navigation
Search indexed code (
search_code): Query functions and React components using natural language plus operators (e.g.,calls:,dep:,hook:,unused-imports,complexity:)Find definitions (
find_definition): Look up the exact definition location of a specific function or React component
Index Management
Sync the code index (
sync_index): Update, clean up, or fully reset the analysis-derived data index (function index, cached audits, code maps)
Analyzer Configuration
Set/get/reset analyzer config (
set_analyzer_config,get_analyzer_config,reset_analyzer_config): Persist, retrieve, or restore custom thresholds and rules for specific analyzers
Code Maps
List/get code map sections (
list_code_map_sections,get_code_map_section): View or retrieve specific sections (overview, files, dependencies, documentation) from a generated code map
Task Management
Manage project tasks (
project_tasks): Full CRUD for a persistent per-project task queue with priorities, labels, subtasks, blocked-by relationships, due dates, and text search
Setup & Guidance
Generate AI config files (
generate_ai_config): Scaffold configuration files for AI coding assistants (Cursor, Copilot, Claude, Windsurf, etc.)Get workflow guide (
get_workflow_guide): Retrieve recommended workflows for scenarios like initial setup, React development, code review, and maintenance
Generates configuration files to integrate GitHub Copilot with the code auditor, allowing Copilot to access code analysis and intelligent suggestions.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@code-auditor-mcpFind all functions that validate user input"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Code Auditor
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 allTwo 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 matrixClaude Code users can also install via plugin:
claude plugin marketplace add BenAHammond/code-auditor-mcp
claude plugin install code-auditorThe hook auto-installs the auditor on first use via npx.
Related MCP server: ACE-MCP
Prompt examples
"Index the codebase and run a full audit. Create tasks from any violations."
"Create a .codeauditor.json that bans lodash imports and prevents src/languages/ from importing anything in src/analyzers/."
"Run a full code audit and create tasks from the violations."
"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
Five kinds. The agent writes them to .codeauditor.json. Bad configs fail the audit, not silently.
Kind | What it blocks |
| Banned module imports |
| Function calls from unauthorized files |
| Imports across module boundaries |
| Exported symbols not matching a pattern |
| AST nodes matching an ast-grep pattern |
| Unapproved style mechanisms per file/glob |
| Hardcoded 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.
Agent | Skill | Hooks / Blocking | MCP | Verified |
Claude Code | Plugin or | Yes — blocking | Yes | 2026-07-19 |
Cursor |
| Advisory | Yes | 2026-07-19 |
Codex |
| Yes — blocking | Yes | 2026-07-19 |
Gemini CLI |
| No | Yes | 2026-07-19 |
VS Code / Copilot |
| No | Yes | 2026-07-19 |
Other SKILL.md tools |
| No | Yes | 2026-07-19 |
Hook behavior: Blocking means violations at or above --fail-on severity prevent 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:
Category | Meaning | Examples |
Deterministic | Structural fact — an engineer would act on every finding |
|
Advisory | Heuristic signal — may be wrong depending on domain |
|
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 code-audit changed --fail-on critical, 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:
Detector | What it finds |
Value drift | Near-duplicate color values (delta-E < 2.0) and exact-value outliers where one value dominates |
Off-scale | Margin/padding/gap/font-size values not on the inferred project scale |
Undefined class |
|
Token bypass | Hardcoded values that match a design token but don't reference it |
Mechanism fragmentation | Same |
Declaration-set similarity | Two CSS rule blocks with > 90% identical declarations |
Z-index sprawl | Project-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 tokenThe 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
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- Alicense-qualityCmaintenanceDeep code indexing for AI agents. Search symbols, navigate call graphs, explore inheritance, track git history — all via MCP.53MIT
- Alicense-qualityCmaintenanceEnables AI clients to perform local code search, indexing, and analysis across Java, JavaScript/TypeScript, .NET/C#, and Python projects through the MCP protocol.2Apache 2.0
- Alicense-qualityDmaintenanceProvides AI assistants with a structured, token-efficient map of a codebase's symbols, dependencies, and relationships via MCP tools like overview, query, and impact analysis.8MIT
- Alicense-qualityAmaintenanceProvides code intelligence for AI coding agents by indexing repositories into a hybrid knowledge graph, enabling agents to query dependencies, impact, and context through 28 MCP tools.2Apache 2.0
Related MCP Connectors
Persistent memory and cross-session learning for AI coding assistants (hosted remote MCP).
User-owned memory for AI agents, Copilot, Claude, IDEs, CLIs, and chat apps over remote MCP.
An MCP server that gives your AI access to the source code and docs of all public github repos
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/BenAHammond/code-auditor-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server