rm -rf, git push --force, DROP TABLE, etc.). Use Option B if you only need to govern MCP tool calls routed to an upstream server.
For
rm -rf, git push --force, DROP TABLE, and other shell-level commands, you must use Option A (local interceptor). The cloud proxy only sees MCP JSON-RPC calls — it cannot intercept commands the agent runs via bash or a terminal tool.Option A — Local interceptor (recommended)
The Sentrail CLI runs a local proxy athttp://localhost:3773. Claude Code connects to it instead of the upstream MCP server. Every tools/call — including shell commands — is classified and checked against your policies before execution.
1. Install the CLI
2. Initialize
agk_…), workspace ID, and upstream MCP server URL when prompted. The command writes ~/.sentrail/config.json and prints the MCP snippet for the next step.
3. Add to Claude Code config
Add the following to your Claude Code MCP configuration. The location depends on your setup:- Global:
~/.claude/mcp_servers.json - Project:
.claude/mcp_servers.jsonin the project root
4. Start the interceptor
5. Verify with the demo
rm -rf, git push --force, DROP TABLE, and cat README.md — and shows the decision for each. No real commands are executed.
Option B — Cloud MCP proxy
Point Claude Code directly at the Sentrailmcp-gate cloud endpoint. This governs MCP tools/call requests to an upstream MCP server but does not intercept local shell commands.
Prerequisites
- A Sentrail workspace with an MCP server connected (Tools → MCP → Connect)
- An API key with the
mcpscope
Configuration
Verifying the connection
After saving the config, restart Claude Code and run:sentrail listed as a connected server with the tools from your upstream MCP server.
How it works
Claude Code sends all MCP calls tomcp-gate instead of your upstream server:
initialize—mcp-gateresponds with Sentrail server info and protocol version2024-11-05tools/list—mcp-gatefetches the tool list from your upstream server (cached 60 seconds) and returns it unchangedtools/call—mcp-gateevaluates the call against your policies, then either forwards it, blocks it, or defers it
_meta.sentrail.status = "require_approval" and a message explaining that approval is needed. Claude Code will surface this to you. Poll the status endpoint or wait for the dashboard notification.
Agent identity
TheX-Agent-Id: claude-code header identifies this connection in audit logs. You can create agent-specific policies using this ID:
Troubleshooting
Server not showing up in /mcp
Server not showing up in /mcp
Check that the Sentrail MCP endpoint ends with
/mcp-gate/sse. stdio is not supported by mcp-gate.401 Unauthorized
401 Unauthorized
424 No MCP server connected
424 No MCP server connected
Go to Tools → MCP in the dashboard and connect an upstream MCP server before using
mcp-gate.