Claude Code setup
Claude Code is Anthropic’s CLI for engineers. Installing InPolicy takes one command.
Prerequisites
Section titled “Prerequisites”- Claude Code installed (
npm install -g @anthropic-ai/claude-codeor equivalent). - An InPolicy API key.
One-user setup
Section titled “One-user setup”Run this once on each machine:
claude mcp add inpolicy -- env INPOLICY_API_KEY=inp_live_REPLACE_ME npx -y @inpolicy/mcp-serverReplace the key and you’re done. Verify with:
claude mcp listYou should see inpolicy listed. Open any project with claude and the tools are available.
Next, apply the system prompt template by adding it to either:
- User-level:
~/.claude/CLAUDE.md(applies to all Claude Code sessions on your machine), or - Project-level: a
CLAUDE.mdin the repo root (applies to anyone running Claude Code there).
Fleet deployment (IT)
Section titled “Fleet deployment (IT)”Option A: Corporate Claude Code install script
Section titled “Option A: Corporate Claude Code install script”Add the MCP config + system prompt to your standard Claude Code install script.
#!/usr/bin/env bashset -euo pipefail
# Install Claude Code if missingcommand -v claude >/dev/null 2>&1 || npm install -g @anthropic-ai/claude-code
# Register InPolicy MCPclaude mcp add inpolicy -- env INPOLICY_API_KEY="$INPOLICY_API_KEY" npx -y @inpolicy/mcp-server
# Drop the company CLAUDE.mdmkdir -p "$HOME/.claude"curl -fsSL https://your-internal-host/company-CLAUDE.md -o "$HOME/.claude/CLAUDE.md"
echo "Claude Code + InPolicy ready."Option B: Project-level CLAUDE.md in a shared template
Section titled “Option B: Project-level CLAUDE.md in a shared template”If your engineering org uses a standard repo template, check in the system prompt as a CLAUDE.md in the repo root. Every engineer who runs Claude Code in that repo picks it up automatically.
Option C: Managed devcontainer / codespace
Section titled “Option C: Managed devcontainer / codespace”Bake the MCP registration + CLAUDE.md into your devcontainer definition. Claude Code running inside the container gets InPolicy for free.
Verify it’s working
Section titled “Verify it’s working”In any Claude Code session, ask:
“List the InPolicy MCP tools you have available.”
Claude Code should list record_turn, get_policy_context, check_output, check_tool_call, get_conversation_state and end_conversation. check_tool_call is always listed; if tool_call_governance is disabled on the API key, calling it returns a 403.
When check_output returns block, Claude should send suggested_redaction only when it is not null (every finding is then rewritten). When it is null, Claude regenerates using the violations and checks again, or hands the draft to you. A country must be a valid ISO 3166-1 alpha-2 code such as GB; an invalid one is refused with a 400, even when you are signed in with InPolicy. See Tool results and errors for the other error messages. These results and messages need @inpolicy/mcp-server 0.2.0 or later.
Notes for engineering teams
Section titled “Notes for engineering teams”- Engineers will notice Claude Code surfaces policy citations in code reviews and commit-message drafts when relevant policies exist (e.g. “naming conventions,” “security review required for X,” “don’t commit .env”).
- If you want to scope policies so engineering doesn’t see non-engineering policies (HR, legal), use Policy Areas and scope the API key accordingly.
- Claude Code’s
/mcpcommand shows the live tool list and lets engineers toggle servers. If an engineer turns off InPolicy, they’ll see a note about it; that’s a legitimate per-session decision (e.g. they’re debugging an InPolicy integration).
Cookie PreferencesDo Not Sell or Share My Personal Information