mysql-mcp-server

mysql-mcp-server

Enables MySQL database operations through MCP, including executing SQL queries, listing databases and tables, and describing table structures.

Category
Visit Server

README

šŸ”§ MySQL MCP Server

A Model Context Protocol (MCP) server for MySQL database operations. Provides 4 powerful tools for database interaction through any MCP-compatible client.

✨ Features

  • šŸ” Execute SQL Queries - Run any SELECT, INSERT, UPDATE, DELETE commands
  • šŸ“Š List Databases - View all available databases
  • šŸ“‹ List Tables - Show tables in any database
  • šŸ—ļø Describe Tables - Get detailed table structure information
  • šŸ”’ Secure - Environment-based configuration, no hardcoded credentials
  • ⚔ Fast - Built with TypeScript and connection pooling

šŸš€ Quick Start

Installation

# Clone the repository
git clone https://github.com/myheisenberg/mysql-mcp-server.git
cd mysql-mcp-server

# Install dependencies
npm install

# Build the project
npm run build

Configuration

The server uses environment variables for database configuration:

DB_HOST=localhost        # MySQL host (default: localhost)
DB_USER=root            # MySQL username (default: root)
DB_PASSWORD=            # MySQL password (default: empty)
DB_PORT=3306           # MySQL port (default: 3306)

šŸ“– Usage

With Claude Desktop

Add to your claude_desktop_config.json:

{
  "mcpServers": {
    "mysql": {
      "command": "node",
      "args": ["path/to/mysql-mcp-server/dist/index.js"],
      "env": {
        "DB_HOST": "localhost",
        "DB_USER": "your_username",
        "DB_PASSWORD": "your_password",
        "DB_PORT": "3306"
      }
    }
  }
}

With Cursor IDE

Add to your MCP configuration:

{
  "mcpServers": {
    "mysql": {
      "command": "node",
      "args": ["path/to/mysql-mcp-server/dist/index.js"],
      "env": {
        "DB_HOST": "localhost",
        "DB_USER": "your_username", 
        "DB_PASSWORD": "your_password",
        "DB_PORT": "3306"
      }
    }
  }
}

šŸ› ļø Available Tools

1. mysql_query

Execute any MySQL query and get formatted results.

Example: "Run a SELECT query on the users table"

2. mysql_databases

List all available databases on the MySQL server.

Example: "Show me all databases"

3. mysql_tables

List all tables in a specific database.

Example: "What tables are in the blog database?"

4. mysql_describe

Get detailed information about a table's structure.

Example: "Describe the structure of the users table"

šŸ”§ Development

# Install dependencies
npm install

# Development mode (watch for changes)
npm run dev

# Build for production
npm run build

# Start the server
npm start

šŸ“¦ Project Structure

mysql-mcp-server/
ā”œā”€ā”€ src/
│   └── index.ts          # Main MCP server implementation
ā”œā”€ā”€ dist/                 # Compiled JavaScript (auto-generated)
ā”œā”€ā”€ package.json          # Project dependencies and scripts
ā”œā”€ā”€ tsconfig.json         # TypeScript configuration
ā”œā”€ā”€ .gitignore           # Git ignore rules
└── README.md            # This file

šŸ”’ Security

  • No hardcoded credentials - All database connection details come from environment variables
  • Connection pooling - Efficient and secure database connections
  • Error handling - Proper error messages without exposing sensitive information

šŸ¤ Contributing

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add some amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

šŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

šŸ™ Acknowledgments

šŸ“ž Support

If you encounter any issues or have questions:

  1. Check the Issues page
  2. Create a new issue if your problem isn't already reported
  3. Provide as much detail as possible including error messages and configuration

Made with ā¤ļø for the MCP community

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
Qdrant Server

Qdrant Server

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

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