tokenlite-mysql-mcp

v5.0.0
io.github.andezdev/tokenlite-mysql-mcp Checked 2 days ago Published 13 days ago

A secure, efficient, and intelligent MySQL server for the Model Context Protocol

Values you need

VariableWhat it is
DB_HOSToptional MySQL Host address (defaults to localhost)
DB_PORToptional MySQL Port (defaults to 3306)
DB_USERoptional MySQL Username (defaults to root)
DB_PASSWORDoptional secret MySQL Password (defaults to empty string)
DB_NAMErequired MySQL Database name
MCP_EXPLAIN_MAX_SCAN_ROWSoptional EXPLAIN guardrail: max estimated rows for unindexed full table scans before blocking (defaults to 1000). MCP_SAFE_QUERY_MAX_ROWS is a deprecated alias.
MCP_QUERY_ROW_LIMIToptional Max rows returned per SELECT; injected as LIMIT at the AST level (defaults to 500)
MCP_SAFE_QUERY_MAX_ROWSoptional Deprecated alias for MCP_EXPLAIN_MAX_SCAN_ROWS
MCP_SAFE_QUERY_ENABLE_BLOCKINGoptional Enable or disable the EXPLAIN guardrail (defaults to true)
MCP_METADATA_PATHoptional Absolute path to your custom metadata.json dictionary
MCP_TEMPLATES_PATHoptional Absolute path to your custom templates.json pre-approved queries
TOOL_PREFIXoptional Prefix for tool names, e.g., to run multiple instances (defaults to DB_NAME, e.g. mydb_). Only set to override.
MCP_RATE_LIMIT_RPMoptional Max tool invocations per minute, sliding window (defaults to 60). Set to 0 to disable.
MYSQL_QUERY_TIMEOUToptional Max execution time for a query in milliseconds to protect against DoS (defaults to 15000)
MYSQL_CONNECTION_LIMIToptional Max concurrent pool connections (defaults to 10)
MYSQL_CONNECT_TIMEOUToptional Max time to wait for a connection socket to establish in milliseconds (defaults to 10000)
MYSQL_RETRY_ATTEMPTSoptional Max retries on transient connection errors (defaults to 3)
MYSQL_RETRY_DELAY_MSoptional Base delay in milliseconds for exponential backoff between retries (defaults to 1000)
MYSQL_QUEUE_LIMIToptional Max queued requests when all pool connections are busy to prevent memory leak (defaults to 50)
MCP_DDL_CACHE_TTLoptional Time-to-live in seconds for cached DDL statements (defaults to 60)
MCP_LOG_LEVELoptional Minimum severity level for MCP log notifications (defaults to info). Levels: debug, info, notice, warning, error, critical, alert, emergency
ALLOW_INSERT_OPERATIONoptional Enable INSERT and REPLACE queries (defaults to false)
ALLOW_UPDATE_OPERATIONoptional Enable UPDATE queries (defaults to false)
ALLOW_DELETE_OPERATIONoptional Enable DELETE and TRUNCATE queries (defaults to false)
ALLOW_DDL_OPERATIONoptional Enable Data Definition Language queries like CREATE, ALTER, DROP, RENAME (defaults to false)
DB_SSLoptional Enable TLS for the MySQL connection (defaults to false)
DB_SSL_REJECT_UNAUTHORIZEDoptional Reject self-signed or untrusted TLS certificates when DB_SSL is true (defaults to true)

npm (npx) discovery passed

Requires Node.js 18+

Run in a terminal
claude mcp add tokenlite-mysql-mcp -e 'DB_NAME=<DB_NAME>' -- npx -y @andezdev/tokenlite-mysql-mcp@5.0.0
Add to claude_desktop_config.json
{
  "mcpServers": {
    "tokenlite-mysql-mcp": {
      "args": [
        "-y",
        "@andezdev/tokenlite-mysql-mcp@5.0.0"
      ],
      "command": "npx",
      "env": {
        "DB_NAME": "<DB_NAME>"
      }
    }
  }
}
Add to ~/.cursor/mcp.json
{
  "mcpServers": {
    "tokenlite-mysql-mcp": {
      "args": [
        "-y",
        "@andezdev/tokenlite-mysql-mcp@5.0.0"
      ],
      "command": "npx",
      "env": {
        "DB_NAME": "<DB_NAME>"
      }
    }
  }
}
Add to .vscode/mcp.json
{
  "inputs": [
    {
      "description": "DB_NAME",
      "id": "db-name",
      "password": true,
      "type": "promptString"
    }
  ],
  "servers": {
    "tokenlite-mysql-mcp": {
      "args": [
        "-y",
        "@andezdev/tokenlite-mysql-mcp@5.0.0"
      ],
      "command": "npx",
      "env": {
        "DB_NAME": "${input:db-name}"
      },
      "type": "stdio"
    }
  }
}
Add to ~/.codex/config.toml
[mcp_servers.tokenlite-mysql-mcp]
command = "npx"
args = ["-y", "@andezdev/tokenlite-mysql-mcp@5.0.0"]
env = { "DB_NAME" = "<DB_NAME>" }

For AI agents

  1. Ask the user for: DB_NAME. Never invent or guess these values; secrets go into the client config, not into chat logs.
  2. Pick the user's MCP client and apply the matching config from the first install method (it is the one verified by the smoke test when available).
  3. Restart or reload the client so it starts the server.
  4. Verify: the server should expose these tools: mcpkg_smoke_placeholder_search_schema, mcpkg_smoke_placeholder_execute_safe_query, mcpkg_smoke_placeholder_refresh_schema, mcpkg_smoke_placeholder_ping, mcpkg_smoke_placeholder_explain_query.
  5. If it fails, check that the required runtime is installed (Node.js 18+) and that the values above are set.

Machine-readable: install.md · manifest.json