mysql-mcp-lite
Provides tools for interacting with MySQL databases, including listing databases and tables, describing table schemas, and running read-only SQL queries with configurable row limits and timeouts. Optionally supports write-mode queries when enabled.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@mysql-mcp-liteshow me the schema of the orders table in the shop database"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
mysql-mcp-lite
MySQL for any AI agent: one MCP server, one install command. Works in Claude Code, Codex, Cursor, OpenCode, Gemini CLI, VS Code, Claude Desktop and any other MCP client.
Tool | Does |
| Databases visible to the configured user |
| Tables and views, with approximate row counts |
|
|
| One statement → compact JSON |
Plus a /mysql prompt: ask in plain words, and the agent reads the schema and writes the SQL.
Read-only by default. Needs uv and MySQL 5.7.8+ / 8.x.
Install
Every agent runs the same command:
uvx --from git+https://github.com/aniketshukla1/mysql-mcp-lite mysql-mcp-liteFrom a local clone, give the folder instead: uvx --from /path/to/mysql-mcp-lite mysql-mcp-lite.
The first start downloads dependencies (about 10 seconds). If an agent shows the server as disconnected on its first launch, restart the agent.
The examples use a read-only user mcp_ro on database shop (see Safety). Swap in your values.
Claude Code
claude mcp add -s user mysql -e MYSQL_HOST=127.0.0.1 -e MYSQL_USER=mcp_ro -e MYSQL_PASSWORD=change-me -e MYSQL_DATABASE=shop -- uvx --from git+https://github.com/aniketshukla1/mysql-mcp-lite mysql-mcp-liteCodex
codex mcp add mysql --env MYSQL_HOST=127.0.0.1 --env MYSQL_USER=mcp_ro --env MYSQL_PASSWORD=change-me --env MYSQL_DATABASE=shop -- uvx --from git+https://github.com/aniketshukla1/mysql-mcp-lite mysql-mcp-liteCursor, Gemini CLI, Claude Desktop and most other clients
They share one JSON shape:
{
"mcpServers": {
"mysql": {
"command": "uvx",
"args": ["--from", "git+https://github.com/aniketshukla1/mysql-mcp-lite", "mysql-mcp-lite"],
"env": {
"MYSQL_HOST": "127.0.0.1",
"MYSQL_USER": "mcp_ro",
"MYSQL_PASSWORD": "change-me",
"MYSQL_DATABASE": "shop"
}
}
}
}Client | File | Note |
Cursor |
|
|
Gemini CLI |
| Gemini turns MCP servers off in folders you haven't trusted |
Claude Desktop |
| If it can't find |
OpenCode
opencode.json in the project, or ~/.config/opencode/opencode.json:
{
"$schema": "https://opencode.ai/config.json",
"mcp": {
"mysql": {
"type": "local",
"command": ["uvx", "--from", "git+https://github.com/aniketshukla1/mysql-mcp-lite", "mysql-mcp-lite"],
"environment": {
"MYSQL_HOST": "127.0.0.1",
"MYSQL_USER": "mcp_ro",
"MYSQL_PASSWORD": "change-me",
"MYSQL_DATABASE": "shop"
}
}
}
}VS Code
.vscode/mcp.json, the same fields under servers:
{
"servers": {
"mysql": {
"type": "stdio",
"command": "uvx",
"args": ["--from", "git+https://github.com/aniketshukla1/mysql-mcp-lite", "mysql-mcp-lite"],
"env": { "MYSQL_HOST": "127.0.0.1", "MYSQL_USER": "mcp_ro", "MYSQL_PASSWORD": "change-me", "MYSQL_DATABASE": "shop" }
}
}
}Checked: Claude Code, cursor-agent, Gemini CLI and OpenCode connected to the server from these configs, and Codex accepted its config. VS Code and Claude Desktop use their standard formats but weren't run.
Related MCP server: easy-mysql-mcp
The /mysql prompt
Clients that support MCP prompts show it as a command: /mcp__mysql__mysql in Claude Code, /mcp.mysql.mysql in VS Code, /mysql in Gemini CLI. Give it a question, such as top 5 customers by revenue last month; with no question it summarizes the database.
Config
Env var | Default | Meaning |
|
| |
|
| |
|
| |
| empty | |
| none | Default database for |
| off |
|
|
| Rows returned per call; |
|
| Per-SELECT limit ( |
Safety
Read-only mode stacks three layers:
The statement must start with
SELECT,SHOW,DESCRIBE,EXPLAIN,WITH,TABLEorVALUES;INTO OUTFILE/DUMPFILEis rejected. One statement per call (SELECT 1; DROP …fails in MySQL).Every call runs inside
START TRANSACTION READ ONLYand is rolled back, so DML that slips past layer 1 (e.g.WITH … DELETE) fails in MySQL.The real boundary: connect as a SELECT-only user.
CREATE USER 'mcp_ro'@'%' IDENTIFIED BY 'change-me';
GRANT SELECT, SHOW VIEW ON shop.* TO 'mcp_ro'@'%';Develop
docker run -d --name mysql-mcp-test -e MYSQL_ROOT_PASSWORD=testroot -p 127.0.0.1:33306:3306 mysql:8.4uv run --script test_e2e.pyStarts mysql_mcp_lite.py over stdio the way an agent does, then checks the 4 tools, the /mysql prompt, each read-only layer, write mode and truncation against a real MySQL.
License
Available Tools
4 toolsdescribe_tableBRead-only
Return the CREATE TABLE statement: columns, types, indexes and foreign keys.
| Name | Required | Description | Default |
|---|---|---|---|
| table | Yes | ||
| database | No |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
readOnlyHint=true already tells the agent this is a safe non-mutating call, so the bar is lower. The description does add real value by disclosing exactly what the payload contains (columns, types, indexes, foreign keys). It says nothing about failure behavior for a nonexistent table, dialect-specific DDL formatting, or whether the statement is reconstructed vs. stored.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
A single sentence, front-loaded with the returned artifact and followed by the enumerated contents. No filler, no restatement of the tool name, nothing to cut.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
With only two parameters, no output schema, and a read-only annotation, the surface area is small, and the return-content clause covers the most important unknown. The remaining gap is parameter meaning — particularly how to disambiguate a table across databases — which an agent needs in order to call this correctly.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 0%: neither `table` nor `database` carries any documentation. The description supplies none either, leaving open whether `table` accepts a qualified name, whether case matters, and what omitting the nullable `database` defaults to. With zero coverage the description was the only place to compensate, and it does not.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
Names a specific verb and resource ('Return the CREATE TABLE statement') and enumerates the content returned: columns, types, indexes, foreign keys. That is far more informative than a tautology. It stops short of contrasting itself with list_tables or query, though the DDL-returning nature makes it implicitly distinct.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
There is no explicit when-to-use statement, no prerequisites, and no named alternative such as 'use list_tables to enumerate tables first' or 'use query to inspect rows'. The use case (inspecting a single table's structure) is strongly implied by the description but left to inference.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
list_databasesARead-only
List the databases visible to the configured MySQL user.
| Name | Required | Description | Default |
|---|---|---|---|
No parameters | |||
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
Annotations already declare readOnlyHint=true, so the safety profile is covered. The description adds real behavioral context in saying the results are limited to what the configured MySQL user can see, but it says nothing about the returned shape (names only?) or ordering, and there is no output schema to fill that gap.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
One front-loaded sentence with no filler; the scope qualifier follows the verb-resource statement rather than burying it. Nothing could be removed without losing information.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
For a zero-parameter, read-only listing tool this is nearly sufficient: purpose and privilege scoping are clear and annotations cover safety. The only shortfall is that with no output schema, a brief note on what the list contains (database names) would fully close the loop.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The tool takes zero parameters, so there is no parameter semantics to explain and the baseline of 4 applies. The description correctly implies the call needs no arguments.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
States a specific verb and resource ('List the databases') and adds a scoping qualifier ('visible to the configured MySQL user') that tells the agent the result is privilege-dependent. The resource is distinct enough from siblings list_tables and describe_table that no explicit contrast is needed, though the description never names them.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
Usage is only implied: an agent can infer this is a discovery step before calling list_tables or query, but the description never says so or states any precondition. No when-not-to-use or alternative routing is provided.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
list_tablesARead-only
List tables and views in a database (default: MYSQL_DATABASE), with approximate row counts.
| Name | Required | Description | Default |
|---|---|---|---|
| database | No |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
readOnlyHint=true already covers the safety profile, and the description adds two useful facts beyond it: that views are included alongside tables, and that row counts are approximate rather than exact. It still omits cost/pagination behavior for large schemas, which keeps it from a 5.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
A single sentence that front-loads the action, resource, and default, with no redundant or filler wording.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
For a simple read-only listing tool with annotations and no output schema, the definition covers scope, defaults, and return fidelity adequately. Only the shape of the returned rows (name, type, row count columns) is left implicit.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
With 0% schema description coverage and a single optional parameter, the description supplies the missing meaning by naming the default database (MYSQL_DATABASE). This is exactly the compensation needed, though it does not explain the expected string format or how an unknown database is reported.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description uses a specific verb and resource ('List tables and views in a database') plus a scope detail (approximate row counts), which clearly separates it from list_databases and describe_table. It does not name a sibling explicitly, so it falls short of a 5.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
Usage is implied rather than stated: an agent can infer this is the schema-discovery step before describe_table or query. There is no explicit 'use this instead of X when Y' guidance or statement of prerequisites.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
queryARead-only
Run one SQL statement. Returns JSON {columns, rows, truncated}: at most MYSQL_MAX_ROWS rows,
truncated true when cut; writes return {rows_affected, last_insert_id}.
Read-only (SELECT/SHOW/DESCRIBE/EXPLAIN/WITH) unless the server runs with MYSQL_ALLOW_WRITE=true.
| Name | Required | Description | Default |
|---|---|---|---|
| sql | Yes | ||
| database | No |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
Beyond the annotations, it discloses truncation behavior at MYSQL_MAX_ROWS and the different return shape for writes ({rows_affected, last_insert_id}), both of which an agent needs to reason about result handling. The caveat that writes are possible when the server runs with MYSQL_ALLOW_WRITE=true adds context the readOnlyHint annotation cannot express, though it sits in mild tension with a blanket readOnlyHint=true; it does not contradict the annotation for the default configuration. Missing: error behavior and whether multi-statement input is rejected.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
Two dense sentences plus a conditional clause; return shape and truncation semantics are front-loaded before the read-only caveat. Nothing is filler and no sentence merely restates the tool name.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
With no output schema, the description carries the burden of describing returns and does so for both read and write paths, including the truncation flag. It falls short only on the `database` parameter and on failure modes, which are meaningful for a tool that executes arbitrary SQL.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 0%, so the description must compensate for two undocumented parameters, and it only partially does. 'One SQL statement' usefully constrains the `sql` parameter's expected shape, but the `database` parameter (default null) is never explained at all — an agent must guess whether it overrides the session's current database.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description opens with a specific verb and resource ('Run one SQL statement'), which is unambiguous and clearly distinct in kind from the schema-introspection siblings list_databases/list_tables/describe_table. It never explicitly names those siblings as alternatives, but the gulf between 'arbitrary SQL' and 'enumerate schema objects' is large enough that an agent will not confuse them.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
It gives a real constraint ('one SQL statement', read-only unless MYSQL_ALLOW_WRITE=true), which implicitly tells the agent this is the general-purpose path. However, it offers no explicit routing such as 'use describe_table instead of DESCRIBE via SQL', leaving the agent to infer when to prefer the specialized siblings.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
4 tool updates
v0.1.0- First observed
describe_table - First observed
list_databases - First observed
list_tables - First observed
query
TDQS
Scored across 4 tools
Each tool has a clear, non-overlapping role: list_databases scopes to the server, list_tables scopes to one database, describe_table details one table, and query executes SQL. An agent can pick correctly without hesitation, and the read-only/write gating on `query` is explicitly stated.
list_databases, list_tables, describe_table follow a clean verb_noun pattern, with `query` being a single-verb outlier. That deviation is natural for a generic SQL execution tool and remains readable, so it is a minor inconsistency rather than a structural one.
Four tools is a deliberately lean, well-scoped surface for a 'lite' MySQL server, and each one earns its place as a distinct discovery step. Nothing feels padded, and a generic `query` tool absorbs the long tail of operations without inflating the count.
Discovery (databases → tables → schema) plus arbitrary SQL execution covers the read-only exploration workflow end to end, including writes when MYSQL_ALLOW_WRITE is set. Minor gaps exist—no dedicated index/column listing, no EXPLAIN helper, and no separate DDL or transaction tools—but `query` lets an agent work around all of them.
Maintenance
Related MCP Connectors
PostgreSQL, MySQL, and SQL Server in one session. 26 read-only MCP tools for AI agents.
Safe, read-only Postgres and MySQL access for AI agents. Audit log + column-level controls.
Read-only search of 2,189 AI agent tools (MCP servers, x402 APIs) with daily automated trust scores.
Guard AI agents' PostgreSQL/MySQL access via MCP: SQL audit, auth, masking, write approval
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceEnables AI assistants to safely query MySQL databases with read-only access by default, supporting table listing, structure inspection, and SQL queries with optional write operation control.11 npmMIT
- AlicenseAqualityCmaintenanceEnables AI assistants to inspect and query a MySQL database through safe, structured tools, including schema discovery and read-only queries.957 npmMIT
- AlicenseAqualityDmaintenanceEnables AI agents to explore MySQL database schemas and execute read-only queries through a safe, MCP interface.6ISC
- FlicenseAqualityBmaintenanceEnables AI assistants to connect to MySQL databases, execute read-only queries, list tables, and describe table schemas via MCP.101-