Skip to content

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.

bash
kaas serve [-f <config-path>]
FlagDescriptionDefault
-fPath to the TOML config fileetc/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.

bash
kb-ai compile

No 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.

bash
kb-ai fetch-url

No 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.

bash
kb-ai chat

No 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.

bash
kb-ai distill <paths...> [--kb <kb-dir>]
Argument / FlagDescriptionDefault
pathsOne or more files or directories to distill(required)
--kbKnowledge-base directory./.kaas

Example:

bash
kb-ai distill ./notes ./meeting-transcripts --kb ./data

kb-ai mcp

Start the MCP (Model Context Protocol) server, exposing the ask tool for querying the wiki.

bash
kb-ai mcp [--stdio | --http] [--host <host>] [--port <port>] [--kb-dir <path>]
FlagDescriptionDefault
--stdioUse stdio transport (agent spawns the process)(default)
--httpUse streamable-http transport
--hostBind host (HTTP mode only)127.0.0.1
--portBind port (HTTP mode only)8082
--kb-dirOverride the knowledge-base root directoryKAAS_KB_DIR env or ./data

Environment variables:

VariablePurpose
KAAS_KB_DIRKnowledge-base root (fallback when --kb-dir not given)
KAAS_MCP_TOKENBearer token for HTTP transport authentication
LLM_API_KEYLLM provider API key
LLM_BASE_URLLLM provider base URL
LLM_MODELModel to use for chat

Example — Claude Code integration (stdio):

bash
claude mcp add kaas -- kb-ai mcp --kb-dir /path/to/data

kb-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.

bash
kb-ai daemon

Not intended for direct use. The daemon listens for JSON commands on stdin and responds on stdout.