grasp-mcp-server
Analyzes GitHub repositories to generate interactive architecture maps, dependency graphs, health scores, and security findings, with support for PR impact analysis and code ownership based on git history.
Provides AI assistant capabilities that can answer questions about codebases with direct references to dependency graphs, supporting OpenAI GPT models for analyzing architecture, hotspots, and refactoring suggestions.
Detects React custom hooks and analyzes React codebases for patterns, dependencies, and architectural layers as part of the comprehensive code analysis capabilities.
Why Grasp?
Ever opened a new codebase and felt completely lost? Grasp turns any GitHub repository or local codebase into an interactive architecture map in seconds — no setup, no accounts, no data leaving your machine.
Paste URL / Select Files → See Architecture → Make Better DecisionsNo installation — runs 100% in your browser
No data collection — your code never leaves your machine
No accounts — paste a URL and go
Works offline — analyze local files without internet
Screenshots
🕸️ Dependency Graph — see exactly how files connect
🏛️ Architecture Diagram — your codebase by layer
📦 Treemap — files sized by line count
🏢 Team Dashboard — health across all your repos at a glance
Features
🏛️ Architecture Diagram
Layer-by-layer diagram of your entire codebase. Components grouped by architectural layer (Config, Utils, Data, Services, Components, UI, Test) with dependency arrows between them. Pan, zoom, click any block to explore.
🕸️ Interactive Dependency Graph
Force-directed graph showing how every file connects. Click any node to highlight its dependencies. Drag, zoom, multi-select with Shift+click.
💥 Blast Radius Analysis
"If I change this file, what breaks?" — Select any file and see exactly how many files would be affected, highlighted directly on the graph.
👥 Code Ownership
Top contributors for any file based on git history, with line-percentage breakdowns. One-click jump to GitHub Blame.
🔐 Security Scanner
Automatic detection of:
Hardcoded secrets & API keys
SQL injection vulnerabilities
Dangerous
eval()usageDebug statements left in production
🧩 Pattern Detection
Automatically identifies Singleton, Factory, Observer/Event patterns, React custom hooks, and anti-patterns (God Objects, high coupling).
📊 Health Score
Instant A–F grade based on dead code percentage, circular dependencies, coupling metrics, and security issues.
🔥 Activity Heatmap
Color files by commit frequency to see the hot spots in your codebase. Works for both GitHub repos (via API) and local repos (via git log — no internet required).
🔍 Graph Node Filtering
Type in the filter bar at the top of the graph to instantly narrow 200+ nodes down to just the files you care about — matching nodes stay visible, their direct connections dim in, everything else fades out. Press Escape to clear.
🚫 Custom Ignore Patterns
Add your own directory exclusions (e.g. generated/, __mocks__/, fixtures/) via the ⋯ → 🚫 Ignore Patterns menu. Persists across sessions. Built-in defaults (node_modules, dist, .git, etc.) cannot be removed.
📋 PR Impact Analysis
Paste a PR URL to see which files it touches and calculate the blast radius of proposed changes before merging.
📡 Live Watch Mode
Run grasp . --watch to start a local dev server with real-time SSE sync. Every time you save a file, the browser graph reloads automatically — no manual refresh. A LIVE badge appears in the top bar while connected.
⏮️ Time-Travel Architecture Scrubber
Run grasp . --timeline to load your last 30 git commits as a scrubber panel. Drag the slider to any commit — nodes that changed in that commit glow yellow on the graph, so you can watch your architecture evolve over time.
🏢 Team Dashboard (team-dashboard.html)
Track health across multiple repos in one view. Add any public (or private, with a token) GitHub repo and see score, grade, files, issues, circular deps, security findings, architectural layers, commit activity (7d / 30d), CI status (✅/❌/⏳), and a commit velocity sparkline — all in a live table with bar charts. Token is shared with the main Grasp app so you only set it once. Export the full table as CSV. Open local folders with 📁 Open Folder (File System Access API).
🤖 AI Chat Panel
Built-in AI assistant that knows your codebase. Ask questions like "why is auth.ts a hotspot?" or "which files are safest to refactor?" — it answers with direct references to your dependency graph. Supports Anthropic Claude and OpenAI GPT models. API key stays in your browser only.
🎨 19 Themes
Full theme system with hover picker and click-to-cycle: Dark · Light · Matrix · Amber Terminal · Dracula · Nord · Tokyo Night · Catppuccin · Gruvbox · Obsidian Gold · Midnight Diamond · Carbon · Noir · Synthwave · Ocean Depth · Forest · Sunset · High Contrast · Solarized Light. Theme choice persists across sessions and is shared between Grasp and Team Dashboard.
🔎 Duplicate & Similarity Detection
The Dup color mode highlights files with exact or near-duplicate code — bright red = many duplicates, orange = some, yellow = minor. The grasp_similarity MCP tool returns ranked duplicate clusters and code-clone groups for targeted refactoring.
🏢 Monorepo & Workspace Support
Grasp automatically detects sub-packages in monorepos (package.json, pyproject.toml, Cargo.toml, go.mod, pom.xml). A Workspace sidebar lets you filter the entire visualization to a single package — all graphs, treemaps, and metrics update instantly.
🧰 Refactor Wizard
The Refactor hints panel (click any file in the graph) shows a prioritized, step-by-step refactor plan for that file — based on fan-in, complexity, duplicate count, layer violations, and churn. The grasp_refactor MCP tool generates the same plan as structured output for agents.
🔗 Shareable Embeds
Click ⋯ → 🔗 Embed for a modal with a ready-to-paste <iframe>, README badge (), React component snippet, and a direct link — for sharing live health reports in docs, wikis, or dashboards.
💻 Local File Analysis
Privacy First — your code never leaves your machine
Offline Support — works without internet
Drag & Drop — drag files or folders straight onto the page
Recursive scanning — analyze entire project structures
Quick Start
Option 1: Self-Host (30 seconds)
git clone https://github.com/ashfordeOU/grasp.git
cd grasp
open index.html # Main app
open team-dashboard.html # Team Dashboard (track multiple repos)No build process. No dependencies. No npm install. Two HTML files.
Option 2: Analyze Local Files
Open
index.htmlin your browserClick 📁 Open Folder
Select the folder to analyze
Everything processes entirely in your browser
Option 3: CLI (terminal)
npm install -g grasp-mcp-server # Install once
grasp ./my-project # Analyse a local folder
grasp facebook/react # Analyse a GitHub repo
grasp . # Analyse current directoryOutputs a colour-coded health report and writes grasp-report.json.
Exit code 0 = CI pass, 1 = issues found.
# One-off with npx
npx --package=grasp-mcp-server grasp .
# Watch mode — browser reloads live on every file save
grasp . --watch
# Time-travel — load last 30 commits as a scrubber
grasp . --timeline
# PR comment output — print markdown report to stdout
grasp . --pr-commentFor LLM Agents & AI Tools — MCP Server
Grasp ships a Model Context Protocol (MCP) server that exposes the full analysis engine as callable tools for Claude Code, Cursor, and any MCP-compatible agent.
cd mcp && npm install && npm run buildThen add to ~/.claude/claude_mcp_settings.json:
{
"mcpServers": {
"grasp": {
"command": "node",
"args": ["/path/to/grasp/mcp/dist/index.js"]
}
}
}Or run without installing:
npx grasp-mcp-server36 tools available to agents:
Tool | What it answers |
| Full analysis of any repo or local path — run first, returns |
| What does this file depend on? |
| What breaks if I change this file? |
| Are there circular dependencies? |
| What layers does this codebase have? |
| Which files are riskiest to touch? |
| Lines, complexity, fan-in/fan-out per file |
| How does file A connect to file B? |
| Any hardcoded secrets or injection risks? |
| What design patterns are in use? |
| Which functions are dead code — defined but never called? |
| List active analysis sessions |
| Compare two analysis snapshots — what changed? |
| Ranked refactoring suggestions from hotspot data |
| Plain-English explanation of any file or function |
| Re-analyse a directory and diff against a previous run |
| Run architecture rules and report violations |
| Step-by-step refactor plan for a file or entire session |
| Test coverage overlay — which files lack tests? |
| Map GitHub Issues to the files they mention |
| Per-file ownership, bus-factor, top contributors |
| Bundle size treemap — largest files by size category |
| Impact of upgrading a dependency across all files |
| Last N commits with per-commit changed files + co-change matrix |
| Generate PR health comment with blast radius for changed files |
| Generate iframe, README badge, React snippet for sharing |
| Compare two sessions — shared files, diverged functions |
| Ranked duplicate clusters, code clones, naming clashes |
| npm deps declared in package.json but never actually imported |
| Export analysis as SARIF 2.1.0 for GitHub Code Scanning |
| Merge a runtime trace with static edges — actual call paths and hot files |
| ORM/SQL-to-table coupling map — god tables, high-coupling files |
| Phased, topologically-ordered plan for replacing a package/module |
| Unified API surface map from OpenAPI, GraphQL SDL, Express/FastAPI routes |
| Commit counts for last 7d and 30d, plus commits since a given timestamp (staleness since last analysis) |
| Latest GitHub Actions run — passing/failing/in-progress, with recent run history |
Works with GitHub repos and local directories. See mcp/README.md for full setup.
Usage
Public Repositories
Just paste: facebook/react
Or full URL: https://github.com/facebook/reactPrivate Repositories
Create a GitHub Personal Access Token with
reposcopeSelect Token from the auth dropdown and paste it in
Analyze your private repos — token stays in memory only
Shareable Links
After analysis, click 🔗 to copy a link anyone can use to re-run the same analysis.
Visualization Modes
Graph Types
Type | Description |
🕸️ Graph | Force-directed dependency graph — drag, zoom, click to explore |
🔮 3D Graph | Three-dimensional force graph — rotate, pan, zoom through your architecture |
🏛️ Arch | Layer-by-layer architecture diagram with zoom/pan |
📦 Treemap | Files sized by line count, grouped by folder |
📊 Matrix | Adjacency matrix showing all file dependencies |
🌳 Tree | Hierarchical cluster dendrogram |
🌊 Flow | Folder-level dependency flow (Sankey diagram) |
🎯 Bundle | Circular layout with arc-based connections |
🔮 Cluster | Separated force graphs per folder |
Color Modes
Mode | Description |
📁 Folder | Color by directory structure |
🏗️ Layer | Color by architectural layer (UI, Services, Utils, etc.) |
🔥 Churn | Color by commit frequency — red = most-changed hot spots |
🌊 Depth | Color by max brace-nesting depth |
⚡ Complexity | Color by cyclomatic complexity (green → yellow → red) |
💥 Blast | Color by blast radius impact for a selected file |
🔎 Dup | Color by duplicate code density — red = many clones, yellow = minor |
👤 Owner | Color by top contributor — spot bus-factor risks at a glance |
🐛 Issues | Color by number of linked GitHub Issues mentioning each file |
🧪 Coverage | Color by test coverage — highlight files with no test counterpart |
📦 Bundle | Color by bundle size contribution |
🌐 API Surface | Color by API endpoint exposure — highlight public-facing files |
⚡ Runtime | Color by actual runtime call frequency from a live trace |
Advanced Features
⚡ Command Palette
Press Cmd+K (Mac) / Ctrl+K (Windows) — search files, navigate to any function, or jump to issues instantly. Selecting a result pans the graph to that node.
🔍 Path Finder
Select two files in the details panel to find the shortest dependency chain between them.
🏛️ Architecture Rule Engine
Define custom FORBIDDEN dependency rules (e.g., utils → services is FORBIDDEN). Violations are flagged as issues and persist across sessions.
📅 History & Snapshots
Every analysis is saved automatically. Click HISTORY in the right panel to compare health scores over time with a D3 sparkline and range slider.
📤 Export Reports
Export as JSON, Markdown, Plain Text, or SVG. Full schema in docs/api-schema.md.
🧩 VS Code Extension
Install the extension (vscode-extension/) for a live dependency graph in your sidebar. Features:
Auto-analyses workspace on startup, re-analyses on file save (2s debounce)
Status bar shows
↑ N deps ↓ M dependentsfor the active filePans to the active file on every editor switch
Surfaces security issues and arch violations in the Problems panel (squiggly lines)
4 color mode buttons in the panel header: Layer / Folder / Churn / Complexity
Health score badge displayed in the panel header
Double-click any node to open the file in the editor
Right-click any file in Explorer or Editor → Grasp: Analyze File for instant details
Directed links: blue = outgoing imports, green = incoming dependents
Rich tooltips showing complexity, churn count, and top contributor per file
Version & Auto-Update
Both index.html and team-dashboard.html display the current version (v2.2.0) in the footer. On load, they silently check the npm registry for a newer grasp-mcp-server release. If one is found, a dismissible toast appears:
Update Now — fetches the new HTML from GitHub, downloads it to your machine, and applies it in the current tab immediately
Later — snoozes for 24 hours
No server, no background process. The update check is a single npm registry fetch.
CI/CD Integration
GitHub Actions — Automatic PR Comments
Add this workflow to get an automatic health report on every PR:
# .github/workflows/grasp.yml
name: Grasp Health Check
on:
pull_request:
types: [opened, synchronize, reopened]
jobs:
health:
uses: ashfordeOU/grasp/.github/workflows/grasp-health.yml@mainThe workflow posts (and updates) a comment like this on every PR:
Metric | Value |
Health Score |
|
Grade | 🟢 A |
Files | 142 (891 functions) |
Architecture Issues | 3 |
Circular Deps | 0 ✓ |
Security | 0 |
Changed Files | 5 code files in this PR |
CLI-based CI Gate
- name: Check Grasp health
run: |
PASSED=$(cat grasp-report.json | jq '.ci.passed')
SCORE=$(cat grasp-report.json | jq '.ci.score')
echo "Health score: $SCORE"
if [ "$PASSED" != "true" ]; then
echo "Grasp CI check failed"
cat grasp-report.json | jq '.ci.failures'
exit 1
fiSee docs/api-schema.md for the full export schema.
Keyboard Shortcuts
Key | Action |
| Analyze repository |
| Open command palette |
| Zoom in/out |
| Multi-select nodes |
| Close modal / command palette |
| Cycle through themes |
| Open help modal |
Supported Languages
JavaScript · TypeScript · Python · Go · Java · Rust · C/C++ · C# · Ruby · PHP · Swift · Kotlin · Scala · Vue · Svelte · Dart · Elixir · Erlang · Haskell · Lua · R · Julia · Perl · Shell · PowerShell · F# · OCaml · Clojure · Elm · VBA · Groovy
Privacy & Security
Your code stays on your machine.
Browser app:
Runs 100% in the browser — no server, no proxy
GitHub API calls go directly from your browser to GitHub
Your token (if used) lives in
localStorageonly — never sent anywhere except the GitHub APINo analytics, no tracking, no accounts
The entire app is one open-source HTML file — audit it yourself
MCP server:
Runs locally as a subprocess — no outbound connections except the GitHub API
No telemetry, no data collection
Local directory analysis never leaves your machine — files are read and discarded in memory
Architecture
┌──────────────────────────────────────────────────────────────────────┐
│ Grasp v2.2.0 │
├─────────────────────┬──────────────────┬────────────┬───────────────┤
│ Browser App │ Team Dashboard │ MCP Server │ VS Code Ext │
│ (index.html) │(team-dashboard │ (mcp/) │(vscode-ext/) │
│ │ .html) │ │ │
│ ┌─────────────┐ │ ┌───────────┐ │ ┌────────┐ │ ┌───────────┐ │
│ │Parser Engine│◄───┼──│parser.js │ │ │parser │ │ │Webview │ │
│ │(embedded JS)│ │ └─────┬─────┘ │ └───┬────┘ │ │(D3 graph) │ │
│ └──────┬──────┘ │ │ │ │ │ └─────┬─────┘ │
│ │ │ ┌─────▼──────┐ │ ┌───▼────┐ │ │ │
│ ┌──────▼──────┐ │ │Multi-repo │ │ │analyze │ │ ┌─────▼─────┐ │
│ │React+D3 │ │ │health table│ │ └───┬────┘ │ │FileWatcher│ │
│ │19 themes │ │ │score charts│ │ │ │ │Status Bar │ │
│ │AI Chat │ │ │CSV export │ │ ┌───▼────┐ │ │Diagnostics│ │
│ │3D Graph │ │ └────────────┘ │ │36 Tools│ │ └───────────┘ │
│ │Timeline │ │ │ │(stdio) │ │ │
│ │Workspaces │ │ Shared token & │ └────────┘ │ │
│ └─────────────┘ │ theme via │ │ │
│ │ localStorage │ + CLI │ + context menu│
│ Zero install — │ │ │ │
│ one HTML file │ one HTML file │ │ │
└─────────────────────┴──────────────────┴────────────┴───────────────┘Browser app: zero dependencies to install. Everything runs from CDNs: React 18, D3.js 7, Babel.
MCP server: Node.js 18+, npm install inside mcp/.
VS Code extension: vsce package inside vscode-extension/.
GitHub API Limits
Auth | Requests/hour |
No token | 60 |
Personal Access Token | 5,000 |
GitHub App | 5,000 per installation |
Contributing
See CONTRIBUTING.md for setup, code structure, and PR checklist.
Ideas welcome:
More languages (Zig, V, Nim, Crystal)
Full tree-sitter / AST support for JS/TS function extraction (MCP + CLI now use acorn in Node.js)
More design pattern detection (Strategy, Command, State)
Export to PNG
3D force graph visualization mode
19-theme system with hover picker — Matrix, Synthwave, Dracula, Nord, Tokyo Night, Catppuccin, Gruvbox, Obsidian Gold, Midnight Diamond, Carbon, Noir, Amber Terminal, Ocean Depth, Forest, Sunset, High Contrast, Solarized Light
Team Dashboard (
team-dashboard.html) — multi-repo health tracking, commit activity (7d/30d), CI status badges, commit velocity sparkline, CSV export, shared token/theme, Open FolderAI Chat panel — ask questions about the dependency graph, Claude + OpenAI support
Auto-update system — version check via npm registry, in-tab update + file download
MCP: 36 tools total — added
grasp_dead_packages,grasp_sarif,grasp_runtime_calls,grasp_db_coupling,grasp_migration_plan,grasp_api_surface,grasp_commits,grasp_ci_statusMCP:
grasp_difftool — compare two snapshots over timeMCP:
grasp_suggesttool — refactoring suggestions from hotspot dataMCP:
grasp_explaintool — plain-English file/function explanationMCP:
grasp_watchtool — re-analyse directory and diff against prior runMCP:
grasp_unusedtool — dead code detection for agentsMCP:
grasp_rules_checktool — architecture rule violationsMCP:
grasp_issuestool — GitHub Issues → file mention mappingMCP:
grasp_contributorstool — per-file ownership and bus-factorMCP:
grasp_bundletool — bundle size treemapMCP:
grasp_dep_impacttool — dependency upgrade impact analysisMCP:
grasp_coveragetool — test file coverage overlayMCP:
grasp_timelinetool — git history with co-change matrixMCP:
grasp_pr_commenttool — PR health comment with blast radiusMCP:
grasp_embedtool — shareable iframe, badge, React snippetMCP:
grasp_refactortool — step-by-step refactor planMCP:
grasp_cross_repotool — compare two sessions / monorepo supportMCP:
grasp_similaritytool — duplicate clusters and code clonesMCP:
grasp_dead_packages— npm deps declared but never importedMCP:
grasp_sarif— SARIF 2.1.0 export for GitHub Code ScanningMCP:
grasp_runtime_calls— merge live trace with static graphMCP:
grasp_db_coupling— ORM/SQL table coupling mapMCP:
grasp_migration_plan— phased package migration planMCP:
grasp_api_surface— unified API surface from OpenAPI, GraphQL, Express/FastAPI routesCLI:
grasp ./my-projectopens browser pre-loaded (local server +--reportfor terminal)CLI:
grasp . --watch— live SSE browser sync, LIVE badge in UICLI:
grasp . --timeline— inject last 30 commits as time-travel scrubberCLI:
grasp . --pr-comment— print PR comment markdown to stdoutGitHub Action: post health score as PR comment, updates on re-push
Graph: Color modes for Duplicate density, Code Ownership, GitHub Issues, Coverage, Bundle, API Surface, Runtime
Graph: Workspace sidebar for monorepo sub-package filtering
Graph: Refactor hints panel per selected file
Graph: Shareable embed modal (iframe, badge, direct link)
Graph: Timeline scrubber — yellow glow on changed nodes per commit
Graph: persist pinned node positions across sessions
Graph: Cmd+K search pans to the matching node
Graph: minimap overlay for large codebases
Function-level call graph drill-down per file
VS Code: auto-reanalyse on file save (2s debounce)
VS Code: 4 color mode buttons in panel header
VS Code: health score badge in panel header
VS Code: double-click node to open file in editor
VS Code: right-click → Grasp: Analyze File context menu
VS Code: directed link colors (blue = outgoing, green = incoming)
VS Code: rich node tooltips (complexity, churn, contributor)
VS Code: status bar item showing deps/dependents for active file
VS Code: Problems panel integration — security + arch violations as diagnostics
Custom ignore patterns UI — add/remove directory exclusions, persists in localStorage
Local git history — churn heatmap works for local repos via
git logAutomated npm publish on git tags via GitHub Actions
License
MIT License — Copyright (c) 2026 Ashforde OÜ. Free to use, modify, and distribute. Keep the copyright notice intact in all copies.
Built for developers who want to truly understand their codebase
See the code. Know the code.
This server cannot be installed
Maintenance
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/ashfordeOU/grasp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server