diff-explainer
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
diff-explainer
AI-powered git diff analysis: human-readable explanations, risk flags, and review checklists.
Works as a CLI, Python library, and MCP server tool.
Setup
pip install -r requirements.txt
# Optional: set for LLM-powered summaries
export OPENAI_API_KEY="sk-..."Risk detection works without an API key. Only summaries and review checklists require the LLM.
Related MCP server: code-review-automation
Usage
CLI
# Pipe from git diff
git diff | python cli.py
# Read from file
python cli.py --file examples/sample.diff
# Auto-run git diff in current repo
python cli.py --git
# JSON output
python cli.py --file examples/sample.diff --format jsonPython Library
from explainer import explain_diff
with open("changes.diff") as f:
diff_text = f.read()
result = explain_diff(diff_text)
print(result.summary)
print(result.risk_flags)
print(result.files_changed)MCP Server (opencode integration)
Add to your opencode.json:
{
"mcpServers": {
"diff-explainer": {
"type": "stdio",
"command": "python",
"args": ["server.py"],
"cwd": "/path/to/diff-explainer"
}
}
}Available tools:
explain_diff_tool(diff_text)— Explain any diff textexplain_staged()— Explain currently staged git changes
Run standalone: python server.py
Features
Hybrid analysis: Regex risk detection (offline) + LLM summaries (optional)
7 risk patterns: Removed error handling, changed timeouts, auth modifications, missing env defaults, large changes, tech debt markers, hardcoded secrets
Graceful degradation: Works without API key — risk flags and file stats always available
Multiple interfaces: CLI, library import, MCP server
Output Example
# Diff Explanation
## Summary
This change reduces retry resilience in the auth service and introduces a hardcoded API key.
**Category:** config_change
## Files Changed
- `src/auth.py` — +3/-7 lines
- `src/config.py` — +5/-1 lines
## Risk Flags
- 🔴 **HIGH**: Removed error handling code
- 🔴 **HIGH**: Modified auth/permission checks
- 🔴 **HIGH**: Possible hardcoded secret
- 🟡 **MEDIUM**: Changed retry/timeout values
- 🟢 **LOW**: Added TODO/FIXME/HACK comment
## Review Checklist
- [ ] Is removing the try/except intentional? What handles AuthError now?
- [ ] Why were retries reduced from 3 to 1?
- [ ] The hardcoded API key should be moved to a secrets manager.Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
This server cannot be deployed
Maintenance
Related MCP Connectors
Risk-scan a diff, flag AI-generated-code tells, find secrets. 5 of 7 tools need no account.
AI-native git hosting — repos, PRs, issues, CI gates, and AI code review over MCP (60 tools).
A Model Context Protocol (MCP) application for automated GitHub PR analysis and issue management.…
Related MCP Servers
- AlicenseNot gradedqualityCmaintenanceOpen-source AI code review MCP server for local git diff auditing with deterministic security rules and AI-powered analysis using any OpenAI-compatible model.4MIT
- AlicenseNot gradedqualityDmaintenanceMCP server for automated code review using AI agents. It analyzes code diffs or file paths for bugs, security issues, and style violations.MIT
- AlicenseNot gradedqualityCmaintenanceAI code reviews and git activity digests with machine-readable risk scoring, available as an MCP server for use within an agent session.1MIT
- AlicenseNot gradedqualityDmaintenanceAn MCP server that gives AI assistants deep understanding of your local Git repositories, providing instant repo overviews, change summaries, blame analysis, changelogs, branch health checks, and history search.80 npmMIT