Scan repository architecture graph
scan_repository_graphScans a local repository and returns its architecture graph as JSON with file nodes, import edges, clusters, and metrics. Use it to understand codebase structure and find hub files.
Instructions
Scan a local repository and return its architecture graph as JSON: one node per source file (id, layer, cluster, in/out degree, lines of code), import edges between files, nested directory clusters, and metrics (totalFiles, totalEdges, density, couplingFactor, deadCodeCount, foldedUtilityCount). Use it to understand how a codebase is organised, find hub files, or feed graph data into further analysis. Use query_impact_path instead when you only need the callers of one file, and generate_architecture_html when a human wants a visual map. Every call performs its own fresh static scan of path; no prior scan is required. Reads the local filesystem only, executes nothing, and sends nothing over the network. Supports TypeScript/JavaScript, Python, Go and Rust; external packages are dropped, test files are excluded, and layer labels (entry/business/data/util/unknown) are filename heuristics, not semantic judgements.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| path | Yes | Absolute path to the repository root to scan, e.g. "/home/me/project" or "C:/dev/project". Relative paths resolve against the MCP server process working directory, which is usually not the project, so prefer absolute paths. | |
| maxDepth | No | Maximum directory nesting depth to scan below the root. Integer, default 6. Use 0 to scan only files in the root directory; raise it for deeply nested monorepos. | |
| collapseUtils | No | Whether to mark high fan-in utility files (more than 15 callers and at most two dependencies, or utility-like names such as utils/helpers/types/config) as folded. Boolean, default true. Folded nodes stay in the graph data with isFolded: true; set false to treat every file equally. |