mysql-mcp-server
Provides tools for managing MariaDB databases, covering the full lifecycle of database administration, development, and operations including schema management, data operations, user management, monitoring, and query analysis.
Provides tools for managing MySQL databases, covering the full lifecycle of database administration, development, and operations including schema management, data operations, user management, monitoring, and query analysis.
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-serverlist all tables in database mydb"
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/MariaDB MCP Server
Complete MCP server for MySQL and MariaDB. 50 tools covering the full lifecycle of database administration, development, and operations.
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 Pro
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 (50 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 |
| 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 |
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}This server cannot be deployed
Maintenance
Related MCP Connectors
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.
Generate, fix, explain and run read-only SQL on PostgreSQL, MySQL and SQL Server
Ask data questions in natural language. Get SQL, insights, and charts from your databases.
Related MCP Servers
- AlicenseBqualityDmaintenanceEnables AI assistants to manage MySQL databases through natural language commands. Supports database operations, table management, data queries, and import/export functionality with built-in security features.1519 npm1MIT
- AlicenseBqualityDmaintenanceProvides comprehensive MySQL database operations including CRUD, performance optimization, health analysis, and anomaly detection. Supports multiple connection modes, OAuth2.0 authentication, and role-based permissions for database management through natural language.91MIT
- 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.362 npmMIT
- AlicenseCqualityDmaintenanceEnables monitoring and administration of MySQL databases through natural language, supporting multiple simultaneous connections, health checks, and full DDL/DML/DCL operations.3926 npmMIT