MySQL MCP Server
About
A Model Context Protocol (MCP) server that provides secure MySQL database operations for AI assistants and other MCP clients. It exposes tools and resources for querying, inserting, and inspecting MySQL databases, with built‑in security restrictions that prevent destructive…
Details
- Author
- SuMiaoALi
- Downloads
- 334
- Categories
- Database
Jump to
- Tools: execute_query, get_table_info, insert_data, list_tables
- Resources: database metadata and per‑table schema information
- Only allows SELECT, INSERT, SHOW, and DESCRIBE operations
- SQL injection protection via parameterized queries
- Automatic LIMIT clauses on SELECT queries to prevent large data dumps
- Connection pooling for efficient resource management
Setting up with Highlight
This MCP is not yet compatible with Highlight’s one-click setup. However, you can still use it with Highlight by following these steps:
- Download and install Highlight from highlightai.com/download
- Navigate to the plugins tab and select "Add Custom Plugin"
-
Configure the plugin with the settings below
Plugin Name
MySQL MCP ServerCommand (node, npx, python, etc.)Please refer to the README for specific instructions on how to obtain API keys or other required environment variables.
- Enable "Start Automatically" if you want the plugin to start when Highlight launches
From the repository
Install via npm: npm install mysql-mcp-server. Configure using environment variables (MYSQL_HOST, MYSQL_PORT, MYSQL_USER, MYSQL_PASSWORD, MYSQL_DB, MYSQL_TIMEZONE). Integrate with MCP clients such as Claude Desktop by adding the server to the client’s configuration file, or run standalone with npx mysql-mcp-server using stdio transport.
Claude Desktop / Cursor
Paste into your MCP client config file to install this server.
{
"mcpServers": {
"mysql mcp server": {
"mysql-mcp-server-sumiaoali": {
"command": "npx",
"args": [
"mysql-mcp-server"
]
}
}
}
}
McpServers
{
"mysql-mcp-server-sumiaoali": {
"command": "npx",
"args": [
"mysql-mcp-server"
]
}
}
MySQL MCP Server
A Model Context Protocol (MCP) server that provides secure MySQL database operations for AI assistants and other MCP clients.
Features
🛠️ Tools
- execute_query - Execute safe SQL queries (SELECT, INSERT, SHOW, DESCRIBE) - get_table_info - Get detailed table structure information - insert_data - Convenient data insertion with automatic parameterization - list_tables - List all tables in the database📊 Resources
- Database Info (mysql://database/info) - Database metadata and table list
- Table Structure (mysql://table/{table_name}) - Detailed table schema information
🔒 Security Features
- Limited Operations: Only allows safe operations (SELECT, INSERT, SHOW, DESCRIBE) - SQL Injection Protection: Uses parameterized queries - Automatic LIMIT: Adds LIMIT clauses to SELECT queries to prevent large data dumps - Connection Pooling: Efficient database connection managementInstallation
npm install mysql-mcp-server
Configuration
The server can be configured using environment variables:
| Variable | Default | Description |
|----------|---------|-------------|
| MYSQL_HOST | localhost | MySQL server hostname |
| MYSQL_PORT | 3306 | MySQL server port |
| MYSQL_USER | root | MySQL username |
| MYSQL_PASSWORD | _(empty)_ | MySQL password |
| MYSQL_DB | mysql | Default database name |
| MYSQL_TIMEZONE | +00:00 | MySQL timezone |
Usage with MCP Clients
Claude Desktop
Add to your Claude Desktop configuration file:
macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
Windows: %APPDATA%/Claude/claude_desktop_config.json
{
"mcpServers": {
"mysql": {
"command": "npx",
"args": ["mysql-mcp-server"],
"env": {
"MYSQL_HOST": "your-mysql-host",
"MYSQL_PORT": "3306",
"MYSQL_USER": "your-username",
"MYSQL_PASSWORD": "your-password",
"MYSQL_DB": "your-database"
}
}
}
}
Other MCP Clients
For other MCP clients, use the server with stdio transport:
npx mysql-mcp-server
Development
Prerequisites
- Node.js 18+ - TypeScript - Access to a MySQL databaseSetup
1. Clone the repository:
git clone https://github.com/your-username/mysql-mcp-server.git
cd mysql-mcp-server
2. Install dependencies:
npm install
3. Set up environment variables:
```bash
cp .env.example .env
Sign in to leave a review
Use Google, GitHub, or an email account so ratings stay tied to real people.
No reviews posted yet.



