MCP Integration
Rafter runs as a standard MCP server over stdio, exposing security tools to any MCP-compatible client—Cursor, Windsurf, Claude Desktop, Cline, and others. No API key required. All tools run locally.Setup
1. Install Rafter CLI
2. Add to Your MCP Client
Add Rafter to your MCP client’s server configuration:3. Restart Your Client
Restart the MCP client to load Rafter’s tools. You should see eight tools and two resources available: the four local, read-only tools described below, plus the four remote Sites tools (the Sites tools work without further setup ifRAFTER_API_KEY is set, but only calls to them require a key — the local tools never do).
Tools
Rafter exposes four read-only security tools over MCP.scan_secrets
Scan files or directories for hardcoded secrets and credentials.
Returns an array of scan results with file paths, pattern names, severity levels, and redacted matches.
Example Response
Example Response
evaluate_command
Evaluate whether a shell command is allowed by Rafter security policy.
Returns whether the command is allowed, its risk level, and whether it requires approval.
Example Response
Example Response
read_audit_log
Read Rafter audit log entries with optional filtering.
get_config
Read Rafter configuration (full config or a specific key).
Resources
Two read-only resources expose Rafter’s current state.How It Works
The MCP server wraps Rafter’s existing CLI classes:scan_secretsusesRegexScanner(built-in 21+ patterns) with automatic fallback from Betterleaks (v0.8.0+; gitleaks successor)evaluate_commandusesCommandInterceptorwith policy-driven risk assessmentread_audit_logreads from~/.rafter/audit.jsonlget_configreads from~/.rafter/config.jsonmerged with.rafter.yml
rafter agent config set).
Configuration
The MCP server uses the same configuration as all other Rafter commands. Set up your security policy once and it applies everywhere:.rafter.yml policy file in your project root. See Policy File for details.
Verify Installation
After adding Rafter to your MCP client, test that tools are working:- Ask the agent to scan a directory for secrets
- Ask it to evaluate whether
rm -rf /is safe - Ask it to show your Rafter configuration
Sites Tools (Remote, API-Key-Gated)
The four tools above are local-only, read-only, and require no API key. Rafter also exposes a separate set of Sites tools that are the opposite on every axis: they call Rafter’s remote API, require an API key, and two of them mutate state (create a site, trigger a scan).Authentication
The Sites tools resolve your API key the same way the CLI does: theRAFTER_API_KEY environment variable, or your stored Rafter config, checked in that order.
sites_create
Register a new site and trigger its first scan. Requires an API key with the read-and-scan scope.
sites_scan
Trigger a re-scan of a site you already own. Requires an API key with the read-and-scan scope.
sites_list
List your sites, paginated. Requires an API key with the read scope.
sites_get
Get a site’s status, latest run, and findings summary. Requires an API key with the read scope.
See the Sites API reference for full request/response shapes, and the Sites CLI guide for the equivalent
rafter sites commands.
Compared to Pretool Hooks
For maximum security on Claude Code, use both: pretool hooks for enforcement + MCP tools for agent-initiated scans. For other platforms, the MCP server is the primary integration path.
What’s Next?
Secret Scanning
21+ secret patterns detected
Policy File
Define per-project security policies
Command Reference
Full CLI reference

