Skip to main content

Tool Calls

When you’d rather not wire up your own MCP client, the SDK exposes igris.mcp — a small JSON-RPC client that speaks to the Igris gateway directly. Calls are identity-tagged and audit-logged exactly the same way external MCP clients are, and callTool is policy-evaluated like any other tools/call.

When to use this

Both paths route through the same gateway, hit the same policies, and produce the same audit events.

API

All three accept the same McpConfigOptions:

Quick Start

Every call hits https://api.igrisecurity.com/v1/mcp/<slug> and carries Authorization: Bearer <apiKey>. callTool is policy-evaluated server-side before being forwarded to the upstream MCP server with its real credential injected. initialize and listTools are logged and forwarded without a policy decision.

Threading multiple calls under one trace

If a single user request triggers several tool calls, share the trace id so the audit trail can show the whole chain as one operation:
Both rows in the audit trail will share traceId = "trace-...", which lets you filter the audit trail to the full sequence.

Error handling

The gateway reports a policy denial as a JSON-RPC error inside an HTTP 200 response, not as an HTTP error:
The message is Policy denied: <reason>, where the reason names the matched rule (or “No matching rule (default deny)”). Policies never produce a 429 on MCP calls: rate limits apply to LLM rules only. See Policies. igris.mcp maps responses to the SDK’s typed errors, all subclasses of IgrisError:
igris.mcp does not auto-retry. It makes a single fetch call per request. If you need resilience against transient errors or rate limits, implement your own retry loop with exponential backoff.

What gets logged

Every initialize, listTools, and callTool produces an audit event with:
  • The actor (user, derived from X-Igris-User)
  • The connection slug
  • The tool name and arguments (for callTool) or the MCP method name
  • The policy decision (allow / deny / alert / redact). initialize and listTools are always logged as allow with rule passthrough.
  • Any matched rule
  • The trace id (X-Igris-Trace-Id)
  • All metadata fields (X-Igris-Metadata)
  • The timing and outcome (callTool)
All of this surfaces in the audit trail and is queryable via the audit-events API.
  • Connections — how to register the upstream MCP server and store its credential
  • Identity & Metadata — what the gateway does with user, traceId, and metadata
  • Policies — how to gate tools/call by tool name, user, or metadata
  • MCP Client Config — the alternative path: drive an external MCP client