mcp-mysql
Provides comprehensive tools for managing MariaDB databases, including schema creation/modification, data CRUD, user management, monitoring, query analysis, replication, and more.
Provides comprehensive tools for managing MySQL databases, including schema creation/modification, data CRUD, user management, monitoring, query analysis, replication, and more.
Click on "Install 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., "@mcp-mysqllist all tables in the 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.
mcp-mysql – MCP Server for MySQL & MariaDB
Full-featured MCP server for MySQL and MariaDB. 99 tools covering databases, tables, columns, indexes, foreign keys, data operations, transactions, user management, server monitoring, query analysis, export, triggers, views, stored routines, events, partitions, replication, slow query log, schema diff, backup, CHECK constraints, object comments, session management, InnoDB metrics, full-text search, and database rename.
Supports dual transport: stdio (Claude Desktop / Claude Code) and HTTP Streamable (Cursor, remote clients).
Quick Start (Docker)
cp .env.example .env
# Edit .env with your settings
docker compose up -dMCP server: http://localhost:4000/mcp
Health: http://localhost:4000/health
MariaDB: localhost:3307
Related MCP server: MySQL MCP Server (Optimized)
Configuration
Variable | Default | Description |
|
| MySQL host |
|
| MySQL port |
|
| MySQL user |
|
| MySQL password |
|
| Default database |
|
| Root password (Docker only) |
|
|
|
|
| HTTP server port |
|
| Host port for MySQL container |
|
| Host port for MCP container |
Claude Desktop / Claude Code Integration
HTTP Transport
{
"mcpServers": {
"mysql": {
"url": "http://localhost:4000/mcp"
}
}
}stdio Transport (local)
{
"mcpServers": {
"mysql": {
"command": "node",
"args": ["/path/to/mcp-mysql/dist/index.js"],
"env": {
"MYSQL_HOST": "localhost",
"MYSQL_PORT": "3306",
"MYSQL_USER": "root",
"MYSQL_PASSWORD": "password"
}
}
}
}Tools (99 total)
Databases (5)
Tool | Description |
| List all databases |
| Create a database |
| Drop a database |
| Show CREATE DATABASE statement |
| Server version, uptime, config |
Tables (8)
Tool | Description |
| List tables with stats |
| Column definitions (SHOW FULL COLUMNS) |
| Full CREATE TABLE DDL |
| Create table from SQL |
| Drop one or more tables |
| Remove all rows |
| Rename / move between databases |
| Size, rows, engine, collation |
Columns (4)
Tool | Description |
| ALTER TABLE ADD COLUMN (supports generated columns) |
| ALTER TABLE DROP COLUMN |
| ALTER TABLE MODIFY COLUMN |
| RENAME COLUMN (MySQL 8+/MariaDB 10.5+) |
Indexes (3)
Tool | Description |
| All indexes with cardinality |
| Create BTREE/HASH/FULLTEXT/SPATIAL index |
| Drop an index |
Foreign Keys (3)
Tool | Description |
| List FK constraints |
| Add FK with ON UPDATE/DELETE rules |
| Drop FK constraint |
Data Operations (7)
Tool | Description |
| SELECT with pagination and parameterized values |
| Execute any SQL (DDL/DML) |
| Insert single row |
| Update rows by WHERE condition |
| Delete rows by WHERE condition |
| Batch insert up to 5000 rows |
| Atomic multi-statement transaction |
User Management (7)
Tool | Description |
| List all MySQL accounts |
| Create user with password |
| Drop user |
| Grant privileges |
| Revoke privileges |
| Show GRANT statements |
| Change user password |
Server Monitoring (6)
Tool | Description |
| Global/session status variables |
| Global/session config variables |
| Active connections and queries |
| Kill connection or query |
| Last statement warnings |
| Reload grant tables |
Query Analysis & Maintenance (5)
Tool | Description |
| EXPLAIN with traditional/JSON/TREE format |
| Update optimizer statistics |
| Defragment and reclaim space |
| Check for corruption |
| Repair MyISAM/ARCHIVE tables |
Export & Import (2)
Tool | Description |
| Export as JSON, CSV, or SQL INSERTs |
| Execute SQL script |
Triggers (4)
Tool | Description |
| List triggers for a database or table |
| Create a trigger |
| Drop a trigger |
| Show CREATE TRIGGER statement |
Views (4)
Tool | Description |
| List views in a database |
| Create or replace a view |
| Drop a view |
| Show CREATE VIEW statement |
Stored Routines (6)
Tool | Description |
| List stored procedures and functions |
| Create a stored procedure |
| Create a stored function |
| Drop a procedure or function |
| Show CREATE PROCEDURE/FUNCTION statement |
| Call a stored procedure |
Events (5)
Tool | Description |
| List scheduled events |
| Create a scheduled event |
| Drop a scheduled event |
| Enable, disable, or reschedule an event |
| Show CREATE EVENT statement |
Partitions (5)
Tool | Description |
| List partitions and row counts |
| Add partition to a table |
| Drop a partition |
| Reduce partition count (HASH/KEY) |
| Analyze partition statistics |
Replication & Binary Logs (5)
Tool | Description |
| Replica/slave status (auto-detects MySQL vs MariaDB) |
| List binary log files |
| Show events in a binary log |
| Primary/master binary log position |
| List connected replicas |
Slow Query Log & Performance (3)
Tool | Description |
| Query slow log from performance_schema |
| Top queries by total latency |
| Enable or disable the slow query log |
Schema Diff (1)
Tool | Description |
| Compare schema between two databases |
Backup & Export (2)
Tool | Description |
| Full logical backup as SQL dump |
| Export DDL-only schema (no data) |
CHECK Constraints (3)
Tool | Description |
| List CHECK constraints for a table |
| Add a CHECK constraint |
| Drop a CHECK constraint |
Object Comments (3)
Tool | Description |
| Set comment on a table |
| Set comment on a column |
| Get all comments for tables/columns |
Session Management (5)
Tool | Description |
| Show current session variables |
| Set a session variable |
| List active sessions/connections |
| Info about current connection |
| Kill a session by ID |
Metrics & Admin (2)
Tool | Description |
| InnoDB engine metrics |
| Rename a database (moves all tables) |
Full-Text Search (1)
Tool | Description |
| Full-text search with MATCH...AGAINST |
Development
npm install
npm run dev # Development with auto-reload
npm run build # Production buildSwitch to MySQL 8.4
Edit docker-compose.yml:
mysql:
image: mysql:8.4 # was mariadb:11.4
environment:
MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD:-rootpassword}
MYSQL_DATABASE: ${MYSQL_DATABASE:-mcpdb}
MYSQL_USER: ${MYSQL_USER:-mcpuser}
MYSQL_PASSWORD: ${MYSQL_PASSWORD:-mcppassword}MySQL vs MariaDB Compatibility
Server auto-detects engine via @@version_comment. Fallbacks in place for renamed commands (SHOW SLAVE STATUS → SHOW REPLICA STATUS, SHOW MASTER STATUS → SHOW BINARY LOG STATUS). EXPLAIN FORMAT=TREE is MySQL-only and gracefully skipped on MariaDB.
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Latest Blog Posts
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/foxter-io/mcp-mysql'
If you have feedback or need assistance with the MCP directory API, please join our Discord server