diff-explainer
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., "@diff-explainerexplain my staged git changes"
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.
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: llm-reviewer
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.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).
MCP server for visual regression testing: triage a PR's UI diffs from your coding agent.
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 gradedqualityCmaintenanceMCP server for reviewing code changes using LLMs, supporting Copilot, Ollama, and OpenAI-compatible endpoints.MIT
- AlicenseNot gradedqualityCmaintenanceMCP server for automated code review using AI agents. It analyzes code diffs or file paths for bugs, security issues, and style violations.MIT
- AlicenseNot gradedqualityAmaintenanceAI code reviews and git activity digests with machine-readable risk scoring, available as an MCP server for use within an agent session.1MIT