easy-mysql-mcp
Allows AI assistants to inspect and query a MySQL database through a safe, structured tool interface, including schema discovery, query execution, and privilege inspection.
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., "@easy-mysql-mcpdescribe the users table"
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.
easy-mysql-mcp
A lightweight Model Context Protocol (MCP) server that lets AI assistants inspect and query a MySQL database through a safe, structured tool interface.
This project uses Node.js, TypeScript, the official MCP SDK, and mysql2/promise. It runs over stdio, so it can be used directly by MCP clients such as Claude Desktop.
Features
MySQL connection pooling powered by
mysql2/promiseRead-only query tool for data retrieval
Execute tool for data modification statements
Schema discovery tools for tables, views, indexes, and triggers
Query plan inspection with
EXPLAINCurrent user and privilege inspection
stdout protection to prevent non-MCP logs from polluting the stdio protocol
Requirements
Node.js 18 or newer
npm
A reachable MySQL-compatible database
Installation
Run the server directly with npx:
npx -y easy-mysql-mcpFor local development after cloning the repository:
cd easy-mysql-mcp
npm install
npm run buildConfiguration
Configure the server with environment variables. You can provide them through your MCP client configuration or by creating a local .env file.
Variable | Required | Default | Description |
| Yes | - | MySQL host name or IP address |
| No |
| MySQL port |
| Yes | - | MySQL user name |
| Yes | - | MySQL password |
| Yes | - | Default database/schema |
| No |
| Maximum number of active pool connections |
| No |
| Maximum number of idle pool connections |
| No |
| Idle connection timeout in milliseconds |
| No |
| Maximum queued connection requests, where |
| No |
| Whether the pool waits when all connections are busy |
| No |
| Whether TCP keep-alive is enabled |
| No |
| Initial TCP keep-alive delay in milliseconds |
Example .env:
MYSQL_HOST=localhost
MYSQL_PORT=3306
MYSQL_USER=root
MYSQL_PASSWORD=your_password
MYSQL_DATABASE=your_databaseUsage
Configure your MCP client to launch the package through npx.
For local development, build the TypeScript source first:
npm run buildStart the MCP server:
npm startThe server communicates over stdio and is normally launched by an MCP client rather than run manually.
Claude Desktop Example
Add the server to your claude_desktop_config.json:
{
"mcpServers": {
"easy-mysql-mcp": {
"command": "npx",
"args": ["-y", "easy-mysql-mcp"],
"env": {
"MYSQL_HOST": "localhost",
"MYSQL_PORT": "3306",
"MYSQL_USER": "root",
"MYSQL_PASSWORD": "your_password",
"MYSQL_DATABASE": "your_database"
}
}
}
}Restart Claude Desktop after updating the configuration.
Available Tools
Tool | Description |
| Execute a SQL query intended for data retrieval, such as |
| Execute a data modification statement, such as |
| Run |
| List base tables in the current database, including approximate row counts and comments |
| List views in the current database |
| Show column information for one or more tables |
| Show indexes for a table |
| List triggers in the current database |
| Show the current MySQL user and grants |
Security Notes
Use a dedicated MySQL user with the minimum permissions your assistant needs.
Prefer read-only database credentials if you only need inspection and reporting.
Be careful with
mysql_execute, because it can modify data.Do not commit
.envfiles or real database credentials to GitHub.Review generated SQL before running it against production data.
Development
npm run devThis runs TypeScript in watch mode.
To create a production build:
npm run buildProject Structure
src/
db.ts MySQL pool and query helpers
index.ts MCP server and tool registration
proxy.ts stdout protection for stdio-based MCP transportLicense
ISC
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/chenkumi/easy-mysql-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server