Configuration#
All settings are read from environment variables or a .env file in the working directory.
Order of precedence#
When the same variable is defined in more than one place, the server resolves it in this order (highest wins):
Constructor arguments (for config-module authors only — not an environment/.env setting) — values passed directly to the
Settings(...)call in a Python config module. Deployers cannot set these; they exist only so a config module can pin a value the environment must not be able to override. If you only edit.env/environment variables, ignore this tier and start at tier 2.Shell environment — variables already exported in the process environment.
.env file — a
.envfile in the working directory, loaded on startup; overridden by the shell environment.Class defaults — the values declared on the
Settingsclass. This includes on-prem overrides made by subclassingSettingsand re-declaring a field (see Custom Search Tools): a subclass default is still a default, so it is the lowest-precedence tier and a value set for the same field in.envor the environment overrides it.
Note
Set each field in one place. If an on-prem subclass overrides a field (e.g. COLLECTIONS), do not also set that field in .env / the environment — the environment value wins and the subclass override is silently ignored. To pin a value the environment must not override, pass it as a constructor argument (tier 1).
For the minimal set of variables needed to get up and running, see the Configure step in the quickstart guide. The sections below document the supported user-configurable variables, grouped by area.
Capability and data-source variables#
There is no single set of variables required by every deployment. Configure only the capabilities
you enable with ONETICK_DB_TOOLS:
Capability |
Required configuration |
|---|---|
Documentation search |
|
Reference data |
|
OneTick data tools |
|
Computation-only custom tools |
Only the configuration used by the custom tool itself. |
The main capability and data-source settings are:
Variable |
Required |
Description |
|---|---|---|
|
for search |
Postgres + pgvector connection string. Not needed when no documentation |
|
for keyed OpenAI embeddings |
API key for an OpenAI-protocol embedding endpoint. Not required when using local embeddings, an endpoint that accepts unauthenticated requests, or only non-embedding tools. See Embeddings below. |
|
for reference data |
Directory of |
|
no |
JSON array of vector collections to index and expose as search tools. Defaults to the OneTick documentation collections. Must be a JSON array, not a plain string: |
|
no |
JSON object declaring config-only (no-code) Markdown collections: |
|
no |
JSON array of custom tool files: |
|
no |
Importable Python module exposing a module-level |
Server variables#
These settings control the shared KX MCP launcher used internally by onetick-mcp. The
KX_MCP_* prefix reflects that implementation detail; continue to start the server with
onetick-mcp.
Variable |
Required |
Description |
|---|---|---|
|
no |
Comma-separated list of tool names to enable (default: all). Every tool (documentation |
|
no |
HTTP bind address (default |
|
no |
|
|
no |
Server instance name (default |
|
no |
Level for the launcher’s own operational/audit log (default |
Embeddings#
The search_* collection tools turn documents (at index-build time) and queries (at serve time) into vectors. Choose the backend with ONETICK_DB_EMBEDDING_TYPE.
Variable |
Required |
Description |
|---|---|---|
|
no |
|
|
no |
Model to embed with (product default |
|
no |
Base URL of an OpenAI-compatible endpoint (self-hosted vLLM / LiteLLM or an internal gateway).
When unset it targets the public OpenAI API. Also used by the optional self-query LLM when
|
|
no |
How embedding inputs are sent: |
|
no |
Provider for an optional LLM-backed collection retriever. Use |
|
no |
Model name used by an optional LLM-backed collection retriever (product default |
Note
Re-run build_index on every affected collection after changing ONETICK_DB_EMBEDDING_MODEL or ONETICK_DB_EMBEDDING_TYPE — see Re-index after changing the model.
Two backends are available:
Local (offline) embeddings — a local
sentence-transformermodel loaded in-process; no OpenAI key, supports fully air-gapped deployments.OpenAI-compatible server — the public OpenAI API, or a self-hosted server that speaks the OpenAI API (Ollama, vLLM, LiteLLM, an internal gateway).
Serving without embeddings#
If you enable only non-embedding tools (ONETICK_DB_TOOLS naming no search_* collection tool — for example only the reference-data tools), the server starts with no OpenAI, HuggingFace, or Postgres configuration — the embedding engine is never built. If a collection search tool is enabled but embeddings are unconfigured, the server fails fast at startup with a message naming what to set (rather than starting and erroring later on the first query).
When a collection search tool is enabled and embeddings are configured, building the retrieval engine (the Postgres connection and embedding model load) is bounded to 120 seconds. An unreachable database or embedding endpoint fails startup with a clear timeout error instead of hanging indefinitely.
Index-build variables#
The index build step (python -m onetick_llmbase.build_index) reads ONETICK_DB_SQL_CONNECTION_STRING, ONETICK_DB_COLLECTIONS, CUSTOM_COLLECTIONS, and OPENAI_API_KEY from Capability and data-source variables above. build_index loads .env from the working directory, so the same embedding configuration (including local and offline settings) applies to indexing and serving alike.
If you are not using OpenAI you can omit OPENAI_API_KEY and use Local (offline) embeddings instead.
To rebuild only some collections without changing ONETICK_DB_COLLECTIONS, pass --only_collections to build_index — it restricts this run to the names you list, without altering the ONETICK_DB_COLLECTIONS setting itself:
python -m onetick_llmbase.build_index -c onetick_mcp.config --only_collections python-docs,cloud
OneTick auth variables (OneTick data tools)#
These variables are required only when the onetick data tools (or a custom tool that runs a OneTick query) is enabled. See OneTick WebAPI authentication for a full explanation of each auth mode.
Variable |
Required |
Description |
|---|---|---|
|
for OneTick data |
|
|
no |
Optional token audience requested when |
|
no |
JSON list of inbound token claims used to identify the caller in tool-call logs and Langfuse;
the first present claim wins. Default: |
|
for OneTick data |
Set |
|
for OneTick data |
WebAPI gateway URL |
|
service_account |
OAuth2 client ID |
|
service_account |
OAuth2 client secret |
|
service_account |
OAuth2 token endpoint |
|
basic mode |
HTTP Basic auth username |
|
basic mode |
HTTP Basic auth password |
|
no |
Tool query timeout in seconds (default |
|
recommended for long-running deployments |
Directory the symbology tool writes generated |
|
no |
Maximum |
|
no |
Number of rows a query tool returns before the result is truncated (default |
Logging variables#
Variable |
Required |
Description |
|---|---|---|
|
no |
Directory for dated log files (default |
|
no |
Log filename prefix (default |
|
no |
Log level (default |
|
no |
Write dated log files (default |
|
no |
Also log to stdout (default |
|
no |
Use UTC for timestamps and daily file rollover (default |
|
no |
Python logging format for the OneTick engine log (default
|
|
no |
Python logging date format for the OneTick engine log (default |
Inbound authentication variables#
Inbound authentication is disabled by default (KX_MCP_AUTH unset). Set KX_MCP_AUTH to an
authenticated mode and supply that mode’s variables below to require a valid bearer token on every
incoming MCP client connection. See MCP server authentication.
Variable |
Required |
Description |
|---|---|---|
|
no |
Inbound auth mode: |
|
for jwks |
The IdP’s JWKS endpoint, used to validate token signatures. |
|
recommended |
Expected |
|
no |
Full OIDC discovery-document URL for |
|
recommended |
Expected |
|
no |
Accepted JWT signing algorithm (default |
|
no |
Scopes the bearer token must carry. Mandatory for |
|
recommended |
This server’s own public URL, as MCP clients connect to it. Enables RFC 9728 discovery so clients can find the IdP and log in themselves for |
|
for oidc_proxy/entra |
The single app pre-registered at the issuer that the server proxies logins through. |
|
no |
In |
|
no |
Whether |
|
for entra |
The Entra tenant GUID. |
|
no |
Application ID URI for |
|
for static |
Inline PEM or a path to one; validates bearers against this key with no IdP involved. |