neatcode-mcp
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., "@neatcode-mcpWhere do we handle booking cancellation?"
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.
_ _
_ __ ___ __ _ | |_ ___ ___ __| | ___
| '_ \ / _ \ / _` | | __| / __| / _ \ / _` | / _ \
| | | || __/ | (_| | | |_ | (__ | (_) | (_| | | __/
|_| |_| \___| \__,_| \__| \___| \___/ \__,_| \___|๐ง neatcode
Local-first repo intelligence for AI coding agents. The graph your agent wishes it had.
Stop letting your agent re-grep your repo on every turn. neatcode indexes your TypeScript codebase into a real AST graph, learns the conventions your code already follows, and answers your agent's structural questions over MCP โ deterministic, no LLM in the hot path.
โโโโโโโโโโโโโโโโโโโโ MCP โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ ๐ป your editor โ โโโโโstdioโโโโโโถ โ โ๏ธ neatcode-mcp (11 tools) โ
โ โ โ |
โ Claude Code โ โ ๐ query_graph ๐ find_node โ
โ Cursor โ โ ๐ค๏ธ trace_flow โ
validate โ
โ Codex โ โ ๐ก propose_rule ๐ get_rules โ
โโโโโโโโโโโโโโโโโโโโ โ ๐ add_note ๐ repo_overview โ
โ โฎ accept_proposed_rule โ
โ โฎ derive_candidates โ
โ โฎ accept_derived_candidates โ
โโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโ
โ
โโโโโโโโโโโโโผโโโโโโโโโโโโ
โ ๐ .neatcode/ โ
โ โโโ graph.db โ
โ โโโ skills.yaml โ
โ โโโ decisions.yaml โ
โ โโโ REPO_OVERVIEW โ
โโโโโโโโโโโโโโโโโโโโโโโโโ๐ก Why
Without neatcode | With neatcode |
Agent re-greps the repo every turn | Agent calls |
"What conventions does this repo follow?" โ vibes | Heuristic miner derives conventions from real code |
Agent writes |
|
Rules live in tribal memory or stale | Rules live in |
Each chat starts cold |
|
๐ Quickstart โ 3 commands
# 1. Install (one tarball, both binaries)
npm i -g @neatcodeai/cli
# 2. Index your repo
cd ~/your/typescript/repo
neatcode init
# 3. Wire it into Claude Code
neatcode claude installRestart Claude Code. Your agent now has 11 structural tools โ and a fresh .neatcode/REPO_OVERVIEW.md for instant context.
๐ฏ Founder's target: installed in 10 minutes, useful in 1 hour.
๐ฌ What it looks like in practice
๐ค You: "Where do we handle booking cancellation?"
๐ค Agent: [calls query_graph with "booking cancellation"]
โ
๐ BookingsController.cancel (apps/api/src/bookings/โฆ)
๐ BookingsService.cancel (called by Controller)
๐ RefundService.issueRefund (called by Service)
๐ BookingCancelledEvent (emitted at end)
Here's the flow: Controller โ Service โ RefundService,
with a domain event published on completion.vs. without neatcode: agent runs 4 grep calls, reads 18 files, and still misses the event publisher.
๐ท TypeScript compatibility
neatcode ships TypeScript types and is built around ts-morph. It indexes any TypeScript codebase that compiles.
What | Compatibility |
TypeScript versions |
|
File extensions |
|
Module systems | ESM, CommonJS, mixed โ output target doesn't matter |
| Auto-detected at repo root; respects |
JSX / TSX | Yes โ |
Decorators | Stage-3 standard + experimental (NestJS, TypeORM, class-validator) |
Type-aware queries | Uses TS TypeChecker for cross-file call-graph resolution |
Strict mode | Recommended but not required |
Monorepos | pnpm / yarn / npm workspaces โ each package gets its own |
Frameworks | NestJS, React, Next.js, Express, Fastify (auto-detected; no rule packs) |
Not on TypeScript? neatcode v0.1 is TS-only by design โ Python, Go, and JS support are roadmapped (see Roadmap).
โก CLI reference
neatcode <command> [options]๐ฅ Indexing
Command | What it does |
| First-time setup. Creates |
| Re-index changed files. Content-hash cached โ editing 3 files re-parses 3 files. |
| Ad-hoc graph query from the terminal. Same engine as |
๐ Skills (conventions)
Command | What it does |
| Mine the graph for high-coverage patterns. Writes |
| Promote candidates into |
| Mark a candidate as rejected so the next |
โ Validation
Command | What it does |
| No args โ check whole graph. With files โ treat as planned diff. Pre-existing offenders are grandfathered under |
| Silence a specific violation. Auto-expires with |
| Show active exceptions. |
| Append-only revoke (original entry preserved). |
๐ Editor integration
Command | What it does |
| Merges |
| Reverses both. Pre-existing CLAUDE.md content is preserved. |
| Wires neatcode-mcp into Cursor's MCP config. |
| Wires neatcode-mcp into Codex. |
๐ MCP integration
The agent gets 11 tools the moment Claude Code restarts after neatcode claude install:
Discovery + queries
Tool | When the agent calls it |
| Once per session. Returns frameworks, top symbols, layout, active rules, dirty-file status. |
| "What handles X?", "what calls Y?" โ keyword-scored search with optional 1-hop expansion. |
| Exact lookup by name or |
| Multi-hop path traversal. "From |
Rules + validation
Tool | When the agent calls it |
| Returns active rules, candidates, rejected list, and repo context for curation flows. |
| Pre-flight on a planned change. Returns violations + four-option suggestions block. |
| Inspects a user utterance for rule-language ("never", "must", "always"). Surfaces a structured proposal. |
| Promote a single proposed rule into |
| Run the heuristic miner on demand and return candidate rules. |
| Bulk-accept miner candidates by id, confidence, or |
Memory
Tool | When the agent calls it |
| Persist a fact the user shared. Appends to |
All deterministic. No LLM call inside the server. The agent is the brain; neatcode is the spine.
๐ What lives in .neatcode/
neatcode init creates the directory and seeds it with the indexer output and miner proposals. The remaining files appear on demand as you accept rules, record exceptions, and let the agent take notes.
Created by neatcode init:
<repo-root>/
โโโ .neatcodeignore team-shared excludes (commit it)
โโโ .neatcode/
โโโ graph.db SQLite graph (regenerate; should gitignore)
โโโ skills.candidates.yaml miner proposals (regenerated each sync)
โโโ REPO_OVERVIEW.md session-start brief (commit it)
โโโ plans/ /writing-plans skill scaffold (commit it)
โโโ specs/ /brainstorming skill scaffold (commit it)Appears on demand:
.neatcode/
โโโ skills.yaml on first `skills accept` (commit it)
โโโ skills.local.yaml on `skills accept --local` (should gitignore)
โโโ skills.rejected.yaml on first `skills reject` (commit it)
โโโ decisions.yaml on first exception/supersede (commit it)
โโโ memory/ on first `add_note` MCP call (commit it)
โโโ mcp.log on first MCP server start (should gitignore)โน๏ธ
neatcode initdoesn't touch your.gitignore. Add the regeneratable bits yourself:.neatcode/graph.db* .neatcode/skills.candidates.yaml .neatcode/skills.local.yaml .neatcode/mcp.log
graph.db is regeneratable from a single neatcode sync. The committed files above form the team-shared memory of the repo โ that's the part you code-review.
๐ How rules emerge
Three sources, one lifecycle:
Heuristic mining โ
neatcode skills deriveproposes candidates above the coverage threshold. Four primitives mined today:decorator-required,annotation-forbidden,naming-pattern,folder-naming-convention.Prompts โ when the user says "all classes with @Controller must use @UseGuards", the agent calls
propose_rule_from_prompt. A local keyword classifier โ no LLM in the loop โ extracts a structured candidate. User confirms, agent runsskills accept.Manual โ hand-edit
.neatcode/skills.yaml(create it on first rule). The schema is documented and stable.
Rules are validated bidirectionally:
A diff that violates a rule โ four-option UX (record exception ยท time-bounded ยท supersede the rule ยท abort).
A rule that no longer matches the codebase โ can be superseded with an entry in
decisions.yaml.
๐งฉ The six primitives
Primitive | Mined? | Example |
| yes | classes with |
| yes | classes with |
| yes | classes with |
| yes | files in |
| via prompt |
|
| via prompt |
|
Layer constraints ("controllers can't reach repositories") are expressed via edge-forbidden โ no special "layer" type.
๐ฑ Default rule scope: new
Rules default to scope: "new" โ pre-existing violations are grandfathered. Only code introduced after the rule was promoted gets checked. Set scope: "all" in YAML to enforce against existing code.
This avoids the classic "we accepted 30 conventions and now CI is on fire" problem.
๐๏ธ Architecture
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ ๐ ts-morph parser โโโถ ๐๏ธ polymorphic graph โ
โ (SQLite) โ
โโโโโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ
โโโโโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโ
โผ โผ โผ
๐ query_graph ๐ skills derive โ
validate_diff
๐ find_node (heuristic miner) (engine.ts)
๐ค๏ธ trace_flow โ โ
โ โผ โผ
โ skills.candidates active rules โฉ
โ โ accept decisions.yaml
โผ โ
๐ค agent answers โโโโโโโโโโโโโโโโโโโโโโโโโโ โ ๏ธ violations
+ 4-option UXEvery relationship gets a confidence label (EXTRACTED | INFERRED | AMBIGUOUS); the validator never fires on rules built solely from AMBIGUOUS edges. The repo-root-relative qualified_name is the FK that ties nodes, edges, rules, and decisions together. There's no LLM in the hot path of any MCP tool โ the LLM lives in the agent harness (Claude Code, Cursor, Codex), and neatcode is the spine.
๐ฆ Packages
The CLI bundles everything you need; the others are split for advanced use.
Package | Install for | What it gives you |
Most users |
| |
Bare MCP server | The stdio MCP binary alone. | |
Library users |
|
Single install gets you everything:
npm i -g @neatcodeai/cli
which neatcode neatcode-mcp๐ ๏ธ Develop
pnpm install # builds better-sqlite3 native module
pnpm build # builds all three packages
pnpm typecheck # tsc --noEmit across packages
pnpm test # vitest run
pnpm test:watch
pnpm clean
# Smoke-test
node packages/cli/dist/index.js --helpNode 20+, TypeScript strict + verbatimModuleSyntax, ESM only.
๐บ๏ธ Roadmap
v0.1 (shipped) โ TypeScript-only, 11 MCP tools, validation engine, four-option UX, heuristic miner with four primitives, Claude Code installer.
v0.2 โ Cursor + Codex installers,
import-forbidden/edge-forbiddenmining, agent-proposed rules (skills derive --with-agent).v0.3 โ Watcher mode (
neatcode dev), JavaScript /.js/.cjsindexing, TypeScript LSP integration.Later โ Python via
tree-sitter, Go viago/parser, multi-language graphs joined by import-edge inference.
Issues, feature requests, and convention horror stories: github.com/HitmanDark07/neatcodeai/issues.
๐ก๏ธ Hard rules (project guarantees)
No framework rule packs โ conventions emerge per-repo.
Decorators / generics / JSX live in
extraJSON, not schema columns.qualified_nameis always repo-root-relative.Rules built solely on
AMBIGUOUSedges never enforce.v0.1 doesn't solve general NestJS DI โ
@Module({ providers, controllers, imports })arrays become direct edges and we stop there.
๐ License
MIT ยท built with โค๏ธ by @HitmanDark07
โญ If neatcode helps your agent stop guessing, star the repo.
This server cannot be installed
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Latest Blog Posts
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/HITMANdark07/neatcodeai'
If you have feedback or need assistance with the MCP directory API, please join our Discord server