Hi! 👋 We are doing a big documentation refresh. Help us improve — what's missing or could be better? Let us know! Simply send an email or start a conversation in Google Groups!

MCP and GenAI Variables

Info

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

VariableDefaultAccepted values
mcp-enabledfalseBoolean
mcp-port6071Integer 1–65535
mcp-use_ssltrueBoolean
mcp-timeout_ms30000Integer 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_rows200Integer 1–1000
mcp-stats_show_processlist_max_rows200Integer 1–1000
mcp-stats_enable_debug_toolsfalseBoolean

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.

Caution

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

VariableEndpoint
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

VariableDefaultAccepted valuesReleased runtime behavior
genai-threads4Integer 1–256Worker threads created when the handler starts or reloads.
genai-embedding_urihttp://127.0.0.1:8013/embeddingAny stringlibcurl endpoint for embedding requests; transport failures surface at request time.
genai-embedding_model""Any stringSent as the embedding request’s model field.
genai-rerank_urihttp://127.0.0.1:8012/rerankAny stringlibcurl endpoint for reranking requests.
genai-embedding_timeout_ms30000Integer 100–300000 msEnforced as the libcurl embedding-request timeout.
genai-rerank_timeout_ms30000Integer 100–300000 msEnforced as the libcurl reranking-request timeout.

AI and LLM controls

VariableDefaultAccepted valuesReleased runtime behavior
genai-enabledfalseExact true; other strings become falseMaster gate for the AI manager and query hook. False closes the vector store and LLM bridge.
genai-llm_enabledfalseExact true; other strings become falseInitializes the LLM bridge only when the master gate is also true.
genai-anomaly_enabledfalseExact true; other strings become falseGates the MySQL and PostgreSQL query-hook adapter.
genai-llm_provideropenaiAny stringopenai and anthropic are executable; other values fail requests as an unknown provider.
genai-llm_provider_urlhttp://localhost:11434/v1/chat/completionsAny stringProvider request URL; invalid/unreachable URLs fail at request time.
genai-llm_provider_modelllama3.2Any stringModel identifier sent to the configured provider.
genai-llm_provider_key""Any stringProvider credential copied into runtime memory; protect Admin access and proxysql.db.
genai-llm_cache_similarity_threshold85Integer 0–100 percentMinimum semantic similarity for an LLM cache hit.
genai-llm_cache_enabledInternal default trueNot settable in v4.0.10The 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_ms30000Integer 1000–600000 msPassed to the provider client’s libcurl request timeout.

Anomaly-policy and routing placeholders

VariableDefaultAccepted valuesReleased runtime behavior
genai-anomaly_risk_threshold70Integer 0–100Stored and reported, but not copied into the released anomaly detector. The detector keeps its built-in value 70.
genai-anomaly_similarity_threshold80Integer 0–100Stored and reported, but not copied into the detector, whose built-in similarity threshold is 85.
genai-anomaly_rate_limit100Integer 1–10000Stored and reported, but the detector retains its built-in 100-queries-per-minute limit.
genai-anomaly_auto_blocktrueExact true; other strings become falseStored and reported, but the detector retains its built-in true setting.
genai-anomaly_log_onlyfalseExact true; other strings become falseStored and reported, but the released detector does not consume this variable.
genai-prefer_local_modelstrueExact true; other strings become falseStored and reported; no v4.0.10 model-selection path reads it.
genai-daily_budget_usd10.00Number 0–10000Stored and reported; v4.0.10 does not enforce the budget. Nonnumeric text becomes accepted zero.
genai-max_cloud_requests_per_hour100Integer 0–100000Stored 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

VariableDefaultAccepted valuesReleased runtime behavior
genai-vector_db_path/var/lib/proxysql/ai_features.dbAny stringOpened when the AI manager initializes; open/schema failures make the runtime load fail.
genai-vector_dimension1536Integer 1–100000Embedding dimension used while creating vector-storage structures.
genai-rag_enabledfalseExact true or 1; other strings become falseStored and reported but not consulted by the v4.0.10 /mcp/rag registration path.
genai-rag_k_max50Integer 1–1000Enforced maximum k by the RAG tool handler.
genai-rag_candidates_max500Integer 1–5000Enforced maximum candidate count for hybrid search.
genai-rag_query_max_bytes8192Integer 1–1000000 bytesEnforced query-size cap in the RAG handler.
genai-rag_response_max_bytes5000000Integer 1–10000000 bytesCopied into the RAG handler, but no v4.0.10 response-building path reads or enforces it.
genai-rag_timeout_ms2000Integer 1–60000 msCopied 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.