mcp-server-dig
English | 日本語
MCP server for AI-powered code archaeology — explore git blame, file history, contributor patterns, and co-change analysis through the Model Context Protocol.
Tools
Composite Analysis
| Tool | Description |
|---|---|
git_file_risk_profile | Multi-dimensional risk assessment for a single file |
git_repo_health | Repository-wide health summary |
Data Retrieval
git_file_history
Get the commit history for a specific file with diff stats.
| Parameter | Type | Required | Description |
|---|---|---|---|
| repo_path | string | yes | Absolute path to the git repository |
| file_path | string | yes | Relative path to the file within the repo |
| max_commits | number | no | Maximum commits to return (default: 20) |
| since | string | no | Date filter, e.g. "2024-01-01" or "6 months ago" |
git_blame_context
Semantic blame that groups consecutive lines by the same commit into blocks.
| Parameter | Type | Required | Description |
|---|---|---|---|
| repo_path | string | yes | Absolute path to the git repository |
| file_path | string | yes | Relative path to the file within the repo |
| start_line | number | no | Start of line range |
| end_line | number | no | End of line range |
git_related_changes
Find files that frequently change together with a given file (co-change analysis).
| Parameter | Type | Required | Description |
|---|---|---|---|
| repo_path | string | yes | Absolute path to the git repository |
| file_path | string | yes | Relative path to the file within the repo |
| max_commits | number | no | How many commits to analyze (default: 100) |
| min_coupling | number | no | Minimum co-change count to include (default: 2) |
git_contributor_patterns
Analyze contributor patterns — who has expertise in what areas.
| Parameter | Type | Required | Description |
|---|---|---|---|
| repo_path | string | yes | Absolute path to the git repository |
| path_pattern | string | no | Directory or path to scope analysis, e.g. "src/api/" |
| since | string | no | Date filter, e.g. "2024-01-01" or "1 year ago" |
| max_commits | number | no | Maximum commits to analyze (default: 500) |
git_search_commits
Search commit messages by keyword. Useful for finding when a feature was introduced, a bug was fixed, or locating commits related to a ticket number.
| Parameter | Type | Required | Description |
|---|---|---|---|
| repo_path | string | yes | Absolute path to the git repository |
| query | string | yes | Search string to match against commit messages |
| max_commits | number | no | Maximum number of commits to return (default: 20) |
| since | string | no | Date filter, e.g. "2024-01-01" or "6 months ago" |
| author | string | no | Filter by author name or email |
| path_pattern | string | no | Limit search to commits touching this path |
git_commit_show
Show detailed information about a specific commit: full message, changed files, and optionally the diff. Useful for drilling into a commit found via git_search_commits.
| Parameter | Type | Required | Description |
|---|---|---|---|
| repo_path | string | yes | Absolute path to the git repository |
| commit | string | yes | Commit hash (short or full), branch name, or tag |
| show_diff | boolean | no | Include the full diff output (default: false, shows stat only) |
git_diff_context
Show the diff between two commits, branches, or tags. Useful for understanding what changed between releases, branches, or any two points in history.
| Parameter | Type | Required | Description |
|---|---|---|---|
| repo_path | string | yes | Absolute path to the git repository |
| commit | string | yes | Target commit, branch, or tag |
| compare_to | string | no | Base to compare against (default: parent commit) |
| file_path | string | no | Limit diff to a specific file |
| stat_only | boolean | no | Show only file change statistics (default: false) |
| context_lines | number | no | Number of context lines in unified diff (default: 3) |
git_hotspots
Identify the most frequently changed files in the repository. Files with high change frequency often indicate areas of technical debt, active development, or bug-prone code.
| Parameter | Type | Required | Description |
|---|---|---|---|
| repo_path | string | yes | Absolute path to the git repository |
| path_pattern | string | no | Limit analysis to a specific directory, e.g. "src/" |
| since | string | no | Date filter, e.g. "2024-01-01" or "6 months ago" |
| max_commits | number | no | Number of commits to analyze (default: 500) |
| top_n | number | no | Number of top files to return (default: 20) |
git_pickaxe
Search for commits that introduced or removed a specific string or regex pattern in the codebase (git's pickaxe feature). Essential for finding when a function, variable, or pattern first appeared or was removed.
| Parameter | Type | Required | Description |
|---|---|---|---|
| repo_path | string | yes | Absolute path to the git repository |
| search_term | string | yes | String or regex pattern to search for in code changes |
| is_regex | boolean | no | Treat search_term as regex -G instead of literal -S (default: false) |
| max_commits | number | no | Maximum number of commits to return (default: 20) |
| since | string | no | Date filter, e.g. "2024-01-01" or "6 months ago" |
| author | string | no | Filter by author name or email |
| path_pattern | string | no | Limit search to commits touching this path |
git_code_churn
Analyze code churn (lines added + deleted) per file. High churn files may indicate unstable code, frequent refactoring, or areas needing architectural attention. Complements git_hotspots by measuring change volume, not just frequency.
| Parameter | Type | Required | Description |
|---|---|---|---|
| repo_path | string | yes | Absolute path to the git repository |
| path_pattern | string | no | Limit analysis to a specific directory, e.g. "src/" |
| since | string | no | Date filter, e.g. "2024-01-01" or "6 months ago" |
| max_commits | number | no | Number of commits to analyze (default: 500) |
| top_n | number | no | Number of top files to return (default: 20) |
git_stale_files
Find files that have not been modified for a long time. Stale files may indicate dead code, forgotten configuration, or areas of technical debt that need review or removal.
| Parameter | Type | Required | Description |
|---|---|---|---|
| repo_path | string | yes | Absolute path to the git repository |
| threshold_days | number | no | Minimum days since last change to consider stale (default: 180) |
| path_pattern | string | no | Limit analysis to a specific directory, e.g. "src/" |
| top_n | number | no | Maximum number of stale files to return (default: 30) |
git_merge_base
Find the common ancestor (merge base) of two branches or refs and show commits on each side since divergence. Useful for understanding branch relationships and reviewing what will be merged.
| Parameter | Type | Required | Description |
|---|---|---|---|
| repo_path | string | yes | Absolute path to the git repository |
| ref1 | string | yes | First branch or ref (e.g. "main") |
| ref2 | string | yes | Second branch or ref (e.g. "feature-branch") |
| max_commits | number | no | Maximum commits to show per side (default: 50) |
git_tag_list
List tags sorted by creation date with associated messages. Useful for understanding release history and versioning patterns.
| Parameter | Type | Required | Description |
|---|---|---|---|
| repo_path | string | yes | Absolute path to the git repository |
| pattern | string | no | Glob pattern to filter tags, e.g. "v1.*" |
| max_tags | number | no | Maximum number of tags to return (default: 50) |
| sort | string | no | Sort order: "newest" or "oldest" (default: "newest") |
git_file_risk_profile
Comprehensive risk assessment for a single file combining change frequency, code churn, knowledge concentration, implicit coupling, and staleness into a multi-dimensional profile.
| Parameter | Type | Required | Description |
|---|---|---|---|
| repo_path | string | yes | Absolute path to the git repository |
| file_path | string | yes | Relative path to the file within the repo |
| since | string | no | Date filter, e.g. "2024-01-01" or "6 months ago" |
| max_commits | number | no | Number of commits to analyze (default: 500) |
Example output:
Risk profile for: src/core/engine.ts
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Change frequency: HIGH (47 changes, top 3%)
Code churn: HIGH (1,230 lines churned)
Knowledge risk: MEDIUM (2 contributors, top owns 78%)
Coupling: HIGH (12 co-changed files)
Staleness: LOW (last changed 3 days ago)
Overall: HIGH RISK
Concerns: frequently changing, high code churn, highly coupled
git_repo_health
Repository-wide health summary combining file count, commit activity, top hotspots, highest churn files, contributor distribution, and stale file count into a single overview.
| Parameter | Type | Required | Description |
|---|---|---|---|
| repo_path | string | yes | Absolute path to the git repository |
| since | string | no | Date filter for activity analysis |
| max_commits | number | no | Number of commits to analyze (default: 500) |
| stale_threshold_days | number | no | Days without change to consider stale (default: 180) |
Setup
Prerequisites
- Node.js >= 18
- Git
Install
npm install -g mcp-server-dig
Or build from source:
git clone https://github.com/nakishiyaman/mcp-server-dig.git
cd mcp-server-dig
npm install
npm run build
Configure
Add to your MCP client configuration (e.g. Claude Desktop claude_desktop_config.json):
{
"mcpServers": {
"dig": {
"command": "mcp-server-dig"
}
}
}
Or if running from source:
{
"mcpServers": {
"dig": {
"command": "node",
"args": ["./build/index.js"]
}
}
}
Zed
Add to your Zed settings.json:
{
"context_servers": {
"dig": {
"command": {
"path": "mcp-server-dig",
"args": []
}
}
}
}
Cursor
Add to .cursor/mcp.json in your project root:
{
"mcpServers": {
"dig": {
"command": "mcp-server-dig"
}
}
}
Windsurf
Add to your Windsurf MCP configuration:
{
"mcpServers": {
"dig": {
"command": "mcp-server-dig"
}
}
}
Development
npm install
npm run build # Compile TypeScript
npm run typecheck # Type check without emitting
npm run lint # ESLint
npm test # Run tests (vitest)
npm run test:watch # Watch mode
License
MIT