Sponsored byOutsenseAI that finds your next clients
SponsorGROUOutbound, LinkedIn content and leads for B2B teamsSponsorOutsenseAI that finds your next clientsAd+Your tool hereSeen by people installing AI tools@Weekly picksThe best new tools, one email a week

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.

  • Score 78
  • 0 stars
  • 310 a week
  • MIT
  • Updated

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-mcp

Run in your terminal. Add --scope user to use it in every project.

Step-by-step: install tokenlite-mysql-mcp in Claude Code

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
SettingNeededWhat it is
DB_NAMEEnvironment variableRequiredMySQL Database name
DB_HOSTEnvironment variableOptionalMySQL Host address (defaults to localhost)
DB_PORTEnvironment variableOptionalMySQL Port (defaults to 3306)
DB_USEREnvironment variableOptionalMySQL Username (defaults to root)
DB_PASSWORDEnvironment variable, secretOptionalMySQL Password (defaults to empty string)
MCP_EXPLAIN_MAX_SCAN_ROWSEnvironment variableOptionalEXPLAIN 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_LIMITEnvironment variableOptionalMax rows returned per SELECT; injected as LIMIT at the AST level (defaults to 500)
MCP_SAFE_QUERY_MAX_ROWSEnvironment variableOptionalDeprecated alias for MCP_EXPLAIN_MAX_SCAN_ROWS
MCP_SAFE_QUERY_ENABLE_BLOCKINGEnvironment variableOptionalEnable or disable the EXPLAIN guardrail (defaults to true)
MCP_METADATA_PATHEnvironment variableOptionalAbsolute path to your custom metadata.json dictionary
MCP_TEMPLATES_PATHEnvironment variableOptionalAbsolute path to your custom templates.json pre-approved queries
TOOL_PREFIXEnvironment variableOptionalPrefix for tool names, e.g., to run multiple instances (defaults to DB_NAME, e.g. mydb_). Only set to override.
MCP_RATE_LIMIT_RPMEnvironment variableOptionalMax tool invocations per minute, sliding window (defaults to 60). Set to 0 to disable.
MYSQL_QUERY_TIMEOUTEnvironment variableOptionalMax execution time for a query in milliseconds to protect against DoS (defaults to 15000)
MYSQL_CONNECTION_LIMITEnvironment variableOptionalMax concurrent pool connections (defaults to 10)
MYSQL_CONNECT_TIMEOUTEnvironment variableOptionalMax time to wait for a connection socket to establish in milliseconds (defaults to 10000)
MYSQL_RETRY_ATTEMPTSEnvironment variableOptionalMax retries on transient connection errors (defaults to 3)
MYSQL_RETRY_DELAY_MSEnvironment variableOptionalBase delay in milliseconds for exponential backoff between retries (defaults to 1000)
MYSQL_QUEUE_LIMITEnvironment variableOptionalMax queued requests when all pool connections are busy to prevent memory leak (defaults to 50)
MCP_DDL_CACHE_TTLEnvironment variableOptionalTime-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

A

No 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 supabase
97

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.

AAA Local and remote 205k/wk
ArcadeDB MCP Server ArcadeData
94

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.

AAA Local 1.3k
DBHubbytebase
94

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.

AAA Local 192k/wk
MCP Toolbox for Databasesgoogleapis
94

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.

AAA Local 17k
MCP Toolbox for Databasesgoogleapis
94

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.

AAA Local 17k
mongodb-mcp-servermongodb-js
94

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.

AAA Local 180k/wk

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.

tokenlite-mysql-mcp Install

Add to stack

Loading.