Skip to Content
Kai

Configuration

Every environment variable Kai reads, with its default.

Kai is configured only through the environment. There is no admin page; each workspace manages its own keys, tools and members in the app. .env.example lists the same variables with comments.

Required

Variable
KAI_APP_URLThe URL people open, like https://kai.example.com. Sign-in, OAuth redirects and invitation links use it. Default http://localhost:3000.
KAI_AUTH_SECRETSigns sessions. openssl rand -hex 32.
KAI_ENCRYPTION_KEY32 bytes as hex (openssl rand -hex 32). Encrypts every stored API key, header value and OAuth token. Back it up with the database; without it they can't be read.

Accounts and workspaces

VariableDefault
KAI_SIGNUP_MODEinviteinvite: only people with a pending invitation can sign up. open: anyone. closed: nobody. The first account on an empty instance, and KAI_ROOT_EMAIL, can always sign up.
KAI_ROOT_EMAILThe root user: can always sign up.
KAI_WORKSPACE_CREATIONeveryoneeveryone, or root (only KAI_ROOT_EMAIL can create workspaces).
KAI_MEMBER_AGENTStrueWhether members (not only owners and admins) can create their own agents.
GOOGLE_CLIENT_ID, GOOGLE_CLIENT_SECRETSign in with Google. Redirect URI: <KAI_APP_URL>/api/auth/callback/google.

Email

VariableDefault
KAI_EMAIL_ADAPTERlocallocal prints every email (verification codes included) to the server log. resend sends through Resend.
RESEND_API_KEYRequired for resend.
KAI_EMAIL_FROMKai <no-reply@localhost>The sender. With Resend, its domain must be verified there.

See Email.

Network and tools

VariableDefault
KAI_ALLOW_PRIVATE_NETWORKfalseLets workspace admins point keys and MCP servers at private, loopback and link-local addresses (per key or server, with a switch).
KAI_ALLOW_STDIO_MCPfalseLets workspace admins add stdio MCP servers, which run commands on the Kai host with no sandbox.
KAI_ENV_*Values that MCP server settings can read with {{kai.env.KAI_ENV_<NAME>}}, like a directory for the Filesystem server or a shared token. Only names starting with KAI_ENV_ are readable.
KAI_LIBRARY_URLThe library service, for the MCP catalog and model data. Unset hides the library.
KAI_LIBRARY_PUBLIC_URLKAI_LIBRARY_URLWhere browsers load library icons from, when that differs (in Compose, the server uses http://library:4100).

Postgres

VariableDefault
POSTGRES_HOSTlocalhost
POSTGRES_PORT5432
POSTGRES_DATABASEkai
POSTGRES_USER, POSTGRES_PASSWORDA superuser, used only by migrate to create roles and apply migrations.
POSTGRES_APP_USER, POSTGRES_APP_PASSWORDkai_appWorkspace data, always under row-level security.
POSTGRES_AUTH_USER, POSTGRES_AUTH_PASSWORDkai_authAccounts and sessions.
POSTGRES_SERVICE_USER, POSTGRES_SERVICE_PASSWORDkai_serviceBackground work that spans workspaces (the run manager, caches).
DATABASE_URLUsed by migrate instead of the POSTGRES_* superuser settings, when set.

Redis

VariableDefault
REDIS_URLredis://localhost:6379

Object storage

VariableDefault
S3_ENDPOINTThe S3 API endpoint, as the server reaches it. Leave unset for AWS S3.
S3_PUBLIC_ENDPOINTS3_ENDPOINTThe endpoint browsers use for uploads and downloads (presigned URLs).
S3_REGIONus-east-1
S3_BUCKETkai
S3_ACCESS_KEY_ID, S3_SECRET_ACCESS_KEY
S3_FORCE_PATH_STYLEfalsetrue for MinIO, SeaweedFS and most self-hosted stores.

Server

VariableDefault
PORT3000
HOST0.0.0.0
KAI_WEB_DIRThe built web app to serve. Set in the image (/app/web); unset in development, where Vite serves it.
KAI_MIGRATIONS_DIRThe SQL migrations, for node server.mjs migrate. Set in the image.
NODE_ENVdevelopmentproduction in the image.

Development only

VariableDefault
KAI_API_PORT3001The API's port next to the Vite dev server.
KAI_WEB_PORT3000The Vite dev server's port. Set KAI_APP_URL to it.
KAI_API_URLhttp://localhost:<KAI_API_PORT>Where Vite forwards /api.

On this page