mysql-mcp-server
Enables natural language querying of MySQL databases via Claude Code, allowing SELECT queries, table listing, and schema inspection.
README
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
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-server
Then 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 install
Then 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.json - Windows:
%USERPROFILE%\.claude.json
Environment Variables
| Variable | Description | Default |
|---|---|---|
MYSQL_HOST |
MySQL server hostname | localhost |
MYSQL_PORT |
MySQL server port | 3306 |
MYSQL_USER |
MySQL username | root |
MYSQL_PASSWORD |
MySQL password | (empty) |
MYSQL_DATABASE |
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 statements - The
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 install
Testing Locally
MYSQL_HOST=localhost \
MYSQL_USER=root \
MYSQL_PASSWORD=your_password \
MYSQL_DATABASE=your_database \
node index.js
The server communicates via stdio using the MCP protocol.
Changelog
See CHANGELOG.md for version history.
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.