diff-sentinel
Provides GitHub-focused tooling such as a composite GitHub Action to gate pull requests, triage GitHub issues, and generate publication-ready GitHub PR comments based on diff audits.
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-sentinel
Fast AST git diff analyzer, secret detector, SARIF exporter, and Model Context Protocol (MCP) server for automated code reviews.
Overview
Reviewing pull requests at scale is challenging:
Leaked credentials, cloud tokens, and dangerous runtime patterns can slip past human reviewers.
Subtle public API signature changes cause silent downstream breaking changes.
Large diffs containing lockfiles, vendor bundles, and minified assets waste LLM context window tokens.
Critical logic modifications are frequently submitted without accompanying test coverage.
diff-sentinel is a zero-dependency static analysis tool and Model Context Protocol (MCP) server designed for developers, CI/CD pipelines, and coding agents (Claude Code, Cursor, Codex). It provides sub-millisecond patch parsing, AST breaking change detection, secret scanning, supply-chain checks, and prompt token compression.
Related MCP server: RepoPulse MCP Server
Key Features
Unified Diff Parser: Parses hunks, additions, deletions, and file renames with blast-radius calculation and path-traversal sanitization.
AST Breaking Change Detection: Identifies removed exports and modified parameter signatures across TypeScript, JavaScript, Python, Go, Rust, Java, C#, and Ruby, while distinguishing optional/default parameters.
Secret & Vulnerability Scanner: 22 built-in rules detecting OpenAI, Anthropic, AWS, GCP, GitHub, Discord, database URLs, JWTs, and unsafe dynamic execution (
eval, shell injection, SQL concat) with built-in ReDoS line-length guards.SARIF 2.1.0 Export: Full compatibility with GitHub Advanced Security and Code Scanning tabs.
LLM Context Optimizer: Compresses diffs by filtering lockfile/asset noise, reducing prompt tokens by 60–80%.
Model Context Protocol (MCP): Native JSON-RPC 2.0 stdio server providing 10 tools for Claude Desktop, Claude Code, and Cursor.
Cognitive Complexity Analyzer: Detects deeply nested conditional logic and flags maintainability hotspots.
Supply-Chain Dependency Guard: Analyzes manifest and lockfile diffs (
package.json,pnpm-lock.yaml,requirements.txt,poetry.lock,Cargo.toml,go.mod,go.sum) for package downgrades, loosened pins, unencrypted HTTP tarballs, and typosquatting risks.Automated Issue Triage: Classifies issues by category, urgency, reproduction completeness, and labels.
Zero Runtime Dependencies: Runs natively using Node.js 22+ type-stripping and built-in test runner.
Architecture
flowchart TD
Diff[Git Diff / Patch Input] --> Parser[Diff Parser]
Parser --> AST[AST Signature Analyzer]
Parser --> Secrets[Security & Secret Scanner]
Parser --> Complexity[Complexity Analyzer]
Parser --> Deps[Dependency Analyzer]
Parser --> Pack[Diff Compressor / Token Estimator]
AST --> Risk[Composite Risk Engine]
Secrets --> Risk
Complexity --> Risk
Deps --> Risk
Risk --> Report[Multi-Format Output]
Report --> CLI[CLI Formatter]
Report --> SARIF[SARIF 2.1.0 JSON]
Report --> PRComment[GitHub PR Markdown]
Report --> MCP[Model Context Protocol Server]
MCP <--> Agents[Claude Code / Claude Desktop / Cursor]Quick Start
Installation
Run directly with Node.js 22+ without prior installation:
# Run via npx or global runner
npx diff-sentinel --helpOr clone the repository:
git clone https://github.com/TonyStarkgenetic/diff-sentinel-ai.git
cd diff-sentinel-ai
npm testCLI Commands
1. Analyze Pull Request Diff
# Audit latest commit
git diff HEAD~1 | node --experimental-strip-types src/cli.ts diff
# Strict mode: exits with code 1 on critical security findings or high risk
git diff origin/main...HEAD | node --experimental-strip-types src/cli.ts diff --strict2. Compress Diff for LLM Prompts (Save 60-80% Tokens)
# Strips lockfiles and generated assets, outputting compact prompt-ready text
git diff origin/main...HEAD | node --experimental-strip-types src/cli.ts pack3. Export to SARIF for GitHub Code Scanning
git diff origin/main...HEAD | node --experimental-strip-types src/cli.ts diff --sarif > results.sarif4. Audit Dependencies and Supply Chain
git diff origin/main...HEAD | node --experimental-strip-types src/cli.ts deps5. Analyze Cognitive Complexity
git diff origin/main...HEAD | node --experimental-strip-types src/cli.ts complexity6. Generate Conventional Commit Changelog
git log -n 15 --oneline | node --experimental-strip-types src/cli.ts changelog 1.3.0Model Context Protocol (MCP) Integration
diff-sentinel implements the Model Context Protocol (spec 2024-11-05) over stdio.
Configuration for Claude Desktop
Add the following to your claude_desktop_config.json:
macOS:
~/Library/Application Support/Claude/claude_desktop_config.jsonWindows:
%APPDATA%\Claude\claude_desktop_config.json
{
"mcpServers": {
"diff-sentinel": {
"command": "node",
"args": [
"--experimental-strip-types",
"/absolute/path/to/diff-sentinel-ai/src/cli.ts",
"mcp"
]
}
}
}Configuration for Claude Code
In your project repository, run:
claude mcp add diff-sentinel -- node --experimental-strip-types /absolute/path/to/diff-sentinel-ai/src/cli.ts mcpAvailable MCP Tools
Tool | Description |
| Full AST-aware diff audit: security findings, breaking changes, churn, risk score. |
| Rapid scan for exposed credentials (OpenAI, Anthropic, GCP, AWS, GitHub) and unsafe APIs. |
| Generates official SARIF 2.1.0 output for GitHub Advanced Security ingestion. |
| Compresses git patches by omitting lockfile noise and reports token savings. |
| Evaluates cognitive and cyclomatic complexity; pinpoints nested hotspots. |
| Detects package downgrades, loosened pins, and typosquatting risks. |
| Generates a publication-ready GitHub Markdown comment with tables and checklists. |
| Classifies GitHub issues, checks reproduction completeness, suggests labels. |
| Parses conventional commits and calculates recommended SemVer bump. |
| Evaluates repository hygiene against open-source community standards. |
GitHub Actions Integration
Automated PR Review & SARIF Upload
Create .github/workflows/sentinel.yml:
name: diff-sentinel Audit
on:
pull_request:
branches: [main, master]
permissions:
contents: read
pull-requests: write
security-events: write
jobs:
review:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '22'
- name: Generate Diff
run: |
git fetch origin ${{ github.base_ref }} --depth=1
git diff origin/${{ github.base_ref }}...HEAD > pr.diff
- name: Run SARIF Export
run: |
node --experimental-strip-types src/cli.ts diff pr.diff --sarif > sentinel-results.sarif
- name: Upload SARIF to GitHub Code Scanning
uses: github/codeql-action/upload-sarif@v3
if: always()
with:
sarif_file: sentinel-results.sarifConfiguration
diff-sentinel can be configured via a .sentinelrc.json file in the root of your repository:
{
"ignorePatterns": [
"**/node_modules/**",
"**/dist/**",
"**/*.min.js",
"**/coverage/**"
],
"strictMode": false,
"riskThreshold": 50,
"maxAllowedComplexity": 35,
"disableRuleIds": []
}Testing
The test suite runs with Node's built-in test runner without third-party frameworks:
npm testCurrent test coverage: 39 tests across 14 test suites (100% pass rate).
License
Apache License, Version 2.0. See LICENSE for details.
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.
Deep security scans of repos you own from your editor: dependency CVEs, SAST, git-history secrets.
AI-native git hosting — repos, PRs, issues, CI gates, and AI code review over MCP (60 tools).
Checks AI-written code for leaked keys and made-up packages, on your machine. Never uploads code.
Related MCP Servers
- AlicenseAqualityBmaintenanceEnables AI assistants to perform Git workflows with semantic commit messages, pre-PR secret audits, conflict resolution, and release changelog generation.5MIT
- AlicenseNot gradedqualityBmaintenanceExposes code-review and issue-triage tools to AI assistants over stdio, letting them evaluate unified pull-request diffs for maintainer remarks, slice diffs into categorized AST hunks, and classify GitHub issues by priority while synthesizing minimal reproduction stubs.1Apache 2.0
- AlicenseAqualityBmaintenanceEnables AI assistants to turn local git history into answers about recent activity, file hotspots, change coupling, stale or already-merged branches, contributors, ref comparisons, and drafted release notes. It runs locally over stdio with a git subcommand allowlist, so it is read-only, works offline and without shell access, and is safe to auto-approve.13105 npmMIT
- AlicenseNot gradedqualityBmaintenanceEnables AI assistants to audit repository compliance, generate semantic changelogs, review git diffs for security risks and code smells, and triage incoming issues through standard JSON-RPC tools.MIT