Repo Therapist
Analyzes Git repository history, commit patterns, and file churn to provide insights into code evolution, ownership, and fragile files.
Click on "Deploy 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., "@Repo Therapist Which files in this repo are the most fragile and prone to bugs?"
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.
Repo Therapist ποΈ
Your codebase explains itself under pressure
This MCP server is built entirely using Cursor
Repo Therapist is an MCP (Model Context Protocol) server that turns any repository into queryable, explainable knowledge. Ask questions about your codebase through Cursor and get structured, insightful answers.
What it does
You ask Cursor things like:
"Why is this service structured like this?"
"What will break if I remove this?"
"Which parts of this repo scare you?"
Behind the scenes, Repo Therapist:
Reads your repo structure and files
Analyzes git history and commit patterns
Correlates code with change frequency
Identifies complexity hotspots and risks
Related MCP server: Code Understanding MCP Server
Available Tools
Tool | Description |
| Analyze a repository - run this first |
| Get the static snapshot (ground truth) of the repo |
| Get git history analysis (the time dimension) |
| Explain why a specific file is the way it is |
| Ask any question about the analyzed repo |
| Get a high-level overview |
| Generate a risk assessment report |
Ground Truth: The Snapshot
When you run analyze_repo, Repo Therapist creates a static snapshot - the authoritative source of truth about your repository. This snapshot includes:
{
"files": [...], // Every file with path, language, line count
"languages": {...}, // Language breakdown with percentages
"entryPoints": [...], // Detected entry points with confidence levels
"configs": {...}, // Parsed package.json, tsconfig, Dockerfile, CI configs
"directories": [...] // Directory structure with inferred purposes
}Why this matters: LLMs must cite this snapshot data, not guess. When you ask "What languages does this repo use?", the answer comes from the snapshot - not from the LLM making assumptions.
Use get_snapshot to retrieve specific sections:
get_snapshot(section: "files")- All files with metadataget_snapshot(section: "languages")- Language statisticsget_snapshot(section: "entryPoints")- Detected entry pointsget_snapshot(section: "configs")- Parsed configuration filesget_snapshot(section: "directories")- Directory structureget_snapshot()- Summary of everything
Git Historian: The Time Dimension
The Git Historian analyzes commit history to explain WHY code is the way it is. This is where it stops being cute.
{
"fileChurn": { "auth.ts": { "totalCommits": 47, "churnScore": 85 } },
"authors": { "auth.ts": ["alice", "bob", "charlie"] },
"fragileFiles": [{ "path": "auth.ts", "reasons": ["high-churn", "many-authors"] }],
"hotPaths": [...],
"stableCore": [...]
}This lets you answer:
"Why is this weird?" β "Because it's been rewritten 12 times in 6 months."
"Who owns this file?" β "Disputed - 4 people have modified it, none with >30%."
"What should I be careful with?" β "These 5 files are fragile and bug-prone."
Use get_history to retrieve specific aspects:
get_history(section: "churn")- File change frequency and volatilityget_history(section: "authors")- Contributor statisticsget_history(section: "fragile")- Files likely to cause problemsget_history(section: "hotPaths")- Hot paths vs stable coreget_history(section: "timeline")- Key events and commit patternsget_history(section: "ownership")- Who owns whatget_history()- Summary of everything
Use why_is_this_weird for specific file analysis:
Use why_is_this_weird on "src/auth/login.ts"Returns a detailed explanation with citations:
# Why is "src/auth/login.ts" the way it is?
## Change History
- Total commits: 47
- Authors: 5 (alice, bob, charlie, dave, eve)
- Churn score: 85 β οΈ HIGH
## π Why It's Unusual
**Heavily modified:** This file has been changed 47 times...
**Many hands:** 5 different people have modified this file...Setup
1. Install dependencies
cd repo-therapist
npm install2. Build the project
npm run build3. Add to Cursor
Open Cursor Settings β MCP β Add new MCP server:
{
"mcpServers": {
"repo-therapist": {
"command": "node",
"args": ["/FULL/PATH/TO/repo-therapist/dist/index.js"]
}
}
}Important: Replace /FULL/PATH/TO/ with the actual absolute path to your repo-therapist folder.
Example:
{
"mcpServers": {
"repo-therapist": {
"command": "node",
"args": ["/Users/saar/Projects/private/repo-therapist/dist/index.js"]
}
}
}4. Restart Cursor
After adding the MCP config, restart Cursor for changes to take effect.
FAQ
Do I need to run repo-therapist separately?
No. Cursor automatically starts and manages the MCP server for you. When you add the config to Cursor's MCP settings, Cursor will:
Start the
node dist/index.jsprocess when neededKeep it running in the background
Communicate with it via stdio (standard input/output)
You just need to build once (npm run build), add the config, and restart Cursor. That's it.
Where do I ask questions?
In the normal Cursor chat (Cmd+L or the chat panel). The difference is how you ask:
Without MCP: "What does this repo do?" β Cursor uses its built-in tools
With Repo Therapist: "Use
analyze_repoon/path/to/repo" β Cursor calls the MCP tool
You explicitly tell Cursor to use the repo-therapist tools. Cursor sees them as additional capabilities it can use.
What's the difference vs normal Cursor chat?
Normal Cursor Chat | With Repo Therapist |
Reads files on demand | Pre-analyzes entire repo structure |
No git history awareness | Analyzes commit patterns & churn |
Answers based on what it reads | Answers based on structured analysis |
No risk detection | Identifies complexity hotspots |
Generic code understanding | Domain-specific insights ("what scares you?") |
The key difference: Repo Therapist does structured analysis upfront and stores it, so questions like "which files change most often?" or "what are the risks?" can be answered from pre-computed data rather than Cursor having to figure it out each time.
Think of it as: Cursor is smart but reactive. Repo Therapist gives it a "briefing document" about your codebase that it can reference.
Usage
Once configured, you can use Repo Therapist in Cursor chat:
Step 1: Analyze a repo
First, analyze the repository you want to explore:
Use analyze_repo to analyze /path/to/some/repoStep 2: Ask questions
Now you can ask questions:
Use ask_repo to answer: "What does this repo do?"Use ask_repo to answer: "Which parts of this repo scare you?"Use ask_repo to answer: "What will break if I remove the auth module?"Step 3: Get reports
Get a summary:
Use repo_summary to show me an overviewGet a risk assessment:
Use risk_report to identify potential issuesExample Questions
"What does this repo do?"
"How is the code structured?"
"What tech stack is being used?"
"Show me the dependencies"
"Which files are the largest?"
"What files change most often?"
"Who are the contributors?"
"What are the recent commits?"
"Which parts scare you?"
"What will break if I change X?"
Development
Run in development mode
npm run devBuild for production
npm run buildRun tests
npm test # Run all tests
npm run test:watch # Run tests in watch mode
npm run test:coverage # Run tests with coverage reportTesting Guidelines
Note: Always add unit tests when implementing new features.
Tests are located in tests/ and use Vitest. The test structure mirrors the source:
tests/
βββ fixtures/ # Test utilities and mock repos
β βββ setup.ts # Helper functions for creating test repos
βββ scanner/ # Scanner module tests
βββ historian/ # Historian module tests
βββ tools/ # Tool tests
βββ cache.test.ts # Cache testsWhen adding a new feature:
Create tests in the appropriate
tests/subdirectoryUse
createTestRepo()fromfixtures/setup.tsfor git-related testsClean up test repos with
cleanupTestRepo()inafterAllRun
npm testto verify all tests pass before committing
Project structure
repo-therapist/
βββ src/
β βββ index.ts # MCP server entry point
β βββ cache.ts # In-memory repo cache
β βββ types.ts # TypeScript interfaces
β βββ scanner/ # Static snapshot engine (Step 2)
β β βββ index.ts # Scanner exports
β β βββ types.ts # Snapshot type definitions
β β βββ scan-repo.ts # Repository scanner
β βββ historian/ # Git history analyzer (Step 3)
β β βββ index.ts # Historian exports
β β βββ types.ts # History type definitions
β β βββ analyze-history.ts # Git history analysis
β βββ tools/
β βββ analyze-repo.ts # Repository analyzer (orchestrates all)
β βββ get-snapshot.ts # Snapshot retrieval (ground truth)
β βββ get-history.ts # History retrieval (time dimension)
β βββ ask-repo.ts # Question answering
β βββ repo-summary.ts # Summary generator
β βββ risk-report.ts # Risk assessment
βββ tests/ # Unit tests
β βββ fixtures/ # Test utilities
β βββ scanner/ # Scanner tests
β βββ historian/ # Historian tests
β βββ tools/ # Tool tests
βββ package.json
βββ tsconfig.json
βββ vitest.config.ts # Test configuration
βββ README.mdTech Stack
TypeScript - Type-safe codebase
@modelcontextprotocol/sdk - MCP server implementation
simple-git - Git history analysis
ts-morph - TypeScript/JavaScript AST parsing (planned)
glob - File pattern matching
Roadmap
AST-based code analysis with ts-morph
Persist analysis to JSON/SQLite
Dependency graph visualization
Security vulnerability detection
Test coverage analysis
Custom question handlers
License
MIT
Available Tools
7 toolsanalyze_repoA
Analyze a repository to understand its structure, dependencies, and git history. Run this first before asking questions.
Inputs: path (required).
ask_repoC
Ask a question about an analyzed repository. Questions can be about structure, purpose, dependencies, patterns, or concerns.
Inputs: question (required), path.
get_historyB
Get git history analysis - the time dimension. Reveals WHY code is the way it is: file churn, ownership, fragile files, hot paths vs stable core.
Inputs: path, section.
get_snapshotA
Get the static snapshot (ground truth) of the repository. This is the authoritative source - LLMs must cite this data, not guess. Use section parameter to get specific data.
Inputs: path, section.
repo_summaryB
Get a high-level summary of the analyzed repository including tech stack, structure, and key components.
Inputs: path.
risk_reportC
Generate a risk assessment report identifying code smells, complexity hotspots, and areas that might cause problems.
Inputs: path.
why_is_this_weirdA
Explain why a specific file is the way it is, based on git history. Answers questions like 'Why is this file so complex?' with data: 'Because it's been rewritten 12 times by 5 different people.'
Inputs: file_path (required), path.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelogβ¦
TDQS
Scored across 7 tools
Each tool has a clearly distinct purpose: analyze_repo is for initial analysis, ask_repo for questions, get_history for git history, get_snapshot for authoritative data, repo_summary for high-level summary, risk_report for risk assessment, and why_is_this_weird for explaining file history. No overlap.
Most tools follow a verb_noun pattern (analyze_repo, ask_repo, get_history, get_snapshot), but repo_summary and risk_report are noun_noun, and why_is_this_weird is a full sentence, creating inconsistency.
Seven tools is well-scoped for a repository analysis server, providing essential functionality without being overwhelming or insufficient.
The tool set covers key aspects: analysis, Q&A, history, snapshot, summary, and risk assessment. Minor gaps like direct file search or comparison are missing but can be partially addressed by ask_repo.
Related MCP Connectors
Repository knowledge graph MCP server for codebase understanding and debugging.
One MCP server for all your MCP servers: code mode, per-tool permissions, approvals and audit.
A MCP server built for developers enabling Git based project management with project and personalβ¦
The Cortex MCP server provides read-only access to real-time engineering context from the Cortex developer portal, allowing AI coding assistants to answer natural language questions about your organization's catalog (microservices, libraries, domains, teams, infrastructure), scorecards (engineering standards and best practices), initiatives (goals and deadlines), and Engineering Intelligence metrics. It includes tools for querying documentation, tracking personal entities, and accessing AI-assisted insights across the entire Cortex ecosystem.
Related MCP Servers
- FlicenseNot gradedqualityDmaintenanceAn MCP server that transforms codebases into intelligent, queryable knowledge bases, enabling AI assistants to perform semantic search, explore architecture, and analyze code relationships.166-
- AlicenseCqualityDmaintenanceAn MCP server that analyzes local or remote GitHub repositories, providing intelligent code context and structure to AI coding assistants.1013MIT
- AlicenseAqualityDmaintenanceAn MCP server that extracts complete knowledge from any codebase β architecture, patterns, dependencies, API surface. Combines static analysis with AI-powered deep interpretation.8MIT
- AlicenseNot gradedqualityDmaintenanceA production-grade MCP server for local git repositories that provides tools for code search, git history analysis, complexity metrics, test discovery, and dependency management.MIT