mysql-mcp-server
Allows querying and exploring a MySQL database, including executing SELECT queries, listing tables, and describing table schemas.
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 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.
MySQL MCP Server
A Model Context Protocol (MCP) server that connects Claude Code to MySQL databases. Once configured, you can query your database using natural language directly in Claude Code.
Features
query: Execute SELECT queries on your MySQL database
list_tables: List all tables in the database
describe_table: Get the schema/structure of a specific table
Related MCP server: mcp-mysql-server
Quick Start
Choose one of the installation methods below, then add the configuration to Claude Code.
Option 1: Using npx
No installation needed. Add this to your Claude Code config:
{
"mcpServers": {
"mysql": {
"type": "stdio",
"command": "npx",
"args": ["-y", "mysql-mcp-server"],
"env": {
"MYSQL_HOST": "localhost",
"MYSQL_PORT": "3306",
"MYSQL_USER": "your_username",
"MYSQL_PASSWORD": "your_password",
"MYSQL_DATABASE": "your_database"
}
}
}
}Option 2: Install globally from npm
npm install -g mysql-mcp-serverThen add this to your Claude Code config:
{
"mcpServers": {
"mysql": {
"type": "stdio",
"command": "mysql-mcp-server",
"args": [],
"env": {
"MYSQL_HOST": "localhost",
"MYSQL_PORT": "3306",
"MYSQL_USER": "your_username",
"MYSQL_PASSWORD": "your_password",
"MYSQL_DATABASE": "your_database"
}
}
}
}Option 3: Clone from GitHub
git clone https://github.com/Nordstrom-Sandbox/mysql-mcp-server.git
cd mysql-mcp-server
npm installThen add this to your Claude Code config (use the actual path where you cloned it):
{
"mcpServers": {
"mysql": {
"type": "stdio",
"command": "node",
"args": ["/full/path/to/mysql-mcp-server/index.js"],
"env": {
"MYSQL_HOST": "localhost",
"MYSQL_PORT": "3306",
"MYSQL_USER": "your_username",
"MYSQL_PASSWORD": "your_password",
"MYSQL_DATABASE": "your_database"
}
}
}
}Configuration
Claude Code Config Location
macOS/Linux:
~/.claude.jsonWindows:
%USERPROFILE%\.claude.json
Environment Variables
Variable | Description | Default |
| MySQL server hostname | localhost |
| MySQL server port | 3306 |
| MySQL username | root |
| MySQL password | (empty) |
| Database name | (required) |
Restart Claude Code
After adding the configuration, restart Claude Code for the changes to take effect. Claude Code automatically starts and manages the MCP server - you don't need to run it manually.
Usage Examples
Once configured, just talk to Claude naturally:
"Show me all the tables in the database"
"What's the schema of the users table?"
"Show me the first 10 users"
"Update the status to 'active' for user_id 123"
Security Notes
Never commit credentials to version control
Use read-only database users when possible
The
querytool only allows SELECT statementsThe
executetool can run INSERT/UPDATE/DELETE - use with caution
Troubleshooting
Connection Issues
Verify MySQL is running
Check credentials are correct
Ensure the database exists
Check firewall settings for remote servers
Look at Claude Code logs for error messages
Permission Issues
Ensure the MySQL user has appropriate grants for the database
Check that the database name is correct
For Contributors
Development Setup
git clone https://github.com/Nordstrom-Sandbox/mysql-mcp-server.git
cd mysql-mcp-server
npm installTesting Locally
MYSQL_HOST=localhost \
MYSQL_USER=root \
MYSQL_PASSWORD=your_password \
MYSQL_DATABASE=your_database \
node index.jsThe server communicates via stdio using the MCP protocol.
Changelog
See CHANGELOG.md for version history.
This server cannot be deployed
Maintenance
Related MCP Connectors
Query 40 databases from Claude, ChatGPT, or Cursor — on any device. Read-only, encrypted, audited.
Query your warehouse or a CSV with Claude/ChatGPT over MCP, governed by table-level ACL + audit.
- dataOAuthco.thinair
PostgreSQL, MySQL, and SQL Server in one session. 26 read-only MCP tools for AI agents.
Ask data questions in natural language. Get SQL, insights, and charts from your databases.
Related MCP Servers
- FlicenseNot gradedqualityDmaintenanceA natural language interface that allows Claude to execute SQL queries on your local MySQL databases, enabling database interaction using natural language.5-
- AlicenseAqualityDmaintenanceEnables Claude Code to directly operate MySQL databases through natural language, supporting multi-environment profiles, security modes, and 11 tools.1114 npm2Apache 2.0
- FlicenseNot gradedqualityDmaintenanceEnables Claude to interact with a MySQL database by automatically discovering its schema and retrieving full table data for analysis.-
- AlicenseNot gradedqualityDmaintenanceEnables Claude AI to execute MySQL queries, list tables, and describe table structures through natural language, with support for parameterized queries and connection pooling.133 npmMIT