Recon

by jhm1909

Not rated
GitHub

Description

Recon indexes your codebase into a knowledge graph and exposes it via 14 MCP tools. AI agents get dependency mapping, blast radius analysis, safe multi-file rename, execution flow tracing, Cypher queries, semantic search, and PR review — without reading every file. Supports 13…

About

Recon indexes your codebase into a knowledge graph and exposes it via 14 MCP tools. AI agents get dependency mapping, blast radius analysis, safe multi-file rename, execution flow tracing, Cypher queries, semantic search, and PR review — without reading every file. Supports 13 languages, live re-index in ~50ms, and…

Details

Author
jhm1909
Categories
File Management, Knowledge Base, Developer Tools

Setup

Install Recon in your MCP client (Claude Desktop, Cursor, Windsurf, and others).

Repository: https://github.com/jhm1909/recon

Follow the installation instructions in the repository README, then restart your MCP client.

Give your AI agent a brain. Index your codebase in 5 seconds.
A code intelligence MCP server — 8 tools, 13 languages, knowledge graph, zero config.

TL;DR·Quick Start·Features·MCP Setup·Tools·Dashboard

Your AI agent is blind to architecture.It greps, it guesses, it breaks things in files it never read.

That's it. Your agent now has a knowledge graph of your entire codebase:

- Ask "what breaks if I change this function?"— blast radius in ms
- "Trace execution flow from this API route"— cross-language call chain
- "Find code structurally similar to X"— hybrid FTS5 + vector search
- "Safely rename this across the repo"— graph-aware, no false positives
- "Draw me an architecture diagram"— Mermaid, one command
- "Find dead code and circular deps"— code quality rules
- "Which tests are affected?"— test impact analysis

Works withClaude Code, Cursor, Windsurfand any MCP client.Zero config.13 languages.MIT.

AI coding agents areblind to architecture. They read one file at a time, grep for identifiers, guess at call sites, and break things in places they never saw.

You can't fix this with a bigger context window. You needstructure.

Recon indexes your codebase into aknowledge graph— functions, classes, call chains, imports, communities — and exposes it through8 MCP tools,3 prompts, and3 resourcesthat any AI agent can query.

One command, full awareness.Your agent gets dependency mapping, blast radius analysis, safe renames, execution flow tracing, natural language search, and code quality analysis — without reading every file.

# Index your project (zero config) cd /path/to/your/project npx recon-mcp index # Start MCP server for AI agents npx recon-mcp serve # Or start HTTP REST API + interactive dashboard npx recon-mcp serve --http # → http://localhost:3100
npm install -g recon-mcp recon index && recon serve

RequiresNode.js ≥ 20. Tree-sitter grammars are bundled as npm dependencies. v6 uses SQLite storage (.recon/recon.db) — single file, no JSON sprawl.

- 13 languagesvia tree-sitter + dedicated analyzers
- Multi-repoindexing and cross-repo queries
- Community detection— automatic module clustering (label propagation)
- Blast radius— know what breaks before you touch it
- Graph-aware rename— safe multi-file renames
- Execution flow tracing— BFS from entry points through call chains
- Cross-language tracing— follow API calls across Go ↔ TypeScript
- Code quality analysis— dead code, circular deps, unused exports
- Test impact analysis— affected tests per change

- FTS5 full-text search— camelCase/snake_case tokenization with relevance ranking
- Natural language search— find symbols by description, not just exact names
- Hybrid semantic search— vector embeddings (all-MiniLM-L6-v2) + RRF fusion
- MCP Resourcesrecon://URIs for symbols, files, stats
- MCP Prompts— guided workflows for impact analysis, architecture docs, onboarding
- Framework detection— automatic entry point multipliers for 20+ frameworks
- Live re-index— file watcher with surgical graph updates (~50ms per file)
- Graph auto-save— persists to SQLite on every update, survives restarts
- Graph export— Mermaid flowchart, filterable by package/symbol/type

