mysql-mcp
Provides tools for schema inspection (list databases, tables, indexes, foreign keys, routines, triggers, events), SELECT queries, and confirmation-gated write/DDL/transaction operations on MariaDB databases.
Provides tools for schema inspection (list databases, tables, indexes, foreign keys, routines, triggers, events), SELECT queries, and confirmation-gated write/DDL/transaction operations (INSERT, UPDATE, DELETE, REPLACE, TRUNCATE, CREATE, ALTER, DROP, RENAME) on MySQL databases.
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 list tables in the current 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
MCP server for MySQL and MariaDB: schema inspection, SELECT, and separate confirmation-gated write/DDL/transaction tools.
Works over the MySQL wire protocol (MySQL 5.7+/8+ and MariaDB). For Aurora IAM or RDS Data API, use AWS Labs’ MySQL MCP instead.
Secrets belong in agent mcp.json env (mcpServers.*.env) — not project .env. Do not create a project .env for runtime credentials.
Tools
Tool | Notes |
| Schema inspect |
| Schema inspect |
| SELECT only; locks/ |
| INSERT/UPDATE/DELETE/REPLACE/TRUNCATE — strong confirm |
| CREATE/ALTER/DROP/RENAME — strong confirm |
| Multi-statement txn — per-stmt preview + strong confirm |
| EXPLAIN |
Writes are separate tools from reads. Agents must not use read_query for DML/DDL.
Strong confirmation
MCP has no native UI modal. Mutating tools return an impact preview and do not execute until called again with the same sql and confirmed: true.
Client operators should require approval on write_query, schema_query, and transaction_query (destructiveHint / non-readOnly).
Related MCP server: MySQL MCP Server
Auth / env
Variable | Required | Purpose |
| no* |
|
| * | Discrete connection |
| no | TLS |
| no | Caps |
Privilege scope: prefer least privilege. Use a write-capable role only when write tools are needed.
mcp.json example
{
"mcpServers": {
"mysql": {
"command": "node",
"args": ["/Volumes/ADATA/Projects/mcp-mysql/dist/index.js"],
"env": {
"MYSQL_HOST": "127.0.0.1",
"MYSQL_USER": "mcp_rw",
"MYSQL_PASSWORD": "your-password",
"MYSQL_DATABASE": "your_database"
}
}
}
}Develop
npm test && npm run build
# Smoke (pass env inline — never create a repo .env):
# MYSQL_HOST=… MYSQL_USER=… MYSQL_PASSWORD=… MYSQL_DATABASE=… npm run test:connectionsRisks
Row content is untrusted (prompt injection)
Confirmed writes are permanent without DB-level undo
Shared bot identity;
transaction_queryhas large blast radius after confirm
Available Tools
14 toolsdescribe_tableARead-onlyIdempotent
Describe columns for a table (types, nullability, keys).
Inputs: table (required), database.
explain_queryARead-onlyIdempotent
Run EXPLAIN on a SELECT / WITH query (traditional or JSON format).
Inputs: sql (required), format.
list_databasesARead-onlyIdempotent
List MySQL databases (schemas) visible to the configured user.
Inputs: no named parameters.
list_eventsBRead-onlyIdempotent
List scheduled events in a database.
Inputs: database.
list_foreign_keysARead-onlyIdempotent
List foreign-key relationships in a database, optionally filtered by table.
Inputs: table, database.
list_indexesBRead-onlyIdempotent
List indexes for a table.
Inputs: table (required), database.
list_routinesBRead-onlyIdempotent
List stored procedures and functions in a database.
Inputs: database.
list_tablesARead-onlyIdempotent
List tables and views in a database. Uses MYSQL_DATABASE when database is omitted.
Inputs: database.
list_triggersARead-onlyIdempotent
List triggers in a database, optionally filtered by table.
Inputs: table, database.
read_queryARead-onlyIdempotent
Execute a single read-only SELECT (or WITH … SELECT). Mutating SQL is rejected. Queries with FOR UPDATE / FOR SHARE / LOCK IN SHARE MODE / INTO @var require confirmed=true after a preview. Results are LIMIT-capped.
Inputs: sql (required), max_rows, confirmed.
schema_queryADestructive
Execute CREATE, ALTER, DROP, or RENAME (DDL). Separate from write_query. Requires confirmed=true after a strong confirmation preview.
Inputs: sql (required), confirmed.
show_create_tableBRead-onlyIdempotent
Return SHOW CREATE TABLE / VIEW DDL for a table or view.
Inputs: table (required), database.
transaction_queryADestructive
Execute multiple statements in one transaction. Preview lists per-statement risk. Requires confirmed=true.
Inputs: sql (required), confirmed.
write_queryA
Execute INSERT, UPDATE, DELETE, REPLACE, or TRUNCATE. Separate from read_query. Requires confirmed=true after a strong confirmation preview.
Inputs: sql (required), confirmed.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 14 tools
Each tool has a clearly distinct purpose, from listing databases and tables to describing schemas, querying, writing, and executing DDL or transactions. No two tools overlap in functionality.
All tool names follow a consistent verb_noun snake_case pattern (e.g., list_databases, describe_table, write_query), making it easy for an agent to predict functionality.
With 14 tools covering database introspection, data manipulation, schema changes, and transaction support, the set is well-scoped for a MySQL MCP server—neither too few nor too many.
The toolset provides comprehensive coverage for common MySQL operations: listing objects, describing schemas, read/write queries, DDL, transactions, and explain plans. No obvious gaps for typical usage.
Related MCP Connectors
Query, explore, and manage your databases through natural conversation.
Ask questions in plain language, get answers from your business database. No SQL required.
Ask business questions in plain English. Get instant answers from your database, no SQL needed.
Work with your database from AI tools: ask, export, approved changes, and scheduled jobs.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceEnables read-only access to MySQL databases through natural language queries. Provides automatic table schema discovery and executes SELECT, SHOW, DESCRIBE, and EXPLAIN statements within secure read-only transactions.MIT
- AlicenseNot gradedqualityDmaintenanceEnables natural language database operations on MySQL databases with AI integration, supporting CRUD operations, schema inspection, and audit logging with built-in security features including SQL injection protection and permission controls.798 npmMIT
- AlicenseCqualityDmaintenanceEnables monitoring and administration of MySQL databases through natural language, supporting multiple simultaneous connections, health checks, and full DDL/DML/DCL operations.3931 npmMIT
- AlicenseNot gradedqualityDmaintenanceEnables AI tools to interact with MySQL databases through natural language, including schema browsing, queries, CRUD operations, with destructive actions gated behind user approval.53 npm1MIT