Architecture
Igris is a monorepo with two primary services, a shared database, and a Redis cache layer.System Overview
Components
API Server (Hono)
The backend runs on Hono and listens on port 3100. It handles:- Proxy routes (
/proxy/:serverId) — intercept MCP tool calls, evaluate policies, forward to upstream - REST API (
/api/v1/*) — CRUD for policies, servers, sessions, audit events, compliance, billing - Auth (
/api/auth/*) — Better Auth endpoints for session management - SSE (
/api/v1/events) — real-time event stream for dashboard updates - Ingestion (
/api/v1/ingest/*) — webhook receivers for external log providers
Web Frontend (Next.js)
The dashboard runs on Next.js on port 3200 and provides:- Governance management (servers, policies, sessions)
- Real-time observe dashboard with risk heat maps
- Compliance artifact generation and download
- Organization settings, member management, billing
Database (Neon PostgreSQL)
All persistent state lives in Neon PostgreSQL. The schema is managed by Drizzle ORM with auto-migrations on startup. Key tables:| Table | Purpose |
|---|---|
user, account, session | Better Auth identity |
organization, member | Multi-tenancy |
mcp_servers | Registered MCP server configs |
policies | Governance rules per server |
agent_sessions | Active proxy sessions |
audit_events | Unified audit trail (proxy + ingested) |
baa | HIPAA BAA records |
ai_systems | EU AI Act system registry |
Cache (Upstash Redis)
Upstash Redis handles:- Policy cache — hot policies cached with TTL to avoid DB lookups on every tool call
- Rate limiting — sliding window counters for rate-limit policy rules
- SSE pub/sub — event fan-out to connected dashboard clients
- Session state — fast lookup for kill-switch status
Authentication (Better Auth)
Better Auth provides:- Email/password and OAuth (GitHub, Google) login
- Organization-scoped sessions with RBAC
- API key generation for programmatic access (proxy, ingestion)
- Session tokens stored as
igris.session_tokencookies
Proxy Flow
When an MCP client calls a tool through the Igris proxy:- Request arrives at
/proxy/:serverIdwith the tool name and arguments - Auth check — validate API key or session cookie
- Org resolution — determine which organization owns this server
- Policy evaluation — load rules from cache (or DB on cache miss), evaluate first-match against the tool name
- Action execution:
- allow → forward to upstream, log the event
- deny → return error to client, log the denial
- alert → forward to upstream, log + emit anomaly event via SSE
- Anomaly check — evaluate rate spike and destructive pattern detectors
- Audit write — persist the event to
audit_eventswith timing, result, and metadata - SSE broadcast — push real-time event to connected dashboard clients
Deployment
Igris is designed to deploy on Fly.io with:- Single Dockerfile for the API server
- Separate Fly app for the Next.js frontend (or Vercel)
- Neon for managed PostgreSQL (serverless, auto-scaling)
- Upstash for managed Redis (serverless, per-request pricing)