Skip to main content

How it works

agentsentinel-mcp is a stdio MCP server shipped in the Python SDK. Claude Code launches it like any other MCP server. The proxy answers initialize itself and forwards tools/list and tools/call to the platform’s /mcp endpoint, authenticating with an agent-bound API key read from its environment. The key travels only in the upstream Authorization header. It never appears in a tool list, a tool result, an error message or the proxy’s output, so the model never sees it. Upstream credentials for the tools themselves stay in AgentVault and are injected by the platform only after the gateway allows a call.

Install

The proxy needs Python 3.10 or later:
This installs the agentsentinel-mcp command. Make sure it is on the PATH Claude Code uses, or put its absolute path in command.

Register the server

Add this to .mcp.json at your project root (or your user-level Claude Code configuration):
Claude Code expands ${AGENT_SENTINEL_API_KEY} from the environment it was started in, so the key never has to be committed. Export it before launching Claude Code. Alternatively, register the server from the CLI:
If the key is missing or the URL is not allowed, agentsentinel-mcp exits non-zero with a one-line message on stderr (Claude Code shows it as a failed server). The message never contains the key.

Walkthrough: a governed call, end to end

The operator steps (1–3, 5 and 6) use a user session: the registry, AgentVault and policy routes refuse API keys. In the commands below, $API is your platform API base URL and $SESSION_TOKEN is your console session token.

1. Create an agent-bound key

Copy the returned key (shown once) into AGENT_SENTINEL_API_KEY in the shell you launch Claude Code from.

2. Register a governed tool

Use an HTTPS endpoint you operate as target_url. Note the returned tool id. See Registering governed tools for the rules.

3. Bind a credential

Store the target’s credential in AgentVault and bind it to the tool, as described in AgentVault Credentials:
The secret is write-only. The platform injects it into the outbound request only after the gateway allows the call; neither Claude Code nor the proxy ever holds it.

4. Call it from Claude Code

Restart Claude Code (or run /mcp) and check that the agentsentinel server lists send. Then ask:
Use the send tool to send a message to a@example.com.
Claude Code calls tools/call. The proxy forwards it unchanged, the gateway decides, the platform injects the credential and runs the target, and the result comes back as an ordinary tool result. The model’s context holds the tool’s name, schema and result, never a key or token.

5. See a budget cap block a call

Cap the tool below its estimated cost with a policy for this agent:
Ask Claude Code to send again. The target is not contacted. The tool result has isError: true and the refusal’s reason code in structuredContent, which the proxy passes through unchanged:
See Error reason codes for the other codes, such as monthly_budget_exceeded and kill_switch_active.

6. Verify the ledger

Both calls, the allowed one and the refused one, are recorded in the signed, hash-chained ledger. Verify the whole chain:
A response with "valid": true and "head_matches": true shows that no row was altered, removed or reordered. See GET /api/v1/ledger/verify.

Troubleshooting

Resources, prompts and the /mcp/admin mount are not proxied.