MCP and GenAI Variables
Changes in main.global_variables must be loaded with LOAD MCP VARIABLES TO RUNTIME. Persist them with SAVE MCP VARIABLES TO DISK; see Admin Commands.
Variable Inventory
| Variable | Default | Accepted values |
|---|---|---|
mcp-enabled | false | Boolean |
mcp-port | 6071 | Integer 1–65535 |
mcp-use_ssl | true | Boolean |
mcp-timeout_ms | 30000 | Integer greater than or equal to 0 |
mcp-config_endpoint_auth | "" | String |
mcp-stats_endpoint_auth | "" | String |
mcp-query_endpoint_auth | "" | String |
mcp-admin_endpoint_auth | "" | String |
mcp-cache_endpoint_auth | "" | String |
mcp-ai_endpoint_auth | "" | String |
mcp-rag_endpoint_auth | "" | String |
mcp-stats_show_queries_max_rows | 200 | Integer 1–1000 |
mcp-stats_show_processlist_max_rows | 200 | Integer 1–1000 |
mcp-stats_enable_debug_tools | false | Boolean |
Numeric values outside these released-handler ranges are rejected rather than clamped when the variable is set. Tool handlers can impose their own additional effective limits.
Server Variables
mcp-enabled
Master switch for the MCP listener. The accepted Boolean spellings in the released handler are true/1 and false/0 (case-insensitive for the words).
mcp-port
TCP port for the MCP HTTP/HTTPS listener. The released handler accepts 1 through 65535; the default is 6071.
mcp-use_ssl
Controls HTTP versus HTTPS. It defaults to true. In TLS mode the MCP server uses ProxySQL’s loaded key and certificate and cannot start if they are unavailable. Setting it to false exposes bearer tokens and tool data over unencrypted HTTP unless another trusted TLS terminator protects the connection.
mcp-timeout_ms
Runtime timeout setting, default 30000 milliseconds. The v4.0.10 variable handler accepts every non-negative integer, including zero, and rejects negative values.
The released setter uses integer conversion that turns non-numeric text into zero, which is then accepted. Use canonical decimal integer text and verify the runtime value after loading.
In the released v4.0.10 endpoint and Stats handler code, mcp-timeout_ms is stored and reported but is not
consulted as an enforced request wall-clock deadline. Target-profile timeout and row-limit fields are also
metadata-only in this release. Use enforced MCP query-rule limits where applicable, least-privilege backend
accounts and database-side controls, and external client/network deadlines.
MCP Endpoint Authentication
| Variable | Endpoint |
|---|---|
mcp-config_endpoint_auth | /mcp/config |
mcp-stats_endpoint_auth | /mcp/stats |
mcp-query_endpoint_auth | /mcp/query |
mcp-admin_endpoint_auth | /mcp/admin |
mcp-cache_endpoint_auth | /mcp/cache |
mcp-ai_endpoint_auth | /mcp/ai |
mcp-rag_endpoint_auth | /mcp/rag |
Each variable is the Bearer token for exactly one endpoint. All default to the empty string.
An empty token does not make an endpoint public. In v4.0.10 it disables access: the resource rejects every POST request with HTTP 401 until its variable contains a non-empty value. This fail-closed behavior is important because Query, Config, Stats, RAG, and other endpoint tools can read sensitive state or mutate data.
Use distinct high-entropy tokens, send them in the Authorization header, rotate them through main.global_variables, and protect access to the Admin interface. The server also accepts a token URL query argument as a fallback, but URLs can leak into logs and history.
Example:
UPDATE global_variables
SET variable_value = 'replace-with-a-long-random-token'
WHERE variable_name = 'mcp-stats_endpoint_auth';
LOAD MCP VARIABLES TO RUNTIME;
SAVE MCP VARIABLES TO DISK;
Stats Safety Variables
mcp-stats_show_queries_max_rows
Configurable page/window cap for /mcp/stats show_queries. It defaults to 200 and accepts 1–1000. The handler also has an independent hard maximum of 1000. It reports the requested limit/offset, effective limit, and effective cap in the result.
mcp-stats_show_processlist_max_rows
Configurable returned-row cap for /mcp/stats show_processlist. It defaults to 200 and accepts 1–1000. The handler also hard-caps the effective value at 1000 and reports requested/effective pagination metadata.
mcp-stats_enable_debug_tools
Enables debug-oriented Stats tools. The default is false. In v4.0.10 it gates show_free_connections, which exposes individual pooled connections and protocol/session metadata and has no per-call row cap. Enable it only for controlled diagnostics, then disable it again.
UPDATE global_variables
SET variable_value = 'true'
WHERE variable_name = 'mcp-stats_enable_debug_tools';
LOAD MCP VARIABLES TO RUNTIME;
Backend hosts, protocols, credentials, schemas, and target policy metadata are not configured through legacy mcp-mysql_* global variables in v4.0.10. Use the server-side mcp_auth_profiles and mcp_target_profiles tables and load both atomically with LOAD MCP PROFILES TO RUNTIME; see that reference for v4.0.10 TLS and policy-field enforcement caveats.
GenAI Variables
These 32 genai-* names are the complete public GenAI registry in v4.0.10. Update their rows in
main.global_variables, run LOAD GENAI VARIABLES TO RUNTIME, and, after validating and correcting the memory
rows, persist them with SAVE GENAI VARIABLES TO DISK. A runtime load restarts the GenAI worker handler and
rebuilds the vector-store and LLM components, so in-flight AI work can be interrupted. The variables are
available only with the GenAI plugin in the AI/MCP v4.0.10 tier; Stable v3.0.10 and Innovation v3.1.10 do not
expose this plugin-owned variable family at runtime.
The setter parses integers with atoi and the budget with atof: nonnumeric text becomes zero. Zero is accepted
only where the table’s range includes it. Otherwise the setter logs an error, ignores that runtime assignment,
and retains the current runtime value. The loader does not propagate that setter failure, so LOAD can still
return OK while the invalid text remains in main.global_variables; a later SAVE GENAI VARIABLES TO DISK
can persist it. Except for genai-rag_enabled, Boolean setters store true only for the exact lowercase text
true and store false for every other non-null string. genai-rag_enabled also treats 1 as true. Use
canonical values, inspect runtime_global_variables after every load, and correct the memory row before SAVE.
Worker, embedding, and reranking
| Variable | Default | Accepted values | Released runtime behavior |
|---|---|---|---|
genai-threads | 4 | Integer 1–256 | Worker threads created when the handler starts or reloads. |
genai-embedding_uri | http://127.0.0.1:8013/embedding | Any string | libcurl endpoint for embedding requests; transport failures surface at request time. |
genai-embedding_model | "" | Any string | Sent as the embedding request’s model field. |
genai-rerank_uri | http://127.0.0.1:8012/rerank | Any string | libcurl endpoint for reranking requests. |
genai-embedding_timeout_ms | 30000 | Integer 100–300000 ms | Enforced as the libcurl embedding-request timeout. |
genai-rerank_timeout_ms | 30000 | Integer 100–300000 ms | Enforced as the libcurl reranking-request timeout. |
AI and LLM controls
| Variable | Default | Accepted values | Released runtime behavior |
|---|---|---|---|
genai-enabled | false | Exact true; other strings become false | Master gate for the AI manager and query hook. False closes the vector store and LLM bridge. |
genai-llm_enabled | false | Exact true; other strings become false | Initializes the LLM bridge only when the master gate is also true. |
genai-anomaly_enabled | false | Exact true; other strings become false | Gates the MySQL and PostgreSQL query-hook adapter. |
genai-llm_provider | openai | Any string | openai and anthropic are executable; other values fail requests as an unknown provider. |
genai-llm_provider_url | http://localhost:11434/v1/chat/completions | Any string | Provider request URL; invalid/unreachable URLs fail at request time. |
genai-llm_provider_model | llama3.2 | Any string | Model identifier sent to the configured provider. |
genai-llm_provider_key | "" | Any string | Provider credential copied into runtime memory; protect Admin access and proxysql.db. |
genai-llm_cache_similarity_threshold | 85 | Integer 0–100 percent | Minimum semantic similarity for an LLM cache hit. |
genai-llm_cache_enabled | Internal default true | Not settable in v4.0.10 | The name is registered and the default is consumed by the LLM bridge, but the released getter/setter omit it. LOAD ignores its row and SAVE writes an empty value instead of reporting the active true default. |
genai-llm_timeout_ms | 30000 | Integer 1000–600000 ms | Passed to the provider client’s libcurl request timeout. |
Anomaly-policy and routing placeholders
| Variable | Default | Accepted values | Released runtime behavior |
|---|---|---|---|
genai-anomaly_risk_threshold | 70 | Integer 0–100 | Stored and reported, but not copied into the released anomaly detector. The detector keeps its built-in value 70. |
genai-anomaly_similarity_threshold | 80 | Integer 0–100 | Stored and reported, but not copied into the detector, whose built-in similarity threshold is 85. |
genai-anomaly_rate_limit | 100 | Integer 1–10000 | Stored and reported, but the detector retains its built-in 100-queries-per-minute limit. |
genai-anomaly_auto_block | true | Exact true; other strings become false | Stored and reported, but the detector retains its built-in true setting. |
genai-anomaly_log_only | false | Exact true; other strings become false | Stored and reported, but the released detector does not consume this variable. |
genai-prefer_local_models | true | Exact true; other strings become false | Stored and reported; no v4.0.10 model-selection path reads it. |
genai-daily_budget_usd | 10.00 | Number 0–10000 | Stored and reported; v4.0.10 does not enforce the budget. Nonnumeric text becomes accepted zero. |
genai-max_cloud_requests_per_hour | 100 | Integer 0–100000 | Stored and reported; v4.0.10 does not enforce this limit. Nonnumeric text becomes accepted zero. |
Do not treat the stored anomaly, routing, or budget settings as security controls in v4.0.10. The released
detector uses its own constructed policy values instead of these documented policy variables. When the GenAI
plugin is running and both genai-enabled and genai-anomaly_enabled are true, eligible MySQL and PostgreSQL
queries are inspected through the registered plugin hooks. The released detector can block a query; the core
then returns a protocol-appropriate error to the client instead of routing it to a backend.
Vector storage and RAG
| Variable | Default | Accepted values | Released runtime behavior |
|---|---|---|---|
genai-vector_db_path | /var/lib/proxysql/ai_features.db | Any string | Opened when the AI manager initializes; open/schema failures make the runtime load fail. |
genai-vector_dimension | 1536 | Integer 1–100000 | Embedding dimension used while creating vector-storage structures. |
genai-rag_enabled | false | Exact true or 1; other strings become false | Stored and reported but not consulted by the v4.0.10 /mcp/rag registration path. |
genai-rag_k_max | 50 | Integer 1–1000 | Enforced maximum k by the RAG tool handler. |
genai-rag_candidates_max | 500 | Integer 1–5000 | Enforced maximum candidate count for hybrid search. |
genai-rag_query_max_bytes | 8192 | Integer 1–1000000 bytes | Enforced query-size cap in the RAG handler. |
genai-rag_response_max_bytes | 5000000 | Integer 1–10000000 bytes | Copied into the RAG handler, but no v4.0.10 response-building path reads or enforces it. |
genai-rag_timeout_ms | 2000 | Integer 1–60000 ms | Copied into the RAG handler, but no v4.0.10 operation path reads or enforces it. |
genai-rag_enabled=false does not disable /mcp/rag in this release. Control access with
mcp-rag_endpoint_auth, the MCP listener gate, and network policy; see
MCP endpoints and RAG.