mysql-mcp-server

mysql-mcp-server

Enables natural language querying of MySQL databases via Claude Code, allowing SELECT queries, table listing, and schema inspection.

Category
Visit Server

README

MySQL MCP Server

License: MIT

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

  1. Never commit credentials to version control
  2. Use read-only database users when possible
  3. The query tool only allows SELECT statements
  4. The execute tool can run INSERT/UPDATE/DELETE - use with caution

Troubleshooting

Connection Issues

  1. Verify MySQL is running
  2. Check credentials are correct
  3. Ensure the database exists
  4. Check firewall settings for remote servers
  5. 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

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.

Official
Featured
TypeScript
Magic Component Platform (MCP)

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.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

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.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

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.

Official
Featured
TypeScript
Kagi MCP Server

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.

Official
Featured
Python
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

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.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured