CLI Commands
KaaS provides two command-line programs: kaas (Go backend) and kb-ai (Python AI engine).
kaas
kaas serve
Start the KaaS backend server. The server exposes the REST API, Web UI, worker pool, and (optionally) the MCP endpoint.
kaas serve [-f <config-path>]| Flag | Description | Default |
|---|---|---|
-f | Path to the TOML config file | etc/kaas.toml |
The server listens on the address specified in the config ([server] addr), defaulting to 0.0.0.0:8080.
Environment variable overrides — see Environment Variables for the full list (LLM_API_KEY, LLM_BASE_URL, LLM_MODEL, etc.).
kb-ai
The Python AI engine. Typically managed by the Go backend as a daemon, but can also be used standalone.
kb-ai compile
Run the 4-phase compilation pipeline (Extract → Classify → Write → Index) on queued raw content. This is an internal command invoked by the Go worker; it reads a JSON request from stdin and writes a JSON response to stdout.
kb-ai compileNo flags — input is passed via the daemon bridge protocol (stdin JSON).
kb-ai fetch-url
Fetch the content of a URL, extract readable text, and return it as structured data. Used by the backend when a user submits a URL for compilation.
kb-ai fetch-urlNo flags — input is passed via the daemon bridge protocol (stdin JSON).
kb-ai chat
Handle a chat request against the compiled wiki. Performs LLM-iterative retrieval over the knowledge base and streams a cited answer. Internal command invoked by the Go backend's chat endpoint.
kb-ai chatNo flags — input is passed via the daemon bridge protocol (stdin JSON).
kb-ai distill
Run the full distillation pipeline on local files or directories: ingest text content into the knowledge base's raw/ folder, then compile it into wiki articles.
kb-ai distill <paths...> [--kb <kb-dir>]| Argument / Flag | Description | Default |
|---|---|---|
paths | One or more files or directories to distill | (required) |
--kb | Knowledge-base directory | ./.kaas |
Example:
kb-ai distill ./notes ./meeting-transcripts --kb ./datakb-ai mcp
Start the MCP (Model Context Protocol) server, exposing the ask tool for querying the wiki.
kb-ai mcp [--stdio | --http] [--host <host>] [--port <port>] [--kb-dir <path>]| Flag | Description | Default |
|---|---|---|
--stdio | Use stdio transport (agent spawns the process) | (default) |
--http | Use streamable-http transport | — |
--host | Bind host (HTTP mode only) | 127.0.0.1 |
--port | Bind port (HTTP mode only) | 8082 |
--kb-dir | Override the knowledge-base root directory | KAAS_KB_DIR env or ./data |
Environment variables:
| Variable | Purpose |
|---|---|
KAAS_KB_DIR | Knowledge-base root (fallback when --kb-dir not given) |
KAAS_MCP_TOKEN | Bearer token for HTTP transport authentication |
LLM_API_KEY | LLM provider API key |
LLM_BASE_URL | LLM provider base URL |
LLM_MODEL | Model to use for chat |
Example — Claude Code integration (stdio):
claude mcp add kaas -- kb-ai mcp --kb-dir /path/to/datakb-ai daemon
Start the AI engine as a long-running daemon process. This is an internal command — the Go backend spawns it automatically and communicates over a multiplexed stdin/stdout protocol.
kb-ai daemonNot intended for direct use. The daemon listens for JSON commands on stdin and responds on stdout.