Kotlin and Swift require optional grammars:npm install tree-sitter-kotlin tree-sitter-swiftGo grammar (tree-sitter-go) is bundled by default.

By default, Recon usesFTS5 full-text search. Forhybrid semantic search(find conceptually similar code, not just exact name matches), install one optional package:

Reconauto-detectsit and enables hybrid FTS5 + vector search withall-MiniLM-L6-v2embeddings. No extra config or flags needed — just install and re-index.

Export the knowledge graph asMermaid(paste in GitHub PRs/docs):

# Mermaid flowchart for a package recon export --package mcp --limit 20 # Ego graph around a symbol recon export --symbol handleQuery --depth 2 # Filter by node types and edge types recon export --type Function,Interface --edges CALLS

Also available as MCP toolrecon_export— agents can generate diagrams directly in conversation.

You add MCP config → Agent starts Recon automatically → Done.

- Agent reads MCP config → runsnpx recon-mcp serve
- npxdownloads Recon from npm (cached after first run)
- Reconauto-indexesthe project (cwd) → creates.recon/recon.db
- File watcherstarts → monitors source files for changes
- MCP server opens onstdio(stdin/stdout) — no network, no port
- Agent sees 8 tools + 3 prompts + 3 resources
- Agent receives built-in instructions → knows when to use each tool
- You edit code → graph updates surgically in ~50ms → auto-saved to disk → agent always has fresh data

Zero config. Zero commands. Fully automatic.

{ "mcpServers": { "recon": { "command": "npx", "args": ["recon-mcp", "serve"], "cwd": "/path/to/your/project" } } }
{ "mcpServers": { "recon": { "command": "npx", "args": ["recon-mcp", "serve"], "cwd": "/path/to/your/project" } } }

cwdtells Reconwhich project to index. It scans code from this directory and creates.recon/there.

Index and watch multiple projects from a single Recon server using--projects:

{ "mcpServers": { "recon": { "command": "npx", "args": ["recon-mcp", "serve", "--projects", "/path/to/frontend"], "cwd": "/path/to/backend" } } }

This creates amerged graph— both projects are indexed, watched, and queryable from a single MCP server. Use therepoparameter on any tool to filter by project.

Alternatively, run separate servers per project:

{ "mcpServers": { "recon-backend": { "command": "npx", "args": ["recon-mcp", "serve"], "cwd": "/path/to/backend" }, "recon-frontend": { "command": "npx", "args": ["recon-mcp", "serve"], "cwd": "/path/to/frontend" } } } ### Multi-Repo (Merged Graph) For cross-project queries (e.g., tracing API calls from frontend to backend), use multi-repo mode: 
bash # Index each project with a name cd /path/to/backend && npx recon-mcp index --repo backend cd /path/to/frontend && npx recon-mcp index --repo frontend

{ "mcpServers": { "recon": { "command": "npx", "args": ["recon-mcp", "serve"], "cwd": "/path/to/backend" } } }

Then filter by repo in queries:recon_find({query: "Auth", repo: "backend"}).

recon servehandles indexing automatically:

Built-in Instructions:Recon automatically injectsMCP server instructionsinto the agent's system prompt. The agent will proactively userecon_impactbefore editing,recon_explainfor exploration, andrecon_renamefor safe renames — no manual prompting needed.


recon index # Index codebase (incremental) recon index --force # Force full re-index recon index --repo my-backend # Index as named repo (multi-repo) recon index --embeddings # Include vector embeddings for semantic search recon serve # Start MCP server on stdio (auto-indexes + live watcher) recon serve --projects ../frontend # Watch additional project directories recon serve --http # Start HTTP REST API + dashboard on :3100 recon serve --http --port 8080 # Custom port recon serve --no-index # Skip auto-indexing and file watcher recon serve --no-watch # Auto-index but disable file watcher recon serve --repo my-backend # Serve specific repo only recon export # Export graph as Mermaid flowchart (Mermaid only) recon export --symbol handleQuery # Ego graph around a symbol recon status # Show index stats recon status --repo my-backend # Status for specific repo recon clean # Delete index

