Recon
Indexes C++ codebases to map classes, structs, namespaces, functions, inheritance, and call graphs.
Analyzes Kotlin source code to extract information about classes, interfaces, enums, functions, and import declarations.
Generates Mermaid flowchart diagrams from the code knowledge graph for architectural visualization.
Provides code intelligence for PHP by indexing classes, interfaces, functions, methods, and cross-file calls.
Indexes Python projects to map classes, functions, methods, inheritance, and call chains.
Extracts structural information from Ruby code, including classes, modules, methods, and inheritance patterns.
Performs deep indexing of Rust codebases, capturing structs, enums, traits, functions, and impl blocks.
Supports exporting codebase architecture and ego graphs to SVG format via Graphviz DOT rendering.
Indexes Swift source files to extract data on classes, structs, enums, functions, and dependencies.
Uses the TypeScript Compiler API to provide deep analysis of modules, components, types, and JSX usage.
Why Recon?
AI coding agents are blind to architecture. They grep, they guess, they break things.
Recon fixes this by indexing your codebase into a knowledge graph β functions, classes, call chains, imports, communities β and exposing it through 14 MCP tools, 3 prompts, and 5 resources that any AI agent can query.
π‘ One command, full awareness. Your agent gets dependency mapping, blast radius analysis, safe renames, execution flow tracing, Cypher queries, and hybrid semantic search β without reading every file.
Quick Start
# 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:3100Global install (optional):
npm install -g recon-mcp
recon index && recon serveRequires Node.js β₯ 20. Tree-sitter grammars are bundled as npm dependencies.
Features
π Code Intelligence
13 languages via tree-sitter + dedicated analyzers
Multi-repo indexing 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
PR Review β graph-aware blast radius, risk assessment, affected flows
β‘ Search & Query
BM25 search β camelCase/snake_case tokenization with relevance ranking
Hybrid semantic search β vector embeddings (all-MiniLM-L6-v2) + RRF fusion
Cypher-like queries β
MATCH/WHERE/RETURNstructural queriesMCP Resources β
recon://URIs for packages, symbols, files, processes, statsMCP 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 graph to disk every 5 updates or 30s, survives restarts
Graph export β Mermaid flowchart or Graphviz DOT, filterable by package/symbol/type
Supported Languages
Language | Analyzer | What's indexed |
Go | Tree-sitter + dedicated | Packages, functions, methods, structs, interfaces, call graph, imports |
TypeScript | Dedicated (Compiler API) | Modules, components, functions, types, JSX usage, imports |
Python | Tree-sitter | Classes, functions, methods, inheritance, imports, calls |
Rust | Tree-sitter | Structs, enums, traits, functions, impl blocks, use imports, calls |
Java | Tree-sitter | Classes, interfaces, enums, methods, imports, calls |
C | Tree-sitter | Functions, structs, enums, macros, #include imports, calls |
C++ | Tree-sitter | Classes, structs, namespaces, enums, functions, inheritance, calls |
Ruby | Tree-sitter | Classes, modules, methods, inheritance, require imports, calls |
PHP | Tree-sitter | Classes, interfaces, functions, methods, use imports, calls |
C# | Tree-sitter | Classes, interfaces, enums, methods, using imports, calls |
Kotlin | Tree-sitter (optional) | Classes, interfaces, enums, functions, import declarations, calls |
Swift | Tree-sitter (optional) | Classes, structs, enums, functions, import declarations, calls |
Cross-language | Route matching | HTTP API routes mapped from Go handlers to TypeScript consumers |
Kotlin and Swift require optional grammars:
npm install tree-sitter-kotlin tree-sitter-swiftGo grammar (tree-sitter-go) is bundled by default.
Enhanced Search (Optional)
By default, Recon uses BM25 keyword search. For hybrid semantic search (find conceptually similar code, not just exact name matches), install one optional package:
npm install @huggingface/transformersRecon auto-detects it and enables hybrid BM25 + vector search with all-MiniLM-L6-v2 embeddings. No extra config or flags needed β just install and re-index.
Graph Export
Export the knowledge graph as Mermaid (paste in GitHub PRs/docs) or Graphviz DOT (render to SVG):
# Mermaid flowchart for a package
recon export --package mcp --limit 20
# DOT ego graph around a symbol
recon export --format dot --symbol handleQuery --depth 2
# Filter by node types and edge types
recon export --type Function,Interface --edges CALLS
# Pipe DOT to SVG
recon export --format dot | dot -Tsvg > architecture.svgAlso available as MCP tool recon_export β agents can generate diagrams directly in conversation.
PR Review
Graph-aware code review β know what breaks before you merge:
# Review all uncommitted changes
recon review
# Review current branch vs main
recon review --scope branch --base main
# Review only staged changes
recon review --scope stagedOutput includes: per-file risk (π΄π‘π’), blast radius, affected execution flows, architecture diagram, and review priorities. Also available as MCP tool recon_pr_review.
How It Works
You add MCP config β Agent starts Recon automatically β Done.When your AI agent starts:
Agent reads MCP config β runs
npx recon-mcp servenpxdownloads Recon from npm (cached after first run)Recon auto-indexes the project (
cwd) β creates.recon/folderFile watcher starts β monitors source files for changes
MCP server opens on stdio (stdin/stdout) β no network, no port
Agent sees 14 tools + 3 prompts + 5 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.
MCP Integration
Single Project
Add to your AI agent's MCP config:
Claude Code (.claude/mcp.json)
{
"mcpServers": {
"recon": {
"command": "npx",
"args": ["recon-mcp", "serve"],
"cwd": "/path/to/your/project"
}
}
}Cursor (.cursor/mcp.json)
{
"mcpServers": {
"recon": {
"command": "npx",
"args": ["recon-mcp", "serve"],
"cwd": "/path/to/your/project"
}
}
}
cwdtells Recon which project to index. It scans code from this directory and creates.recon/there.
Multiple Projects
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 a merged graph β both projects are indexed, watched, and querable from a single MCP server. Use recon_list_repos to see all repos, and the repo parameter on any tool to filter.
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_query({query: "Auth", repo: "backend"}). Use recon_list_repos to see all indexed repos.
Auto-Indexing
recon serve handles indexing automatically:
Scenario | Behavior |
First run (no | Full index β creates |
Code changed since last index | Incremental re-index (only changed files) |
No changes | Uses cached index β instant startup |
Force re-index |
|
Skip auto-index |
|
Index but no watcher |
|
Built-in Instructions: Recon automatically injects MCP server instructions into the agent's system prompt. The agent will proactively use
recon_impactbefore editing,recon_contextfor exploration, andrecon_renamefor safe renames β no manual prompting needed.
CLI Commands
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
recon export --format dot # Export as Graphviz DOT
recon export --symbol handleQuery # Ego graph around a symbol
recon review # PR review β blast radius + risk
recon review --scope branch # Review branch diff vs main
recon review --scope staged # Review staged changes only
recon status # Show index stats
recon status --repo my-backend # Status for specific repo
recon clean # Delete index
recon init # Create .recon.json config fileAuto-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.
Configuration
Create a .recon.json at your project root to persist settings:
recon init # Creates .recon.json with defaults// .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
}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 long
argsarrays β all config lives in.recon.json.
Tool Reference
All 14 tools accept an optional repo parameter for multi-repo filtering.
recon_packages
List all packages/modules with dependency relationships.
recon_packages(language?: "go" | "typescript" | "all")recon_query
BM25 ranked search with automatic camelCase/snake_case tokenization. Exact names rank highest. Supports optional hybrid BM25 + vector search with Reciprocal Rank Fusion.
recon_query(query: string, type?: string, language?: string, semantic?: boolean, limit?: number)recon_context
360Β° view of a symbol β callers, callees, imports, methods, implementations, community membership.
recon_context(name: string, file?: string, includeSource?: boolean)recon_impact
Blast radius analysis β what breaks if you change a symbol. Includes affected communities and confidence tiers.
recon_impact(target: string, direction: "upstream" | "downstream", maxDepth?: number)Risk levels: LOW (0β2 d1) Β· MEDIUM (3β9) Β· HIGH (10β19) Β· CRITICAL (20+ or cross-app)
recon_detect_changes
Map git diff to affected symbols and trace blast radius.
recon_detect_changes(scope?: "unstaged" | "staged" | "all" | "branch", base?: string)recon_api_map
Cross-language API route map β endpoint β Go handler β TypeScript consumers.
recon_api_map(method?: string, pattern?: string, handler?: string)recon_rename
Safe multi-file rename using the knowledge graph. Each edit is tagged with confidence: graph (high, safe to accept) or text_search (review carefully).
recon_rename(symbol_name: string, new_name: string, dry_run?: boolean)recon_query_graph
Cypher-like structural queries against the knowledge graph.
MATCH (a)-[:CALLS]->(b:Function) WHERE b.name = 'main' RETURN a.name, a.file
MATCH (s:Struct)-[:HAS_METHOD]->(m:Method) WHERE s.name = 'Config' RETURN m.name
MATCH (child:Class)-[:EXTENDS]->(parent:Class) RETURN child.name, parent.nameNode types: Package Β· File Β· Function Β· Method Β· Struct Β· Interface Β· Module Β· Component Β· Type Β· Class Β· Enum Β· Trait
Edge types: CONTAINS Β· DEFINES Β· CALLS Β· IMPORTS Β· HAS_METHOD Β· IMPLEMENTS Β· USES_COMPONENT Β· CALLS_API Β· EXTENDS
recon_list_repos
List all indexed repositories with node/relationship counts and git info.
recon_processes
Detect execution flows by tracing call chains from entry points. Sorted by complexity.
recon_processes(limit?: number, filter?: string)recon_augment
Compact symbol context for AI augmentation β returns callers, callees, processes, and community in one concise block.
recon_augment(pattern: string)recon_watcher_status
Get the live status of the file watcher β active state, watched directories, update count, last update, pending queue, and recent errors.
recon_watcher_status()recon_export
Export the knowledge graph as a Mermaid flowchart or Graphviz DOT diagram. Filterable by package, symbol, node type, and edge type.
recon_export(format?: "mermaid" | "dot", package?: string, symbol?: string, depth?: number, type?: string, edges?: string, limit?: number)recon_pr_review
Graph-aware PR review β analyzes code changes using the dependency graph to assess blast radius, risk, affected execution flows, and review priorities.
recon_pr_review(scope?: "staged" | "unstaged" | "branch" | "all", base?: string, include_diagram?: boolean)Risk levels: LOW Β· MEDIUM Β· HIGH Β· CRITICAL β scored by direct callers, confidence tiers, and cross-community impact.
MCP Resources
Structured data via recon:// URIs β agents READ these without making a tool call.
Resource | URI | Description |
Package Map |
| All packages/modules with dependency counts |
Index Stats |
| Node and relationship counts by type and language |
Symbol Detail |
| Symbol definition, callers, callees, relationships |
File Symbols |
| All symbols in a file with types and line ranges |
Process Trace |
| Execution flow trace from entry point through call chain |
MCP Prompts
Three guided workflows that instruct AI agents step-by-step using Recon's tools:
Prompt | Description | Usage |
| Pre-commit change analysis β risk report |
|
| Architecture documentation with mermaid diagrams |
|
| New developer onboarding guide |
|
Each prompt returns a structured message with step-by-step instructions. The agent receives the message and autonomously executes each step using Recon tools.
Dashboard
Start the HTTP server to access the interactive code intelligence dashboard:
recon serve --http # β http://localhost:3100Features:
πΉ 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
Multi-Repo Support
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 repoAll tools accept an optional repo parameter. Use recon_list_repos to discover indexed repos. Per-repo indices are stored under .recon/repos/{repoName}/.
Search
BM25 Keyword Search
Tokenizer splits camelCase, PascalCase, snake_case, digit boundaries (
base64Decodeβ["base", "64", "decode"])Name boost β symbol names weighted 3Γ higher than file paths
IDF scoring β rare terms rank higher
Fallback β substring matching when BM25 returns nothing
Hybrid Semantic Search
Enable with recon index --embeddings, then use recon_query({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=60Storage: Persisted to
.recon/embeddings.json
Architecture
βββ 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 # 14 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/
β β βββ bm25.ts # BM25 search index
β β βββ hybrid-search.ts # BM25 + vector RRF fusion
β β βββ vector-store.ts # In-memory cosine similarity
β βββ query/
β β βββ parser.ts # Cypher DSL parser
β β βββ executor.ts # Query execution + formatting
β βββ 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, cleanData Flow
TS Compiler API β components ββ
tree-sitter β 13 languages βββ KnowledgeGraph ββ .recon/graph.json
router.go β API routes ββ€ (in-memory) ββ .recon/meta.json
label propagation β clusters ββ€ + BM25 Index ββ .recon/search.json
BFS β execution flows ββ + Communities ββ .recon/embeddings.json
+ Embeddings
+ Processes
β
βββββββββ€
File Watcher (chokidar)
surgical update ~50ms/file
β
βββββββββββ΄βββββββββββ
MCP Server (stdio) HTTP REST API
βββββ΄ββββββββββ (:3100 + Dashboard)
14 Tools 3 Prompts 5 Resources
β β recon://packages
βββββββΌβββββ β recon://symbol/{name}
β β β β recon://file/{path}
Claude Cursor β¦ β recon://process/{name}
Code Antigravity β recon://stats
β
detect_impact
generate_map
onboardHTTP REST API
recon serve --http # Listen on :3100
recon serve --http --port 8080 # Custom portMethod | Path | Description |
|
| Health check + index stats |
|
| List available tools with schemas |
|
| Execute a tool (body = JSON params) |
|
| List MCP resources + templates |
|
| Read resource by URI |
# Search for a symbol
curl -X POST http://localhost:3100/api/tools/recon_query \
-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.
Graph Schema
Node Properties
Property | Type | Description |
|
| Unique node identifier |
|
| Function, Method, Struct, Interface, Class, etc. |
|
| Symbol name |
|
| Source file path |
|
| Line range in file |
|
| Source language |
|
| Package/module path |
|
| Whether the symbol is exported |
|
| Repository name (multi-repo) |
|
| Community/cluster label (auto-detected) |
Relationship Types
Type | Meaning | Confidence |
| Package/Module β File | 1.0 |
| File β Symbol | 1.0 |
| Function β Function | 0.5β1.0 |
| Package β Package / File β File | 1.0 |
| Struct/Class β Method | 1.0 |
| Struct β Interface / Class β Trait | 0.8β0.9 |
| Class β Class (inheritance) | 0.9 |
| Component β Component (JSX) | 0.9 |
| TS Function β Go Handler (cross-language) | 0.85β0.95 |
Testing
npm test # Run all tests
npx vitest --watch # Watch mode459 tests across 17 test suites:
Suite | Tests | Coverage |
| 23 | KnowledgeGraph API β add, query, remove, serialize |
| 30 | MCP tool dispatch with mock graph |
| 27 | BM25 tokenizer, ranking, serialization |
| 28 | Graph-aware rename, disambiguation, formatting |
| 35 | Resource URI parsing, all 5 resource types |
| 58 | Multi-language extraction, cross-language consistency |
| 47 | Cypher parser, execution, markdown formatting |
| 16 | Multi-repo storage, filtering, list_repos |
| 13 | Label propagation clustering, handler integration |
| 39 | Vector store, RRF fusion, hybrid search |
| 21 | Execution flow detection, BFS, cycles |
| 18 | HTTP REST API routes, CORS |
| 27 | Path/name framework detection, multipliers |
| 28 | Augmentation engine, staleness check, MCP prompts |
Community Detection
After indexing, Recon automatically detects code communities using the Label Propagation Algorithm (LPA):
Each function/class/struct gets a
communitylabel based on its connectionsCommunities are named after the most common package in each cluster
recon_contextshows community membershiprecon_impactlists affected communities for cross-module awareness
Live Re-Indexing
Recon watches source files and updates the knowledge graph in real-time:
Feature | Detail |
File watcher | chokidar v4 with 1.5s debounce, |
Surgical update | Remove old nodes β re-parse single file β insert new nodes + edges |
Speed | ~50ms per file change |
TS files | Full re-analysis: symbols, imports, calls, JSX components |
Tree-sitter files | Full re-analysis: symbols, calls, heritage, methods (Python, Rust, Java, etc.) |
Edge reconstruction | CALLS, IMPORTS, HAS_METHOD, EXTENDS, IMPLEMENTS, USES_COMPONENT |
Incoming callers | Automatically re-linked after update |
BM25 cache | Auto-invalidated via graph version counter |
Multi-project |
|
Ignored |
|
Incremental Indexing
Files are hashed with SHA-256. On recon index, only changed files are re-analyzed:
TypeScript: per-file granularity via Compiler API
Tree-sitter: per-file granularity for all 13 languages
Auto-detection:
servecompares Git commit hashes to detect stale indexesForce full re-index with
--force
License
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/jhm1909/recon'
If you have feedback or need assistance with the MCP directory API, please join our Discord server