Skip to main content

Overview

Agent Sentinel exposes two MCP protocol endpoints: /mcp for agents executing governed tools and /mcp/admin for platform administration. Both use JSON-RPC 2.0 over stateless streamable HTTP with JSON responses, without persistent sessions or an SSE stream. The older /api/v1/mcp/* REST facade is documented below.

Endpoint and auth

Send requests to POST /mcp with Authorization: ApiKey <agent-bound-key>, Content-Type: application/json and Accept: application/json, text/event-stream. Only agent-bound API keys are accepted. The organization and agent identity come from the key; X-Sentinel-Agent-Id cannot override them. A user session or unbound key receives HTTP 403 with top-level reason_code: "agent_bound_key_required". Missing authorization receives HTTP 401. The server supports initialize, ping, tools/list and tools/call. Use an MCP client to initialize and negotiate the protocol before calling tools. tools/list returns only enabled governed tools in the caller’s organization, ordered by name; it does not expose the admin tools. For example, after registering the send tool below, list tools:
The response uses MCP’s inputSchema field (the registry uses input_schema):

Registering governed tools

Operators register executable targets through /api/v1/governed-tools, using a user session. All registry routes refuse API keys, bound or unbound. Reads require organization membership; writes require OWNER or ADMIN. Tools belong to the active organization; another organization’s tool returns 404. Send this JSON body to POST /api/v1/governed-tools (201 on success):
The target URL is illustrative: register an actual endpoint you operate. Names must match [A-Za-z0-9_.-]{1,64} and be unique within the organization. input_schema must be an object schema of at most 16 KiB serialized. Only POST targets are supported; timeouts range from 1 to 30 seconds (default 10). Use GET on the collection or /{tool_id} to inspect registrations, PATCH /{tool_id} to update and DELETE /{tool_id} to remove them. Target URLs must use HTTPS, contain no userinfo and resolve only to global addresses. Loopback, private, link-local (including cloud metadata), multicast, reserved and unspecified addresses are refused. HTTP is permitted only with ENVIRONMENT=local. GOVERNED_TOOL_ALLOW_PRIVATE_TARGETS bypasses address checks only when ENVIRONMENT=local; it is ignored elsewhere. Targets are checked at registration and again at execution. For credential binding and injection, see AgentVault Credentials.

tools/call lifecycle

Call a registered tool by name:
  1. Validate before writes. The tool must be enabled in the caller’s organization. Arguments must be a JSON object, contain only finite numbers, fit within 64 KiB as canonical JSON and satisfy input_schema. Invalid or unresolvable schema references are refused; remote schemas are never fetched. Optional _meta.run_id and _meta.approval_request_id must be UUIDs.
  2. Ask the gateway. The executor hashes canonical arguments (sorted keys, compact UTF-8 JSON) into inputs_digest. Action name, impact, cost and tags come from the tool registration. The gateway can allow, deny or require approval. Denial and approval-required decisions never contact the target.
  3. Verify the decision token. An allow executes only if its token verifies and matches the organization, agent, action and input digest.
  4. Execute a DNS-pinned POST. The executor revalidates DNS and connects to a checked address while preserving the original Host and TLS SNI. It posts the canonical arguments with X-Sentinel-Decision-Token. Redirects are not followed, compressed responses are refused, and response reading stops at 1 MiB.
  5. Record and reconcile. A signed tool_result ledger row records status, response byte count and SHA-256, never the response body. Recording and reservation reconciliation share a transaction; an unverifiable signature prevents that transaction from committing. Whenever the target returned a response status, including a non-2xx status or a failure while reading the body, the reservation reconciles the registered estimated cost. Only a call that never received a response (refused target, connection failure, timeout before headers) reconciles zero. Retries of failed calls therefore consume budget. After validation, the decision, execution and recording task survives caller cancellation.
For a target returning delivered ✓, success is an HTTP 200 JSON-RPC result:
Tool refusals also use HTTP 200, with result.isError: true and result.structuredContent.reason_code. For example, passing {"to":5} fails the registered schema:

Approvals

When the gateway returns require_approval, the tool result has isError: true and structuredContent containing decision, reason_code and approval_request_id. Its text directs the caller to poll GET /api/v1/approvals/{approval_request_id}/poll. No target request has occurred yet. After approval, retry the same tool with the same arguments, passing the returned UUID in params._meta.approval_request_id:
The UUID above is illustrative; use the returned approval ID. Before redemption, the executor checks the organization, action and argument digest. A mismatch returns approval_inputs_mismatch without consuming the approval. Approval redemption is single-use; pending, expired, rejected or already-redeemed approvals cannot authorize execution. See the Approvals API.

Limits

Malformed JSON also produces -32700. Compressed target responses are refused with tool_response_encoded rather than decompressed.

Error reason codes

These are all reason-code constants defined by the governed tool executor. Read them from result.structuredContent.reason_code; execution failures may also include status_code (null if no response was received). Gateway decisions and refusals can additionally pass through gateway reason codes, such as no_policy_for_write, monthly_budget_exceeded, group_budget_exceeded and kill_switch_active. Denials include decision: "deny"; approval-required results include decision: "require_approval" and approval_request_id. Transport and admin errors have separate meanings: Authentication errors on the protocol mounts are ordinary JSON with a top-level reason_code when provided, rather than JSON-RPC tool results.

Admin mount

Use POST /mcp/admin with a user session or an unbound API key and the same content and accept headers as /mcp. Agent-bound keys receive HTTP 403 agent_bound_key_forbidden, including for initialize and tools/list. This separate server identifies itself as agent-sentinel-admin. tools/list advertises only platform tools with implemented handlers. Unbound keys can list these tools and call read-only handlers such as list_runs; management handlers such as create_policy require a user session. Unknown and handler-less tools return tool_not_found before the management check (for example, get_policy and create_api_key are not advertised). For example, a user session can send:
Successful admin calls return text containing JSON-serialized handler data and a structuredContent object containing the handler’s success, data, error and metadata, with isError: false. An unbound key calling this management tool instead gets isError: true with structuredContent.reason_code: "user_session_required". These handlers manage platform state; they do not execute registered governed targets through the /mcp lifecycle.

Legacy REST facade

The remaining examples document the legacy /api/v1/mcp/* REST facade, not the JSON-RPC protocol endpoints. Use /mcp for agent-bound governed tool execution and /mcp/admin for protocol-based administration. Agent-bound keys are refused with HTTP 403 agent_bound_key_forbidden on the legacy facade’s execution routes: POST /api/v1/mcp/call, GET /api/v1/mcp/resources/{uri} and POST /api/v1/mcp/prompts/{name}. The discovery listings (GET /api/v1/mcp/tools, /resources and /prompts) still accept them. Use a user session for management operations or an unbound key for permitted read-only operations. The following REST payloads retain their legacy field names and envelopes.

Legacy overview

The REST facade exposes platform functionality as:
  • Tools: Actions LLMs can execute (create policies, approve actions, query data)
  • Resources: Data LLMs can read (runs, approvals, stats, policies)
  • Prompts: Pre-configured workflows (analyze costs, review approvals, generate reports)
This enables LLMs to autonomously manage and monitor the Agent Sentinel platform.

Authentication: management requires a user session

The legacy REST endpoints accept a user session (console login JWT) or an unbound API key, but unbound API keys can only call read-only tools and prompts. An agent must not be able to edit its own governance.
  • Management tools: create_policy, update_policy, delete_policy, approve_action, reject_action, create_api_key, revoke_api_key. Management prompt: create_budget_policy. These require a user session. Any API key, bound to an agent or not, gets 403 with "management operations require a user session, not an API key".
  • Read-only tools and prompts (listing, get_*, stats, compliance, the advisor tools including draft_policy_update, which never applies its draft) stay available to unbound API keys.
  • The rule is default-deny: a tool or prompt that is not explicitly classified read-only is refused to API keys.
  • GET /api/v1/mcp/tools and GET /api/v1/mcp/prompts list everything, with requires_user_session: true on management entries.

Legacy endpoints

List available tools

Returns all available MCP tools with schemas:

Execute MCP tool

Request body:
Response:

List available resources

Returns all available MCP resources:

Get resource data

Example:
Response:

List available prompts

Returns all available prompt templates:

Execute prompt template

Example:
Response:

Using the legacy facade with Claude

Give Claude access to Agent Sentinel via tool use:

Using the legacy facade with OpenAI

Legacy example workflows

Autonomous approval management

Cost optimization analysis

Compliance reporting

Legacy best practices

Use prompts for complex workflows: Prompts encapsulate multi-step operations - use them instead of chaining multiple tool calls.
Secure API tokens: Unbound API keys only reach read-only tools on the legacy facade. Agent-bound keys are refused. Policy, approval and key management needs a user session.
Validate LLM decisions: For critical operations (approvals, policy changes), implement human-in-the-loop confirmation before executing MCP tool calls.
Cache tool schemas: Tool and resource lists change infrequently - cache them to reduce API calls.

See also