tokenlite-mysql-mcp
Server Configuration
Describes the environment variables required to run the server.
| Name | Required | Description | Default |
|---|---|---|---|
| DB_HOST | No | MySQL Host address | localhost |
| DB_NAME | Yes | MySQL Database name (required) | |
| DB_PORT | No | MySQL Port | 3306 |
| DB_USER | No | MySQL Username | root |
| DB_PASSWORD | No | MySQL Password | |
| TOOL_PREFIX | No | Prefix for tool names | |
| MCP_LOG_LEVEL | No | Minimum severity for MCP log notifications | info |
| MCP_DDL_CACHE_TTL | No | Time-to-live (in seconds) for cached DDL statements | 60 |
| MCP_METADATA_PATH | No | Absolute path to your custom metadata.json dictionary | |
| MYSQL_QUEUE_LIMIT | No | Max queued requests when all pool connections are busy | 50 |
| MCP_TEMPLATES_PATH | No | Absolute path to your custom templates.json queries | |
| ALLOW_DDL_OPERATION | No | Enable Data Definition Language (CREATE, ALTER, DROP, RENAME) | false |
| MYSQL_QUERY_TIMEOUT | No | Max execution time for a query (in ms) | 15000 |
| MYSQL_RETRY_ATTEMPTS | No | Max retries on transient connection errors | 3 |
| MYSQL_RETRY_DELAY_MS | No | Base delay (ms) for exponential backoff between retries | 1000 |
| MYSQL_CONNECT_TIMEOUT | No | Max time to wait for a socket to establish (in ms) | 10000 |
| ALLOW_DELETE_OPERATION | No | Enable DELETE and TRUNCATE queries | false |
| ALLOW_INSERT_OPERATION | No | Enable INSERT and REPLACE queries | false |
| ALLOW_UPDATE_OPERATION | No | Enable UPDATE queries | false |
| MYSQL_CONNECTION_LIMIT | No | Max concurrent pool connections | 10 |
| MCP_SAFE_QUERY_MAX_ROWS | No | Threshold for EXPLAIN to block unindexed Full Table Scans | 1000 |
| MCP_SAFE_QUERY_ENABLE_BLOCKING | No | Enable or disable the EXPLAIN guardrail | true |
Instructions
Guidance the server publishes about itself, which clients place ahead of the tool catalog so the model reads it before choosing anything.
This server publishes no instructions, or was last inspected before Glama recorded them.
Capabilities
Features and capabilities supported by this server
Protocol revision2025-11-25
| Capability | Details |
|---|---|
| tools | {
"listChanged": true
} |
| logging | {} |
| prompts | {
"listChanged": true
} |
| resources | {
"subscribe": true,
"listChanged": true
} |
| completions | {} |
Tools
Functions exposed to the LLM to take actions
| Name | Description |
|---|---|
| mydatabase_search_schemaA | CRITICAL TOOL FOR SCHEMA EXPLORATION: Use this FIRST before writing queries. Fuzzy-searches a table name and returns its DDL plus direct parent/child table DDLs (Auto-Join Context), inferred FK hints, and semantic dictionary entries from metadata.json when configured. If templates.json is loaded, reminds you to use the 'query_templates' prompt for business metrics. Do NOT use execute_safe_query for schema exploration. |
| mydatabase_execute_safe_queryA | Executes SQL against the database with AST validation. SELECT results are capped by MCP_QUERY_ROW_LIMIT (default 500, AST-injected LIMIT) and include a '-- rows: N (truncated at LIMIT X)' footer when the cap is reached. Unindexed full table scans above MCP_EXPLAIN_MAX_SCAN_ROWS are blocked before execution. Only the configured schema is reachable: SHOW statements, information_schema/mysql/performance_schema/sys, other schemas, server variables, SELECT ... INTO and functions such as LOAD_FILE or SLEEP are rejected by the server. To explore the schema use 'search_schema'. |
| mydatabase_refresh_schemaA | Rebuilds the internal Schema Graph from the live database and notifies subscribed MCP resources. Use when search_schema or execute_safe_query fail with missing table/column errors after a schema change. |
| mydatabase_pingA | Health check: verifies the database connection is alive. Returns JSON with status, MySQL server version, and connection pool stats (active, idle, queued). |
| mydatabase_explain_queryA | Returns MySQL EXPLAIN output as CSV for a validated SELECT query. SQL is AST-validated and timeout-protected; ANALYZE and non-SELECT statements are blocked. Unlike execute_safe_query, this does NOT block full table scans — use it to diagnose why a query was blocked or to verify index usage before executing. |
Prompts
Interactive templates invoked by user choice
| Name | Description |
|---|---|
| mydatabase_query_templates | Returns pre-approved SQL templates for business metrics (requires templates.json via MCP_TEMPLATES_PATH). Use before writing analytical SQL from scratch. Execute the returned SQL via execute_safe_query. |
Resources
Contextual data attached and managed by the client
| Name | Description |
|---|---|
| schema | Lists all available tables in the database schema |
TDQS
Scored across 5 tools
Each tool has a clearly distinct role: schema exploration (search_schema), schema cache rebuild (refresh_schema), governed query execution (execute_safe_query), diagnostic EXPLAIN (explain_query), and liveness (ping). The descriptions actively disambiguate the closest pairs — search_schema vs execute_safe_query ('do NOT use execute_safe_query for schema exploration') and explain_query vs execute_safe_query (scan-blocking difference).
All tools share the mydatabase_ prefix and snake_case verb_noun form (refresh_schema, search_schema, execute_safe_query, explain_query), with only the conventional bare 'ping' as a health-check name. No mixed casing or competing verb styles.
Five tools is a tight, well-scoped set for a read-only SQL assistant, and each one earns its place (explore, rebuild cache, run, diagnose, health-check). Nothing looks like a redundant wrapper or a leftover utility.
The read-only lifecycle is covered end to end: discover schema, refresh it, validate/execute queries, diagnose blocked queries, and verify connectivity. Minor gaps remain — there is no explicit table-listing/overview tool for environments where the agent doesn't know table names, and the referenced query templates/metadata dictionary surface only exists as hints rather than tools.