MySQL MCP Server
Provides tools for interacting with a MySQL database, including listing tables, describing schemas, fetching data with filters and pagination, updating, deleting, truncating, and bulk modifications with safety constraints.
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., "@MySQL MCP ServerShow me all tables"
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 Server
A Model Context Protocol (MCP) server that provides structured MySQL database operations for Claude Desktop. Converts natural language database requests into safe, parameterized queries.
Features
7 tools:
list_tables,describe_table,fetch,update,delete,truncate,modify_bulkSafety first: No raw SQL, parameterized queries, identifier sanitization
Guard rails: UPDATE/DELETE require filters, TRUNCATE requires confirmation
Preview mode: Bulk operations show impact before executing
Stdio transport: Designed for Claude Desktop integration
Project Structure
mysql-mcp/
├── package.json
└── src/
├── index.js # MCP server entry point (stdio transport)
├── db.js # MySQL connection pool
├── tools.js # Tool definitions (JSON Schema)
└── handlers.js # Tool execution logic + safety checksSetup
1. Install dependencies
cd mysql-mcp
npm install2. Configure Claude Desktop
Open your Claude Desktop config file:
Windows:
%APPDATA%\Claude\claude_desktop_config.jsonmacOS:
~/Library/Application Support/Claude/claude_desktop_config.json
Add this to the mcpServers section:
{
"mcpServers": {
"mysql": {
"command": "node",
"args": ["D:/100xDev/mysql-mcp/src/index.js"],
"env": {
"DB_HOST": "localhost",
"DB_PORT": "3306",
"DB_USER": "root",
"DB_PASSWORD": "your_password_here",
"DB_NAME": "your_database_name"
}
}
}
}Important: Use the full absolute path to
index.jsin theargsarray. Update theenvvalues to match your MySQL setup.
3. Restart Claude Desktop
Close and reopen Claude Desktop. You should see the MySQL tools available in the tools menu.
Available Tools
Tool | Description |
| Show all tables in the database |
| Show column structure of a table |
| SELECT with filters, sorting, pagination |
| UPDATE with required filters |
| DELETE with required filters |
| Drop all rows (requires |
| Deduplicate, normalize, or cleanup data |
Safety Rules
No raw SQL — All queries are built from structured input
Identifier sanitization — Table/column names are validated against
[a-zA-Z_][a-zA-Z0-9_]*Parameterized queries — All values use
?placeholders (no SQL injection)UPDATE requires filters — Cannot update all rows accidentally
DELETE requires filters — Cannot delete all rows accidentally
TRUNCATE requires confirmation — Must pass
confirm: trueBulk operations preview first — Shows impact before executing
Row limit cap — Fetch is capped at 1000 rows max
Example Prompts
Once connected in Claude Desktop, you can use natural language:
"Show me all tables"
"What columns does the users table have?"
"Get all users where status is active"
"Update the name to 'Zoher' where id is 5"
"Delete all orders where status is cancelled"
"Find duplicate entries in users by email"
"Normalize status values: replace 'actve' with 'active' in users"
Environment Variables
Variable | Default | Description |
|
| MySQL host |
|
| MySQL port |
|
| MySQL username |
|
| MySQL password |
|
| Database name |
This server cannot be installed
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/zoherr/mysql-mcp-server'
If you have feedback or need assistance with the MCP directory API, please join our Discord server