Auto-index:servechecks if the index is up-to-date with the current Git commit. If stale, it re-indexes automatically before starting. Use--no-indexto skip.

Create a.recon.jsonat your project root to persist settings:


// .recon.json { "projects":
["../frontend"], // Additional dirs to index + watch "embeddings": false, // Enable vector embeddings "watch": true, // Enable live file watcher "watchDebounce": 1500, // Debounce interval (ms) "ignore": ["generated/"], // Extra paths to ignore "crossLanguage": true, // Enable cross-language API matching "testPatterns": ["/.test.", "/.spec."], // Test file patterns "rules": { // Code quality rule config "deadCode": true, "circularDeps": true, "unusedExports": true } }

Priority:CLI flags always override.recon.json, which overrides defaults.

With a config file, your MCP setup stays minimal:


{ "mcpServers": { "recon": { "command": "npx", "args": ["recon-mcp", "serve"], "cwd": "/path/to/project" } } }

No more longargsarrays — all config lives in.recon.json.

All 8 tools accept an optionalrepoparameter for multi-repo filtering.

Architecture overview: packages, tech stack, entry points, health.

Smart search: exact name, wildcard (*Handler), or natural language.


recon_find(query: string, type?: string, language?: string, package?: string, limit?: number)

Full 360° context: callers, callees, flows, cross-language links, tests.


recon_explain(name: string, file?: string, depth?: number, include_source?: boolean)

Blast radius analysis with affected tests.


recon_impact(target: string, direction?: "upstream" | "downstream", maxDepth?: number, file?: string)

Risk levels:LOW(0-2 d1) ·MEDIUM(3-9) ·HIGH(10-19) ·CRITICAL(20+ or cross-app)

Git diff to affected symbols, risk assessment, and affected tests.


recon_changes(scope?: "unstaged" | "staged" | "all" | "branch", base?: string, include_diagram?: boolean)

Graph-aware safe rename across files. Dry-run by default.


recon_rename(symbol: string, new_name: string, file?: string, dry_run?: boolean)


recon_export(target?: string, scope?: string, depth?: number, direction?: string, limit?: number)

Code quality: dead code, circular deps, unused exports, large files, orphans.


recon_rules(rule?: string, package?: string, language?: string)

Structured data viarecon://URIs — agents READ these without making a tool call.

Three guided workflows that instruct AI agents step-by-step using Recon's tools:

Each prompt returns a structured message with step-by-step instructions. The agent receives the message and autonomously executes each step using Recon tools.

Start the HTTP server to access the interactive code intelligence dashboard:


recon serve --http # → http://localhost:3100

- Graph Tab— Force-directed knowledge graph with type-colored nodes, community coloring toggle, and click-to-inspect
- Processes Tab— Execution flow viewer with call chains, branch counts, and community tags
- Impact Tab— Interactive blast radius analysis with risk levels and confidence tiers
- Live Search— Debounced search dropdown (200ms) with keyboard navigation (↑↓ Enter Esc)
- Graph Legend— Node type → shape/color mapping
- Package Sidebar— Filter graph by package with symbol counts

Index and query multiple repositories from a single.recon/directory:


cd /path/to/backend && recon index --repo backend cd /path/to/frontend && recon index --repo frontend recon serve # Serve all repos (merged graph) recon serve --repo backend # Serve single repo

All tools accept an optionalrepoparameter. Per-repo indices are stored in.recon/recon.db.

FTS5 replaces custom BM25, with camelCase/snake_case tokenization built into SQLite.

