Skip to content

Configuration ​

dbask reads .env in the current working directory plus the process environment. The repository's .env.example is a full template. The setup wizard (dbask init) writes the file for you.

Values in the process environment are used as given. The list below is checked against the configuration code, so every variable the code reads is documented here.

AI provider ​

VariablePurposeDefault
AI_PROVIDEROne of openrouter, google, groq, cerebras, ollama, deepseek.openrouter
AI_MODELExact model ID accepted by the provider.required
OPENROUTER_API_KEYOpenRouter credential.none
GOOGLE_GENERATIVE_AI_API_KEYGoogle Gemini credential.none
GROQ_API_KEYGroq credential.none
CEREBRAS_API_KEYCerebras credential.none
DEEPSEEK_API_KEYDeepSeek credential.none
OLLAMA_BASE_URLOllama endpoint.http://localhost:11434/v1
AI_SITE_URLOptional OpenRouter app URL metadata.none
AI_SITE_NAMEOptional OpenRouter app name metadata.dbask

Only the key for the selected provider is needed. See AI providers.

Database ​

VariablePurposeDefault
DB_DRIVERmysql (also MariaDB) or postgres.mysql
DB_HOSTHostname or IP.127.0.0.1
DB_PORTPort. Empty means the driver default.3306 for mysql, 5432 for postgres
DB_SSLdisable; require (encrypt, do not verify the certificate); or verify-full (encrypt and verify; set NODE_EXTRA_CA_CERTS for a private CA).disable
DB_NAMEDatabase name.required
DB_USERUsername. Use a restricted read-only account.required
DB_PASSWORDPassword. Set it privately.required

See Databases.

Limits ​

VariablePurposeDefault
SQL_MAX_ROWSMaximum rows returned per query.500
SQL_QUERY_TIMEOUT_MSPer-query timeout in milliseconds. The query is cancelled on the server.10000
SQL_MAX_RESULT_BYTESMaximum result payload size in bytes.1048576
AGENT_MAX_STEPSMaximum agent loop steps (1 to 20).8
AGENT_QUERY_PLANon requires a schema-checked query plan before SQL runs; off skips it.off
SCHEMA_CACHE_TTL_MSSchema cache lifetime in milliseconds.300000 (5 minutes)

Start from the .env.example values and tune against your own database. Higher limits increase both resource use and the amount of data exposed to the model.

MCP server ​

VariablePurposeDefault
DBASK_MCP_CONTEXTon offers dbask.md to the connected MCP client as the get_business_context tool. It is sent to whichever AI app connects, so it is off by default.off

dbask mcp reads only the database and limits settings (SQL_* and SCHEMA_CACHE_TTL_MS), and needs no AI provider. See MCP server.

Terminal and diagnostics ​

VariablePurposeDefault
NO_COLORSet to 1 to turn terminal colors off.unset
FORCE_COLORSet to 1 to keep colors when output is piped.unset
SQL_AI_TRACE_JSONSet to 1 to print a machine-readable trace line for the eval runner. Not needed for normal use.unset

Released under the ISC License.