|
| 1 | +# Git Metrics MCP Server |
| 2 | + |
| 3 | +MCP server for analyzing git repository metrics and tracking team performance KPIs. Built for Kiro CLI (Amazon Q CLI) and other MCP clients. |
| 4 | + |
| 5 | +## Overview |
| 6 | + |
| 7 | +This server provides tools to extract meaningful metrics from git repositories, helping teams track productivity, code quality, and collaboration patterns. |
| 8 | + |
| 9 | +## Features |
| 10 | + |
| 11 | +- **Commit Statistics**: Track commits, additions, deletions, and files changed |
| 12 | +- **Author Metrics**: Per-developer performance breakdown |
| 13 | +- **File Churn Analysis**: Identify frequently modified files (quality indicators) |
| 14 | +- **Team Summaries**: Comprehensive team performance reports |
| 15 | + |
| 16 | +## Installation |
| 17 | + |
| 18 | +### From npm (Recommended) |
| 19 | + |
| 20 | +```bash |
| 21 | +npm install -g @jonmatum/git-metrics-mcp-server |
| 22 | +``` |
| 23 | + |
| 24 | +### From Source |
| 25 | + |
| 26 | +```bash |
| 27 | +git clone https://github.com/jonmatum/git-metrics-mcp-server.git |
| 28 | +cd git-metrics-mcp-server |
| 29 | +npm install |
| 30 | +npm run build |
| 31 | +``` |
| 32 | + |
| 33 | +## Kiro CLI Configuration |
| 34 | + |
| 35 | +Add to `~/.kiro/settings/mcp.json`: |
| 36 | + |
| 37 | +**If installed globally:** |
| 38 | +```json |
| 39 | +{ |
| 40 | + "mcpServers": { |
| 41 | + "git-metrics": { |
| 42 | + "command": "git-metrics-mcp-server", |
| 43 | + "args": [] |
| 44 | + } |
| 45 | + } |
| 46 | +} |
| 47 | +``` |
| 48 | + |
| 49 | +**If using npx:** |
| 50 | +```json |
| 51 | +{ |
| 52 | + "mcpServers": { |
| 53 | + "git-metrics": { |
| 54 | + "command": "npx", |
| 55 | + "args": ["@jonmatum/git-metrics-mcp-server"] |
| 56 | + } |
| 57 | + } |
| 58 | +} |
| 59 | +``` |
| 60 | + |
| 61 | +**If running from source:** |
| 62 | +```json |
| 63 | +{ |
| 64 | + "mcpServers": { |
| 65 | + "git-metrics": { |
| 66 | + "command": "npx", |
| 67 | + "args": ["tsx", "/path/to/git-metrics-mcp-server/src/git-metrics.ts"] |
| 68 | + } |
| 69 | + } |
| 70 | +} |
| 71 | +``` |
| 72 | + |
| 73 | +## Available Tools |
| 74 | + |
| 75 | +### get_commit_stats |
| 76 | + |
| 77 | +Get overall commit statistics for a time period. |
| 78 | + |
| 79 | +**Parameters:** |
| 80 | +- `repo_path` (required): Path to git repository |
| 81 | +- `since` (required): Start date (YYYY-MM-DD) |
| 82 | +- `until` (optional): End date (YYYY-MM-DD) |
| 83 | +- `author` (optional): Filter by author |
| 84 | + |
| 85 | +**Example:** |
| 86 | +``` |
| 87 | +Get commit stats for /home/user/myproject since 2025-11-01 |
| 88 | +``` |
| 89 | + |
| 90 | +**Returns:** |
| 91 | +```json |
| 92 | +{ |
| 93 | + "commits": 45, |
| 94 | + "additions": 1250, |
| 95 | + "deletions": 380, |
| 96 | + "filesChanged": 67, |
| 97 | + "netChange": 870 |
| 98 | +} |
| 99 | +``` |
| 100 | + |
| 101 | +### get_author_metrics |
| 102 | + |
| 103 | +Detailed metrics per contributor. |
| 104 | + |
| 105 | +**Parameters:** |
| 106 | +- `repo_path` (required): Path to git repository |
| 107 | +- `since` (required): Start date (YYYY-MM-DD) |
| 108 | +- `until` (optional): End date (YYYY-MM-DD) |
| 109 | + |
| 110 | +**Returns:** |
| 111 | +```json |
| 112 | +{ |
| 113 | + "John Doe <john@example.com>": { |
| 114 | + "commits": 23, |
| 115 | + "additions": 650, |
| 116 | + "deletions": 120, |
| 117 | + "files": 34 |
| 118 | + } |
| 119 | +} |
| 120 | +``` |
| 121 | + |
| 122 | +### get_file_churn |
| 123 | + |
| 124 | +Files with most changes (indicates complexity or issues). |
| 125 | + |
| 126 | +**Parameters:** |
| 127 | +- `repo_path` (required): Path to git repository |
| 128 | +- `since` (required): Start date (YYYY-MM-DD) |
| 129 | +- `limit` (optional): Number of files, default 10 |
| 130 | + |
| 131 | +**Returns:** |
| 132 | +```json |
| 133 | +[ |
| 134 | + { "file": "src/main.ts", "changes": 15 }, |
| 135 | + { "file": "src/utils.ts", "changes": 12 } |
| 136 | +] |
| 137 | +``` |
| 138 | + |
| 139 | +### get_team_summary |
| 140 | + |
| 141 | +Comprehensive team performance report. |
| 142 | + |
| 143 | +**Parameters:** |
| 144 | +- `repo_path` (required): Path to git repository |
| 145 | +- `since` (required): Start date (YYYY-MM-DD) |
| 146 | +- `until` (optional): End date (YYYY-MM-DD) |
| 147 | + |
| 148 | +**Returns:** |
| 149 | +```json |
| 150 | +{ |
| 151 | + "period": { "since": "2025-11-01", "until": "now" }, |
| 152 | + "team": { |
| 153 | + "totalCommits": 45, |
| 154 | + "totalAdditions": 1250, |
| 155 | + "totalDeletions": 380, |
| 156 | + "contributors": 3 |
| 157 | + }, |
| 158 | + "contributors": { ... } |
| 159 | +} |
| 160 | +``` |
| 161 | + |
| 162 | +## Example Queries |
| 163 | + |
| 164 | +**Sprint Review:** |
| 165 | +``` |
| 166 | +Generate a team summary for /home/user/project since 2025-11-01 |
| 167 | +``` |
| 168 | + |
| 169 | +**Individual Performance:** |
| 170 | +``` |
| 171 | +Get commit stats for /home/user/project since 2025-11-01 for author john@example.com |
| 172 | +``` |
| 173 | + |
| 174 | +**Code Quality Check:** |
| 175 | +``` |
| 176 | +Show me file churn for /home/user/project since 2025-10-01 limit 20 |
| 177 | +``` |
| 178 | + |
| 179 | +**Weekly Standup:** |
| 180 | +``` |
| 181 | +Get author metrics for /home/user/project since 2025-11-15 |
| 182 | +``` |
| 183 | + |
| 184 | +## Use Cases |
| 185 | + |
| 186 | +- **Sprint Retrospectives**: Review team velocity and contribution patterns |
| 187 | +- **Performance Reviews**: Data-driven developer assessments |
| 188 | +- **Code Quality**: Identify problematic files with high churn |
| 189 | +- **Team Balance**: Ensure even workload distribution |
| 190 | +- **Onboarding**: Track new developer ramp-up |
| 191 | + |
| 192 | +## KPIs You Can Track |
| 193 | + |
| 194 | +- Commits per developer per week/sprint |
| 195 | +- Code volume (lines added/deleted) |
| 196 | +- File change frequency |
| 197 | +- Code churn (quality indicator) |
| 198 | +- Contribution balance across team |
| 199 | +- Commit patterns and consistency |
| 200 | + |
| 201 | +## Development |
| 202 | + |
| 203 | +```bash |
| 204 | +npm run dev # Run in development mode |
| 205 | +npm run build # Build for production |
| 206 | +npm start # Run built version |
| 207 | +``` |
| 208 | + |
| 209 | +## License |
| 210 | + |
| 211 | +MIT - See [LICENSE](LICENSE) file |
| 212 | + |
| 213 | +## Author |
| 214 | + |
| 215 | +Jonatan Mata ([@jonmatum](https://github.com/jonmatum)) |
| 216 | + |
| 217 | +## Contributing |
| 218 | + |
| 219 | +Issues and PRs welcome at https://github.com/jonmatum/git-metrics-mcp-server |
| 220 | + |
| 221 | +## Support |
| 222 | + |
| 223 | +- GitHub Issues: https://github.com/jonmatum/git-metrics-mcp-server/issues |
| 224 | +- MCP Documentation: https://modelcontextprotocol.io/ |
0 commit comments