Claude Code is an AI coding agent that uses MCP to interact with your filesystem, run shell commands, and manage git repositories. By routing Claude Code through Authensor's MCP gateway, you can enforce safety policies on every action it takes.
Claude Code has access to powerful tools: file read/write, shell execution, git operations, and web requests. In most configurations, these tools are unrestricted. Adding a safety layer lets you:
rm -rf, mkfs, dd)Install and configure the Authensor MCP server:
pnpm add -g @authensor/mcp-server
Create a policy for Claude Code:
# claude-code-policy.yaml
version: "1"
rules:
- tool: "shell.execute"
action: block
when:
args.command:
matches: "rm -rf|mkfs|dd if=|shutdown|reboot|format"
reason: "Destructive commands blocked"
- tool: "file.write"
action: allow
when:
args.path:
startsWith: "/Users/you/projects/"
- tool: "file.write"
action: block
reason: "Writes outside project directory blocked"
- tool: "git.push"
action: escalate
reason: "Push requires approval"
- tool: "*"
action: allow
Add the MCP gateway to your Claude Code configuration:
{
"mcpServers": {
"authensor-gateway": {
"command": "npx",
"args": ["@authensor/mcp-server", "--policy", "./claude-code-policy.yaml"]
}
}
}
With the gateway in place, Claude Code operates within your defined boundaries. If it tries to run rm -rf /, the command is blocked before it reaches the shell. If it tries to write outside your project directory, the write is denied. If it tries to push to a remote, the action is held for your approval.
All of this happens transparently. Claude Code sees the same MCP tools and does not know the gateway exists. It receives error messages for blocked actions and can adapt its approach.
Every action Claude Code takes is recorded as a receipt. You can review the audit trail to see exactly what happened during a session:
npx authensor receipts list --session latest
This is useful for code review: you can verify what the agent actually did versus what it said it did.
Explore more guides on AI agent safety, prompt injection, and building secure systems.
View All Guides