Environment Variables
Environment variables override stored config and command-line flags follow their own precedence. This page is the source of truth for what the CLI, MCP server, and @opentusk/indexer actually read at runtime.
CLI & MCP server
Section titled “CLI & MCP server”| Variable | Default | Used for |
|---|---|---|
OPENTUSK_API_KEY | — | API key (otk_…) used for all authenticated requests. Required unless a key is stored via opentusk login or opentusk setup. |
OPENTUSK_API_URL | https://api.opentusk.ai | API base URL. Set to http://localhost:8000 for local development. |
OPENTUSK_SUI_PRIVATE_KEY | — | Sui Ed25519 private key (suiprivkey1…) used by the MCP server and CLI to SEAL-encrypt/decrypt shared-vault files. Without it, agents can list shared vaults but can’t read filenames or content. |
OPENTUSK_ENV | production | Selects the Sui / Walrus network. production → Sui mainnet + Walrus mainnet (real WAL tokens). development → Sui testnet + Walrus testnet (free). |
Precedence
Section titled “Precedence”For each variable the runtime resolves the first non-empty value:
- Command-line flag (e.g.
--api-key,--api-url) - Environment variable
- Stored config at
~/.config/opentusk/config.json - Built-in default
Example: opentusk --api-url http://localhost:8000 vault list always wins over OPENTUSK_API_URL in the environment, which always wins over the stored apiUrl.
Local index & search
Section titled “Local index & search”These are only consulted when @opentusk/indexer is installed.
| Variable | Default | Used for |
|---|---|---|
OPENTUSK_INDEX_MODEL | all-MiniLM-L6-v2 | Embedding model key for the local index. Overrides what was chosen during opentusk index setup. Switching models requires opentusk index reset to rebuild. |
OPENTUSK_INDEXER_URL | — | HTTP URL of a running indexer daemon (e.g. http://127.0.0.1:7600). When set, the CLI and MCP server talk to that daemon instead of spawning their own stdio indexer. Useful when sharing one index across multiple agents on the same machine. |
To run the indexer as a daemon:
opentusk-indexer serve --port 7600export OPENTUSK_INDEXER_URL=http://127.0.0.1:7600opentusk search "deployment runbook"In an MCP config
Section titled “In an MCP config”When you run opentusk mcp install-config, these variables are written into the agent’s MCP config file (e.g. .mcp.json, claude_desktop_config.json, ~/.cursor/mcp.json):
{ "mcpServers": { "opentusk": { "command": "/usr/local/bin/opentusk", "args": ["mcp", "serve"], "env": { "OPENTUSK_API_KEY": "otk_…", "OPENTUSK_SUI_PRIVATE_KEY": "suiprivkey1…" } } }}OPENTUSK_API_URL is only embedded if you passed --api-url to install-config (otherwise the agent picks up the default). OPENTUSK_SUI_PRIVATE_KEY is only embedded if a key was stored or passed via --sui-priv-key.