- Tokenizersplits camelCase, PascalCase, snake_case, digit boundaries (base64Decode["base", "64", "decode"])
- Name boost— symbol names weighted 3x higher than file paths
- Ranking— FTS5 rank function with relevance scoring
- Fallback— substring matching when FTS5 returns nothing

Enable withrecon index --embeddings, then userecon_find({query: "...", semantic: true}).

- Model:Xenova/all-MiniLM-L6-v2(384-dim embeddings via@huggingface/transformers)
- Fusion:Reciprocal Rank Fusion (RRF) —score = 1/(k + rank), k=60
- Storage:Persisted in recon.db


├── src/ │ ├── analyzers/ │ │ ├── ts-analyzer.ts # TypeScript/React extraction (Compiler API) │ │ ├── cross-language.ts # Go route ↔ TS API call matching │ │ ├── framework-detection.ts # 20+ framework entry point detection │ │ └── tree-sitter/ # Multi-language tree-sitter analyzer │ ├── graph/ │ │ ├── graph.ts # KnowledgeGraph — in-memory Map + adjacency + version │ │ ├── community.ts # Label propagation community detection │ │ └── process.ts # Execution flow detection (BFS) │ ├── watcher/ │ │ └── watcher.ts # Live file watcher — surgical graph updates │ ├── mcp/ │ │ ├── server.ts # MCP server (stdio transport) │ │ ├── tools.ts # 8 tool definitions (JSON Schema) │ │ ├── handlers.ts # Tool dispatch + query logic │ │ ├── prompts.ts # 3 MCP prompt templates │ │ ├── hints.ts # Next-step hints for agent guidance │ │ ├── instructions.ts # AI agent instructions (system prompt) │ │ ├── augmentation.ts # Compact context injection │ │ ├── staleness.ts # Index freshness check │ │ ├── rename.ts # Graph-aware multi-file rename │ │ └── resources.ts # MCP Resources (recon:// URIs) │ ├── search/ │ │ ├── fts5.ts # FTS5 full-text search │ │ ├── hybrid-search.ts # FTS5 + vector RRF fusion │ │ └── vector-store.ts # In-memory cosine similarity │ ├── server/ │ │ └── http.ts # Express HTTP REST API + dashboard │ ├── dashboard/ # Interactive web dashboard │ │ ├── index.html │ │ ├── style.css │ │ └── app.js │ └── cli/ │ ├── index.ts # Commander CLI │ └── commands.ts # index, serve, status, clean


TS Compiler API → components ─┐ tree-sitter → 13 languages ├─→ KnowledgeGraph ─→ .recon/recon.db (SQLite) router.go → API routes ─┤ (in-memory) single database: label propagation → clusters ─┤ + FTS5 Index - nodes, relationships BFS → execution flows ─┘ + Communities - search index (FTS5) + Embeddings - embeddings + Processes - metadata │ ┌───────┤ File Watcher (chokidar) surgical update ~50ms/file │ ┌─────────┴──────────┐ MCP Server (stdio) HTTP REST API ┌───┴────┐────┐ (:3100 + Dashboard) 8 Tools 3 Prompts 3 Resources │ │ recon://symbol/{name} ┌─────┼────┐ │ recon://file/{path} │ │ │ │ recon://stats Claude Cursor … │ Code Antigravity │ │ pre_commit architecture onboard


recon serve --http # Listen on :3100 recon serve --http --port 8080 # Custom port


# Search for a symbol curl -X POST http://localhost:3100/api/tools/recon_find \ -H 'Content-Type: application/json' \ -d '{"query": "AuthMiddleware"}' # Read a resource curl 'http://localhost:3100/api/resources/read?uri=recon://symbol/AuthMiddleware'
``

CORS enabled by default for browser clients.

Security:HTTP server binds to localhost (127.0.0.1) by default. Use--host 0.0.0.0`to expose on network.

No reviews yet — be the first

Sign in to leave a review

Use Google, GitHub, or an email account so ratings stay tied to real people.

Email sign in

No reviews posted yet.