tokenlite-mysql-mcp
MCP server by andezdev Community
TokenLite MySQL MCP is a MySQL database server for the Model Context Protocol. It lets AI assistants explore schemas and run guarded queries, and it is read-only by default. It suits developers who want database access with row limits and controlled write permissions.
Install tokenlite-mysql-mcp
Built from the published package, never by AI.
claude mcp add tokenlite-mysql-mcp -e DB_NAME=YOUR_DB_NAME -- npx -y @andezdev/tokenlite-mysql-mcpRun in your terminal. Add --scope user to use it in every project.
{
"mcpServers": {
"tokenlite-mysql-mcp": {
"env": {
"DB_NAME": "YOUR_DB_NAME"
},
"args": [
"-y",
"@andezdev/tokenlite-mysql-mcp"
],
"command": "npx"
}
}
}Settings, Developer, Edit config. Paste into claude_desktop_config.json and restart.
{
"mcpServers": {
"tokenlite-mysql-mcp": {
"env": {
"DB_NAME": "YOUR_DB_NAME"
},
"args": [
"-y",
"@andezdev/tokenlite-mysql-mcp"
],
"command": "npx"
}
}
}Add to ~/.cursor/mcp.json (all projects) or .cursor/mcp.json (this project).
{
"servers": {
"tokenlite-mysql-mcp": {
"env": {
"DB_NAME": "YOUR_DB_NAME"
},
"args": [
"-y",
"@andezdev/tokenlite-mysql-mcp"
],
"command": "npx"
}
}
}Add to .vscode/mcp.json. VS Code uses "servers", not "mcpServers".
codex mcp add tokenlite-mysql-mcp --env DB_NAME=YOUR_DB_NAME -- npx -y @andezdev/tokenlite-mysql-mcp{
"mcpServers": {
"tokenlite-mysql-mcp": {
"env": {
"DB_NAME": "YOUR_DB_NAME"
},
"args": [
"-y",
"@andezdev/tokenlite-mysql-mcp"
],
"command": "npx"
}
}
}Add to ~/.gemini/config/mcp_config.json (all projects) or .agents/mcp_config.json (this project).
Step-by-step: install tokenlite-mysql-mcp in Antigravity CLI
gemini mcp add tokenlite-mysql-mcp npx -y @andezdev/tokenlite-mysql-mcpGemini CLI was replaced by Antigravity CLI in June 2026 and remains only for enterprise licences and paid API keys.
MCP servers run with your permissions and can read what you give them access to. Some need an API key: check the README and add it under env in the tokenlite-mysql-mcp block.
About
TokenLite MySQL MCP is a MySQL database server built on Anthropic's Model Context Protocol. It lets an AI assistant explore a database schema and run queries. Before a query runs, the server checks its EXPLAIN plan and blocks unindexed full table scans above a configurable row threshold. It also adds a LIMIT clause at the AST level. By default the server is read-only. Write operations such as INSERT, UPDATE, DELETE and DDL can be enabled separately through environment variables.
Results are returned as CSV with NULL values shown as a symbol. The project says this saves up to 50% of output tokens compared with JSON. Schema lookups return a target table with its direct parent and child tables instead of the whole schema. Optional metadata.json and templates.json files can add business terms and pre-approved SQL templates. It is aimed at people who want an AI assistant to query MySQL with safety limits.
Written from the project's README and checked against it.
Tools it gives your assistant
execute_safe_queryRuns SQL queries after an EXPLAIN check and applies a row LIMIT to SELECT results.search_schemaReturns schema details for a table, with related parent and child tables.refresh_schemaClears the cached DDL statements so schema changes are picked up.mysql://tables/{name}Resource template for accessing table data, with table name completions.query_templatesPrompt that offers pre-approved query templates from a templates.json file.
What you need
- Node.js v20 or higher
- MySQL 5.7 or higher (8.0 or later recommended)
- A MySQL user with SELECT and SHOW VIEW privileges
- An MCP-compatible client, such as Claude Desktop, Claude Code or Cursor
| Setting | Needed | What it is |
|---|---|---|
DB_Environment variable | Required | MySQL Database name |
DB_Environment variable | Optional | MySQL Host address (defaults to localhost) |
DB_Environment variable | Optional | MySQL Port (defaults to 3306) |
DB_Environment variable | Optional | MySQL Username (defaults to root) |
DB_Environment variable, secret | Optional | MySQL Password (defaults to empty string) |
MCP_Environment variable | Optional | 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_Environment variable | Optional | Max rows returned per SELECT; injected as LIMIT at the AST level (defaults to 500) |
MCP_Environment variable | Optional | Deprecated alias for MCP_EXPLAIN_MAX_SCAN_ROWS |
MCP_Environment variable | Optional | Enable or disable the EXPLAIN guardrail (defaults to true) |
MCP_Environment variable | Optional | Absolute path to your custom metadata.json dictionary |
MCP_Environment variable | Optional | Absolute path to your custom templates.json pre-approved queries |
TOOL_Environment variable | Optional | Prefix for tool names, e.g., to run multiple instances (defaults to DB_NAME, e.g. mydb_). Only set to override. |
MCP_Environment variable | Optional | Max tool invocations per minute, sliding window (defaults to 60). Set to 0 to disable. |
MYSQL_Environment variable | Optional | Max execution time for a query in milliseconds to protect against DoS (defaults to 15000) |
MYSQL_Environment variable | Optional | Max concurrent pool connections (defaults to 10) |
MYSQL_Environment variable | Optional | Max time to wait for a connection socket to establish in milliseconds (defaults to 10000) |
MYSQL_Environment variable | Optional | Max retries on transient connection errors (defaults to 3) |
MYSQL_Environment variable | Optional | Base delay in milliseconds for exponential backoff between retries (defaults to 1000) |
MYSQL_Environment variable | Optional | Max queued requests when all pool connections are busy to prevent memory leak (defaults to 50) |
MCP_Environment variable | Optional | Time-to-live in seconds for cached DDL statements (defaults to 60) |
From the publisher's entry in the official MCP Registry. Required settings are already in the install config below as placeholders.
Try asking
- Show me the schema for the orders table and its related tables
- Run a query that totals sales by customer for last month
- Use the query_templates prompt to find the customer lifetime value
Good to know
- Read-only by default. Write operations need ALLOW_* variables set to true.
- Queries that exceed the EXPLAIN scan threshold are rejected before they run.
- Tool calls are rate limited to 60 per minute by default.
- Token savings come from a benchmark using the o200k_base tokenizer and may vary for Claude models.
Security check
ANo download-and-run commands, hidden instructions or signs of sending keys out were found.
Checked automatically: README.md, package.json. This looks for known risky patterns and is not a full audit. How grades work
Alternatives to tokenlite-mysql-mcp
All alternatives →Supabase MCP Server connects your Supabase projects to AI assistants such as Cursor, Claude, and Windsurf. It lets assistants manage tables, fetch project configuration, and query data. It is aimed at developers who want an assistant to work directly with their Supabase projects.
ArcadeDB MCP Server is the built-in Model Context Protocol server of the ArcadeDB multi-model database. It lets AI assistants and LLMs work with ArcadeDB's graph, document, time-series, vector and other data models. It suits people who already run ArcadeDB and want assistant access to it.
Connects MCP clients such as Claude Desktop, Cursor and VS Code to PostgreSQL, MySQL, MariaDB, SQL Server, Oracle, ClickHouse and SQLite. It exposes two tools by default, with read-only mode and query timeouts available as guardrails.
MCP Toolbox for Databases is an open source MCP server that connects AI agents, IDEs and applications to enterprise databases. It is for developers who want to query data, explore schemas or build custom database tools.
MCP Toolbox for Databases is an open source MCP server that connects AI agents, IDEs and applications to databases. It suits developers who want prebuilt database tools or custom, safer tools for production agents.
MongoDB MCP Server lets AI assistants interact with MongoDB databases and MongoDB Atlas. It is an official server from mongodb-js, run locally with npx or Docker. It works with self-managed deployments and Atlas clusters.
Compare with Supabase, ArcadeDB MCP Server or DBHub
tokenlite-mysql-mcp: common questions
Is TokenLite MySQL MCP safe to use on production databases?
The project says it pre-analyzes queries with EXPLAIN and blocks large unindexed table scans. In strict read-only mode it also sets MySQL sessions to READ ONLY.
How do I enable INSERT or UPDATE queries?
Set ALLOW_INSERT_OPERATION, ALLOW_UPDATE_OPERATION, ALLOW_DELETE_OPERATION or ALLOW_DDL_OPERATION to true. All of them default to false.
How does it reduce token usage?
Query results are returned as CSV instead of JSON, and schema lookups return only the target table and its direct relationships. The README reports savings in its benchmark tables.
How do I install tokenlite-mysql-mcp?
In Claude Code run claude mcp add tokenlite-mysql-mcp -e DB_NAME=YOUR_DB_NAME -- npx -y @andezdev/tokenlite-mysql-mcp. For Claude Desktop, Cursor and VS Code, paste the config shown above and restart. See the install guides.
Is tokenlite-mysql-mcp the official server?
tokenlite-mysql-mcp is a community project by andezdev, not verified by a company domain.
Is tokenlite-mysql-mcp free?
The code is published under the MIT licence. The service it connects to may have its own pricing.
Is tokenlite-mysql-mcp safe to use?
It scores 78 of 100. Grades: maintenance A, licence A, quality C. Security check: grade A, no risky patterns found in the files checked. Review the code before you install. How grades work.
What are alternatives to tokenlite-mysql-mcp?
Similar MCP servers: Supabase, ArcadeDB MCP Server, DBHub, MCP Toolbox for Databases.
Does tokenlite-mysql-mcp work with ChatGPT?
Not directly. It runs locally, and ChatGPT only connects to remote servers with a URL. Use it in Claude Code, Claude Desktop, Cursor, VS Code or Codex.
