Skip to main content
Glama

Sheriff-MCP

CI OpenSSF Scorecard OpenSSF Best Practices License Java 21+ GitHub release

Sheriff 是一个 MCP 服务器,可帮助 AI 智能体高效修复 SARIF 报告中的静态分析问题。

文档 | 安装 | 工具参考


为什么选择 Sheriff?

AI 智能体在处理大型静态分析报告时面临诸多挑战:

  • 上下文过载 - 100+ 个问题会压垮上下文窗口

  • 进度丢失 - 在上下文压缩或会话重启时工作进度会丢失

  • 低效导航 - 没有批处理意味着要在文件之间反复跳转

Sheriff 通过充当工作队列管理器来解决这些问题:

  • 智能批处理 - 按文件对问题分组,以便高效修复

  • 进度持久化 - 状态在压缩、重启和智能体切换后依然保留

  • 范围过滤 - 聚焦特定的规则、严重级别或文件模式

  • 简洁响应 - 使用缩写字段名,最大限度减少上下文占用

支持的静态分析工具

Sheriff 可与任何生成 SARIF 输出的工具配合使用:

工具

语言

SARIF 命令

Qodana

Java/Kotlin/JS/Python

qodana scan

Semgrep

多语言

semgrep --sarif -o results.sarif

ESLint

JavaScript/TypeScript

eslint --format @microsoft/sarif

CodeQL

多语言

内置 SARIF 输出

SpotBugs

Java

spotbugs -sarif

Bandit

Python

bandit -f sarif

Checkov

IaC

checkov -o sarif

Trivy

容器/IaC

trivy --format sarif

SonarQube

多语言

内置 SARIF 导出


Related MCP server: skillhub

快速开始

1. 安装

从 Releases 下载 sheriff-mcp-1.0.2-all.jar。

docker pull ghcr.io/ryansmith4/sheriff-mcp:latest

支持 MCP Registry 的客户端可以直接按名称安装:io.github.ryansmith4/sheriff-mcp

有关完整详情,请参阅安装指南。

2. 配置你的 MCP 客户端

将 Sheriff 添加到你的 MCP 客户端(Claude Code、Cursor、ChatGPT Desktop 等):

{
  "mcpServers": {
    "sheriff": {
      "command": "java",
      "args": ["-jar", "/path/to/sheriff-mcp-1.0.2-all.jar", "start"]
    }
  }
}

或者使用 Docker:

{
  "mcpServers": {
    "sheriff": {
      "command": "docker",
      "args": ["run", "-i", "--rm", "-v", ".:/data", "ghcr.io/ryansmith4/sheriff-mcp:latest"]
    }
  }
}

有关特定客户端的说明和推荐的智能体指令,请参阅智能体设置指南。

3. 使用

1. Run static analysis     →  qodana scan
2. Load into Sheriff       →  sheriff load target="results.sarif"
3. Get next file's issues  →  sheriff next
4. Fix all issues in file  →  [edit the code]
5. Mark as done            →  sheriff done fps=[...] status="fixed"
6. Repeat 3-5              →  until remaining = 0

Sheriff 对外仅提供一个 sheriff 工具,包含 7 个操作:load、next、done、progress、summary、reopen 和 export。完整文档请参阅工具参考。


示例会话

User: "Fix all ConstantValue issues in my codebase"

Agent: sheriff load target="build/qodana/qodana.sarif.json"
       → 136 total issues, 22 ConstantValue, 15 unused...

Agent: sheriff next scope={rule: "ConstantValue"}
       → 3 issues in Service.java with code snippets

Agent: [reads Service.java, fixes all 3 issues]

Agent: sheriff done fps=["88d32cab35478753", "ab1c2d3e12345678", "f9e8d7c6a1b2c3d4"] status="fixed"
       → 3 marked fixed, 19 remaining

       ... continues until remaining = 0

安全性

所有发布产物均使用 Sigstore 签名,以保障供应链安全。

验证 JAR:

VERSION=1.0.2
cosign verify-blob \
  --signature sheriff-mcp-${VERSION}-all.jar.sig \
  --certificate sheriff-mcp-${VERSION}-all.jar.pem \
  --certificate-identity-regexp "https://github.com/ryansmith4/sheriff-mcp" \
  --certificate-oidc-issuer "https://token.actions.githubusercontent.com" \
  sheriff-mcp-${VERSION}-all.jar

验证 Docker 镜像:

cosign verify ghcr.io/ryansmith4/sheriff-mcp:latest \
  --certificate-oidc-issuer=https://token.actions.githubusercontent.com \
  --certificate-identity-regexp="github.com/ryansmith4/sheriff-mcp"

有关我们的安全策略,请参阅 SECURITY.md。


贡献

欢迎贡献!有关指南,请参阅 CONTRIBUTING.md。

许可证

Apache License 2.0 - 请参阅 LICENSE

Maintenance

ActivityInactive
ResponsivenessNo recent community issues

Related MCP Connectors

Related MCP Servers

  • A
    license
    Not graded
    quality
    D
    maintenance
    Enables AI agents to scan GitHub repositories for security vulnerabilities, deployment blockers, and code quality issues. It provides detailed findings and auto-generated code patches to help developers ensure their code is production-ready.
    55 npm
    MIT
  • F
    license
    Not graded
    quality
    D
    maintenance
    Enables AI agents to scan codebases for TODO/FIXME/XXX patterns and get prioritized results over MCP, supporting CI gates and multiple output formats.
    -
  • A
    license
    A
    quality
    C
    maintenance
    Enables AI agents to scan code for security vulnerabilities using multiple static analysis tools, with support for filtering, deduplication, and CI/CD integration.
    27
    60 PyPI
    4
    MIT