mysql
Provides tools for querying, inspecting, and modifying MySQL databases, including listing databases, tables, describing table structure, executing read-only queries, write operations, and table statistics.
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 List all tables in my 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.
@longlonga/mysql
A Model Context Protocol (MCP) server for interacting with MySQL databases. Provides tools for querying, inspecting, and modifying MySQL databases directly from Claude.
Installation
Via Claude Code (recommended)
claude mcp add --scope user mysql \
-e MYSQL_HOST=your-host \
-e MYSQL_PORT=3306 \
-e MYSQL_USER=your-user \
-e MYSQL_PASSWORD=your-password \
-e MYSQL_DATABASE=your-database \
-- npx -y @longlonga/mysqlVia claude_desktop_config.json
{
"mcpServers": {
"mysql": {
"command": "npx",
"args": ["-y", "@longlonga/mysql"],
"env": {
"MYSQL_HOST": "your-host",
"MYSQL_PORT": "3306",
"MYSQL_USER": "your-user",
"MYSQL_PASSWORD": "your-password",
"MYSQL_DATABASE": "your-database"
}
}
}
}Related MCP server: MCP MySQL App
Configuration
Environment Variable | Required | Default | Description |
| Yes | — | MySQL server hostname or IP |
| No |
| MySQL server port |
| Yes | — | MySQL username |
| Yes | — | MySQL password |
| No | — | Default database (can be overridden per tool call) |
Tools
Tool | Description |
| List all databases the user has access to |
| List all tables in a database |
| Get column definitions for a table |
| Get the full CREATE TABLE DDL statement |
| Execute a read-only SELECT/SHOW/EXPLAIN query |
| Execute a write SQL statement (INSERT/UPDATE/DELETE/DDL) |
| Get row count and size statistics for tables |
Usage Examples
Once connected, you can ask Claude things like:
"List all tables in my database"
"Describe the structure of the users table"
"Query the last 10 orders"
"How many rows are in each table?"
License
MIT
Available Tools
7 toolsmysql_describe_tableDescribe Table StructureARead-onlyIdempotent
Get column definitions for a MySQL table (equivalent to DESCRIBE or SHOW COLUMNS).
Args:
table (string, required): Table name
database (string, optional): Database name. Uses MYSQL_DATABASE if omitted.
response_format ('markdown' | 'json'): Output format (default: 'markdown')
Returns column info: Field, Type, Null, Key, Default, Extra
Inputs: table (required), database, response_format.
mysql_executeExecute Write SQLADestructive
Execute a write SQL statement (INSERT, UPDATE, DELETE, DDL).
WARNING: This tool modifies data. Use with caution.
Args:
sql (string, required): SQL statement. Use ? placeholders for parameters.
params (array, optional): Bind parameters corresponding to ? placeholders.
database (string, optional): Database name. Uses MYSQL_DATABASE if omitted.
Returns: { affectedRows: number, insertId: number, changedRows: number }
Examples:
sql: "UPDATE biz_exhaust_hy SET DELETE_FLAG = 'DELETED' WHERE ID = ?", params: [123]
sql: "INSERT INTO my_table (name) VALUES (?)", params: ["test"]
Inputs: sql (required), params, database.
mysql_list_databasesList MySQL DatabasesARead-onlyIdempotent
List all databases on the MySQL server.
Returns database names the current user has access to.
Returns:
markdown: formatted list
json: { databases: string[] }
Inputs: response_format.
mysql_list_tablesList Tables in DatabaseARead-onlyIdempotent
List all tables in a MySQL database.
Args:
database (string, optional): Database name. Uses MYSQL_DATABASE if omitted.
response_format ('markdown' | 'json'): Output format (default: 'markdown')
Returns:
markdown: formatted table list
json: { database: string, tables: string[], count: number }
Inputs: database, response_format.
mysql_queryExecute SELECT QueryARead-only
Execute a read-only SELECT query against MySQL.
Only SELECT and SHOW/EXPLAIN statements are permitted. Use mysql_execute for write operations.
Args:
sql (string, required): SQL SELECT statement. Use ? placeholders for params.
params (array, optional): Bind parameters corresponding to ? placeholders.
database (string, optional): Database name. Uses MYSQL_DATABASE if omitted.
limit (number, optional): Max rows to return (default: 100, max: 1000).
response_format ('markdown' | 'json'): Output format (default: 'json')
Returns:
json: { rows: object[], count: number, has_more: boolean }
markdown: formatted table
Examples:
sql: "SELECT * FROM biz_exhaust_yg WHERE jcrq = ? LIMIT 10", params: ["2026-03"]
sql: "SELECT COUNT(*) as cnt FROM biz_exhaust_hy"
Inputs: sql (required), params, database, limit, +1 more.
mysql_show_create_tableShow CREATE TABLE StatementARead-onlyIdempotent
Get the full CREATE TABLE DDL statement for a table.
Args:
table (string, required): Table name
database (string, optional): Database name. Uses MYSQL_DATABASE if omitted.
Returns the complete CREATE TABLE SQL with all indexes, constraints, and engine settings.
Inputs: table (required), database.
mysql_table_statsGet Table StatisticsARead-onlyIdempotent
Get row count and size statistics for tables in a database.
Args:
database (string, optional): Database name. Uses MYSQL_DATABASE if omitted.
table (string, optional): Filter to a specific table. If omitted, returns all tables.
response_format ('markdown' | 'json'): Output format (default: 'markdown')
Returns per table: table_name, row_count, data_size_mb, index_size_mb, engine, create_time
Inputs: database, table, response_format.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 7 tools
Each tool targets a distinct operation: reading, writing, describing schema, listing databases/tables, showing DDL, and table statistics. No ambiguity between tools.
All tools share the 'mysql_' prefix and mostly follow verb_noun pattern (e.g., describe_table, list_databases). However, 'mysql_execute' and 'mysql_query' are verb-only, which slightly deviates from the pattern.
With 7 tools, the server covers essential MySQL interactions without being bloated. Each tool serves a clear purpose, making it easy for an agent to navigate.
The set covers core CRUD, schema inspection, and metadata retrieval. DDL operations are handled via mysql_execute, so no major gaps are present. Minor missing features like server version are not critical.
Maintenance
Related MCP Connectors
Hosted MySQL MCP server for Claude, ChatGPT and Cursor, with each action switched per account.
Hosted SQL Server MCP server for Claude, ChatGPT and Cursor, with each action switched per account.
Text-to-SQL MCP server: read-only queries on PostgreSQL, MySQL and SQL Server with your real schema
A comprehensive Model Context Protocol (MCP) server that enables AI assistants to interact with yo…
Related MCP Servers
- AlicenseCqualityDmaintenanceAn MCP server that enables MySQL database integration with Claude. You can execute SQL queries and manage database connections.29MIT
- AlicenseNot gradedqualityDmaintenanceA Model Context Protocol (MCP) server that enables AI assistants to interact with MySQL databases by executing SQL queries and checking database connectivity.MIT
- AlicenseBqualityDmaintenanceA Model Context Protocol server that enables AI models to interact with MySQL databases, providing tools for querying, executing statements, listing tables, and describing table structures.5290 npmMIT
- AlicenseBqualityDmaintenanceA Model Context Protocol server that enables AI models to interact with MySQL databases through a standardized interface, providing tools for querying, executing commands, and managing database schemas.7MIT