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 four tools and two resources available.Tools
Rafter exposes four read-only security tools over MCP.scan_secrets
Scan files or directories for hardcoded secrets and credentials.
| Parameter | Type | Required | Description |
|---|---|---|---|
path | string | Yes | File or directory path to scan |
engine | string | No | auto (default), gitleaks, or patterns |
Example Response
Example Response
evaluate_command
Evaluate whether a shell command is allowed by Rafter security policy.
| Parameter | Type | Required | Description |
|---|---|---|---|
command | string | Yes | Shell command to evaluate |
Example Response
Example Response
read_audit_log
Read Rafter audit log entries with optional filtering.
| Parameter | Type | Required | Description |
|---|---|---|---|
limit | number | No | Maximum entries to return (default: 20) |
event_type | string | No | Filter: command_intercepted, secret_detected, content_sanitized, policy_override |
since | string | No | ISO 8601 timestamp — only entries after this time |
get_config
Read Rafter configuration (full config or a specific key).
| Parameter | Type | Required | Description |
|---|---|---|---|
key | string | No | Dot-path config key (e.g. agent.commandPolicy). Omit for full config. |
Resources
Two read-only resources expose Rafter’s current state.| URI | Description |
|---|---|
rafter://config | Current Rafter configuration (JSON) |
rafter://policy | Active security policy — merged .rafter.yml + ~/.rafter/config.json (JSON) |
How It Works
The MCP server wraps Rafter’s existing CLI classes:scan_secretsusesRegexScanner(built-in 21+ patterns) with automatic fallback from Gitleaksevaluate_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
Compared to Pretool Hooks
| MCP Server | Pretool Hooks | |
|---|---|---|
| Platform | Any MCP client | Claude Code only |
| Model | Agent calls tools explicitly | Hooks intercept before every tool call |
| Trust | Agent chooses to use tools | Agent cannot bypass hooks |
| Setup | Add to MCP config | rafter agent init --claude-code |

