Agent Setup
Supported MCP Clients
Section titled “Supported MCP Clients”Sheriff works with any client that supports the Model Context Protocol:
- Claude Code / Claude Desktop - Anthropic
- ChatGPT Desktop - OpenAI (adopted MCP March 2025)
- Cursor / Windsurf - AI-native IDEs
- Zed - High-performance editor
- Continue / Cline - VS Code extensions
- Cody - Sourcegraph
Configure MCP Server
Section titled “Configure MCP Server”Add Sheriff to your MCP client configuration.
For Claude Code, add to your project’s .mcp.json or run claude mcp add sheriff. For Claude Desktop, add to claude_desktop_config.json (~/Library/Application Support/Claude/ on macOS or %APPDATA%\Claude\ on Windows). For Cursor, Windsurf, and other clients, consult their documentation for the config file location.
{ "mcpServers": { "sheriff": { "command": "java", "args": ["-jar", "/path/to/sheriff-mcp-1.0.2-all.jar", "start"] } }}Mount your project directory so Sheriff can access SARIF files and persist state:
{ "mcpServers": { "sheriff": { "command": "docker", "args": ["run", "-i", "--rm", "-v", ".:/data", "ghcr.io/ryansmith4/sheriff-mcp:latest"] } }}Add Agent Instructions
Section titled “Add Agent Instructions”Add the following to your project’s CLAUDE.md, copilot-instructions.md, or equivalent agent instructions file:
## Static Analysis with Sheriff
This project uses Sheriff MCP server for managing static analysis issue fixes.
### Workflow
1. Load SARIF: `sheriff load target="path/to/results.sarif"`2. Get issues: `sheriff next` (optionally with scope filter)3. Fix ALL issues in the returned file4. Mark done: `sheriff done fps=["fp1", "fp2"] status="fixed"`5. Repeat until `remaining = 0`
### Rules
- Fix ALL issues in a file before calling `next` again — partial fixes waste a tool call- Use snippet matching (not line numbers) to locate issues — line numbers shift after edits- Mark false positives as `skip`, not `fixed` — keeps fix counts accurate- Don't rescan until the full fix pass is complete — rescanning resets all progressExample Prompts
Section titled “Example Prompts”Here are effective prompts to give your AI agent:
Fix All Issues
Section titled “Fix All Issues”Load the SARIF file at
build/qodana/qodana.sarif.jsonand fix all issues, starting with High severity.
Fix Specific Rule
Section titled “Fix Specific Rule”Load the SARIF and fix all “ConstantValue” issues. These are redundant null checks.
Review First
Section titled “Review First”Load the SARIF and show me a summary. I want to skip “unused” warnings and focus on bugs.
Focus on Files
Section titled “Focus on Files”Load the SARIF and fix all issues in
src/main/java/com/example/service/**.
Verifying Setup
Section titled “Verifying Setup”After configuration, test that Sheriff is working:
- Ask your agent: “What MCP tools do you have available?”
- Look for
sheriffin the list of available tools - Try: “Use the sheriff tool with
action: summaryto verify it’s working”
Next Steps
Section titled “Next Steps”- Tool Reference - Learn all Sheriff actions
- Best Practices - Tips for efficient fixing