Skip to main content

Igris SDK

The Igris SDK (@igris-security/sdk) is a TypeScript client for the Igris governance gateway. It generates MCP client configurations, calls MCP tools programmatically, and provides a native OpenAI-compatible interface for the LLM gateway.

Installation

Initialize

The baseUrl option can also be set via the IGRIS_BASE_URL environment variable.
Never commit your API key to source control. Use environment variables:

Get Your API Key

  1. Log in to the Igris Dashboard
  2. Go to Settings → API Keys
  3. Click Generate API Key
  4. Copy the key — it’s shown only once

MCP Connections

igris.connectHttp(slug, options?)

Generate an HTTP connection config for any external MCP client.
Pass the result to any MCP client:
Return type:

Identity & Metadata

Pass user identity and freeform metadata with every MCP or LLM request. Igris uses this for policy evaluation, audit trails, and trace correlation.

How It Works

The SDK translates identity options into HTTP headers: All fields are optional. If omitted, the gateway still works — just without identity-based policies or user-level audit.

Trace IDs

Trace IDs group multiple tool calls from a single user request:
Auto-generation: If you don’t pass a traceId, the SDK generates one automatically (ig_trace_ + random hex). Each connectHttp() call gets its own trace ID.

Metadata for Policies

Metadata enables attribute-based access control:
Then write policies that match on these fields:
Condition operators: If a policy condition references a field that is absent from the request, the rule is skipped — not denied. Metadata limits:
User-based policies are advisory, not security boundaries. Any holder of an API key can set any X-Igris-User value. The API key is the real trust anchor.

LLM Gateway

igris.chat.completions.create(request)

Send a chat completion through the Igris LLM gateway. The model field must use @slug/model syntax. Non-streaming:
Streaming:

igris.embeddings.create(request)

igris.llmProviders.list()

Fetch all registered LLM provider slugs and metadata:

igris.connectLlm(slug, options?)

Build an LlmConnection for use with any OpenAI-compatible SDK client:

LLM Types

ChatMessage

ChatCompletionUsage

ChatCompletionResponse

ChatCompletionChunk (streaming)


Subpath Adapters

Zero-migration integration with existing SDK clients. All adapters are exported from @igris-security/sdk/adapters/{openai,anthropic,google}.

OpenAI adapter

Anthropic adapter

Google adapter (stub)

Google’s SDK does not expose a unified baseURL override. The Google adapter returns the LlmConnection config for manual use.

Typed Errors

All SDK methods throw typed errors on non-2xx responses:
Error class hierarchy:

Environment Variables

Tool Calls

Call MCP tools programmatically with igris.mcp.

Connections

Create and manage encrypted credential vaults.

MCP Client Config

Generate configs for Claude Desktop, Cursor, and more.

API Reference

REST API endpoints for all Igris resources.