@inpolicy/mcp-server
v0.1.1
Published
Model Context Protocol server for InPolicy — pre-inference policy injection and post-inference output checking for any AI agent.
Readme
@inpolicy/mcp-server
Model Context Protocol server for InPolicy — AI governance for any agent. Exposes six tools to the MCP host:
record_turn— primary surface. Call on every inbound user or tool message. Returns the updated policy state, what changed this turn, and theinjection_blockto drop into your system prompt.get_policy_context— single-shot convenience. Same retrieval asrecord_turnbut stateless; useful for one-off prompts.get_conversation_state— read the current session's active policies +injection_blockwithout recording a turn.end_conversation— purge a session's Redis state. Idempotent.check_tool_call— gate a proposed agent tool call against active policies. Opt-in via API-key setting; otherwise returns 403.check_output— call after generating but before sending. Returns a safety flag, risk score, specific violations, and an optionalsuggested_redaction.
Quickstart
Get an API key from your InPolicy dashboard (Settings → API Keys).
Claude Desktop
Add to ~/Library/Application Support/Claude/claude_desktop_config.json:
{
"mcpServers": {
"inpolicy": {
"command": "npx",
"args": ["-y", "@inpolicy/mcp-server"],
"env": {
"INPOLICY_API_KEY": "inp_live_..."
}
}
}
}Claude Code
claude mcp add inpolicy -- env INPOLICY_API_KEY=inp_live_... npx -y @inpolicy/mcp-serverCursor / Windsurf
Add to the MCP config:
{
"mcpServers": {
"inpolicy": {
"command": "npx",
"args": ["-y", "@inpolicy/mcp-server"],
"env": { "INPOLICY_API_KEY": "inp_live_..." }
}
}
}Configuration
| Env var | Default | Notes |
| -------------------- | -------------------------- | ----------------------------------------- |
| INPOLICY_API_KEY | — | Required. Issued per tenant from the dashboard. |
| INPOLICY_API_URL | https://api.inpolicy.ai/api/v1 | Override for self-hosted InPolicy. Include the /api/v1 prefix. |
| INPOLICY_TIMEOUT_MS| 30000 | Per-call timeout in ms. |
Tool contracts
See the generated types in dist/ after pnpm build, or the
Agent Governance API reference.
License
MIT
