Configuration
Nibchat is configured through environment variables in server/.env and an optional agent.yaml file.
Environment variables
Required
| Variable | Description |
|---|---|
OPENAI_API_KEY | Your API key. When set, it is used for all sessions and cannot be overridden by users. |
Optional — LLM
| Variable | Default | Description |
|---|---|---|
OPENAI_BASE_URL | https://api.openai.com/v1 | Base URL for any OpenAI-compatible API (Groq, Ollama, etc.) |
OPENAI_MODEL | User-selectable | Lock all sessions to a specific model. |
Optional — Built-in tools
| Variable | Description |
|---|---|
TAVILY_API_KEY | Enables the web_search built-in tool. Get a key at tavily.com. |
JINA_API_KEY | Enables the fetch_page built-in tool. Get a key at jina.ai. |
WEB_FETCH_MAX_TOKENS | Max tokens returned by fetch_page (default: 2000). |
Optional — Deployment
| Variable | Default | Description |
|---|---|---|
PORT | 3000 | HTTP port the server listens on. |
PUBLIC_URL | http://localhost:3000 | Base URL used for OAuth redirect URIs. Must match your registered redirect URI. |
AGENT_CONFIG_PATH | ./agent.yaml | Path to the agent configuration file. |
agent.yaml
The agent config file controls the system prompt, MCP server connections, and starter messages shown in the UI.
instructions: |
You are a helpful assistant.
starterMessages:
- "What can you help me with?"
- "Show me what tools you have."
mcpServers:
- url: https://my-mcp-server.example.com
name: myserver
headers:
Authorization: "Bearer my-token"
Fields
| Field | Description |
|---|---|
systemPrompt | System prompt injected before every conversation. |
starterMessages | List of suggested messages shown on the empty chat screen. |
mcpServers | Array of MCP server configurations (see below). |
mcpServer | Legacy single-server shorthand (use mcpServers instead). |
MCP server fields
| Field | Required | Description |
|---|---|---|
url | Yes | Server-sent events endpoint URL. |
name | No | Display name and tool prefix used on collision. Defaults to the hostname. |
headers | No | Static HTTP headers (e.g. Authorization). Bypasses OAuth when set. |
Tool name collisions
If two MCP servers expose a tool with the same name, Nibchat prefixes them as {name}__{toolName} using the name field.
Per-session settings
When OPENAI_API_KEY and OPENAI_MODEL are not set via environment variables, users can configure their own API key and model through the settings modal in the UI. These settings are stored per-session in the database.