Skip to main content
Glama
x-asd
by x-asd

pr-guard-mcp

pr-guard-mcp 是一个面向 Pull Request 的安全审计 MCP Server。

它可以让 Codex、Claude Code、Cursor 等支持 MCP 的 AI Agent 对 git diff 或 PR diff 做安全检查,帮助你在代码合并前发现明显风险。

功能

  • 检测新增代码中的密钥泄露,例如 AWS key、GitHub token、数据库连接串、私钥片段

  • 识别高风险代码模式,例如 eval、命令执行、SQL 字符串拼接

  • 识别依赖文件里的新增依赖,例如 package.jsonrequirements.txtpyproject.tomlpom.xml

  • 输出结构化 JSON,方便 AI Agent 生成 PR review 评论

Related MCP server: CodePeel MCP Server

安装

npm install
npm run build

本地运行

npm run dev

Demo

npm run demo

示例会分析 examples/insecure.diff,输出类似下面的安全摘要:

{
  "summary": {
    "totalFindings": 3,
    "critical": 1,
    "high": 1,
    "medium": 1
  },
  "findings": [
    {
      "category": "dangerous-pattern",
      "severity": "critical",
      "title": "Potential command execution added"
    }
  ]
}

MCP 工具

analyze_pr_diff

分析一段 unified diff 文本,并返回安全风险列表。

输入:

{
  "diff": "这里放 git diff 或 PR diff 文本"
}

输出字段:

  • summary:按严重程度统计的风险数量

  • findings:具体风险列表,包括类型、严重程度、文件、行号、证据和修复建议

MCP 客户端配置示例

构建完成后,可以把它配置到支持 MCP 的客户端中:

{
  "mcpServers": {
    "pr-guard": {
      "command": "node",
      "args": ["D:/github-xiang-mu/pr-guard-mcp/dist/server.js"]
    }
  }
}

适合场景

  • 合并 PR 前做轻量安全检查

  • 让 AI Agent 生成安全 review 评论

  • 快速检查新增代码里是否出现明显密钥和危险 API

  • 作为后续 GitHub PR 自动审计工具的基础版本

当前限制

  • 第一版只分析传入的 diff 文本,不会主动调用 GitHub API

  • 检测规则以启发式正则为主,不能替代完整 SAST

  • 依赖风险目前只识别新增依赖,还没有接入 npm、PyPI、Maven 漏洞库

后续计划

  • 支持直接输入 GitHub PR URL

  • 接入 GitHub Advisory、npm audit、PyPI advisory 和 OSV

  • 输出 Markdown 格式的 PR review 评论

  • 增加更多语言的危险 API 规则

Install Server
F
license - not found
D
quality
C
maintenance

Maintenance

Maintainers
Response time
Release cycle
Releases (12mo)
Commit activity

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Servers

  • A
    license
    -
    quality
    A
    maintenance
    Enables AI agents to scan projects for leaked secrets and manage security incidents using GitGuardian's comprehensive API. It supports automated secret detection, honeytoken creation, and remediation workflows to secure codebases without context switching.
    Last updated
    37
    MIT
  • A
    license
    -
    quality
    B
    maintenance
    Local-first security check for AI coding agents — finds hardcoded secrets, exposed .env files, git-history leaks and vulnerable dependencies (OSV), entirely on your machine. Ask your agent "is this safe to ship?" and get a Launch Readiness score with a fix for every finding.
    Last updated
    MIT
  • A
    license
    A
    quality
    C
    maintenance
    Analyzes GitHub Pull Request diffs for security vulnerabilities and data leaks, using a deterministic filter to skip trivial changes and an AI-powered analysis for logic changes.
    Last updated
    1
    MIT

View all related MCP servers

Related MCP Connectors

  • Screens public GitHub repos and PRs to generate risk maps, findings, and merge-readiness signals.

  • Zero-config MCP security scanner for AI-generated apps. 25K+ vulnerability patterns.

  • CVE lookups (NVD) and dependency-manifest audits (OSV) for AI agents. No API keys.

View all MCP Connectors

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/x-asd/pr-guard-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server