Model Context Protocol server for MySQL database access.
- Execute SQL queries with prepared statements
- List database tables
- Describe table schemas
- Get table statistics (row counts, sizes)
- Connection pooling for performance
npm install
npm run buildConfigure via environment variables:
MYSQL_HOST- MySQL server hostname (default: localhost)MYSQL_PORT- MySQL server port (default: 3306)MYSQL_USER- MySQL username (default: root)MYSQL_PASS- MySQL password (default: empty)MYSQL_DB- MySQL database name (default: empty)
Add to .claude/.mcp.json:
{
"mcpServers": {
"mysql": {
"command": "node",
"args": [
"/path/to/mysql-mcp-server/dist/server.js"
],
"env": {
"MYSQL_HOST": "your-host",
"MYSQL_PORT": "3306",
"MYSQL_USER": "your-user",
"MYSQL_PASS": "your-password",
"MYSQL_DB": "your-database"
}
}
}
}Execute any SQL query with optional prepared statement parameters.
Example:
SELECT * FROM users WHERE id = ?List all tables in the current database.
Get the schema/structure of a specific table.
Get detailed table information including row counts and sizes.
MIT