MySQL Query MCP Server
About
MySQL Query MCP server for AI assistants - execute read-only MySQL queries
Details
- License
- MIT
Explore
- Read-only MySQL queries (SELECT, SHOW, DESCRIBE)
- Predefined environments: local, development, staging, production
- SSL support for secure database connections
- Query timeout to prevent long-running operations
- Database information and metadata retrieval
- Lists available database environments
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 Query 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
npm install -g mysql-query-mcp-server
Create or edit your MCP configuration file (e.g., .cursor/mcp.json for Cursor IDE):
Basic Configuration:
json{
"mysql": {
"name": "MySQL Query MCP",
"description": "MySQL read-only query access through MCP",
"type": "bin",
"enabled": true,
"bin": "mysql-query-mcp"
}
}
Comprehensive Configuration with Database Credentials:
json{
"mysql": {
"command": "npx",
"args": ["mysql-query-mcp-server@latest"],
"env": {
"LOCAL_DB_HOST": "localhost",
"LOCAL_DB_USER": "root",
"LOCAL_DB_PASS": "<YOUR_LOCAL_DB_PASSWORD>",
"LOCAL_DB_NAME": "your_database",
"LOCAL_DB_PORT": "3306",
"DEVELOPMENT_DB_HOST": "dev.example.com",
"DEVELOPMENT_DB_USER": "<DEV_USER>",
"DEVELOPMENT_DB_PASS": "<DEV_PASSWORD>",
"DEVELOPMENT_DB_NAME": "your_database",
"DEVELOPMENT_DB_PORT": "3306",
"STAGING_DB_HOST": "staging.example.com",
"STAGING_DB_USER": "<STAGING_USER>",
"STAGING_DB_PASS": "<STAGING_PASSWORD>",
"STAGING_DB_NAME": "your_database",
"STAGING_DB_PORT": "3306",
"PRODUCTION_DB_HOST": "prod.example.com",
"PRODUCTION_DB_USER": "<PRODUCTION_USER>",
"PRODUCTION_DB_PASS": "<PRODUCTION_PASSWORD>",
"PRODUCTION_DB_NAME": "your_database",
"PRODUCTION_DB_PORT": "3306",
"DEBUG": "false",
"MCP_MYSQL_SSL": "true",
"MCP_MYSQL_REJECT_UNAUTHORIZED": "false",
"MYSQL_TIMEZONE": "Z"
}
}
}
There are two ways to configure the MySQL MCP server:
1. Binary Configuration (type: "bin", bin: "mysql-query-mcp")
- When to use: When you've installed the package globally (npm install -g mysql-query-mcp-server)
- Pros: Simpler configuration
- Cons: Requires global installation
2. Command Configuration (command: "npx", args: ["mysql-query-mcp-server@latest"])
- When to use: When you want to use the latest version without installing it globally
- Pros: No global installation required, all configuration in one file
- Cons: More complex configuration
Choose the approach that best fits your workflow. Both methods will work correctly with any AI assistant that supports MCP.
- You must use the full environment names: LOCAL_, DEVELOPMENT_, STAGING_, PRODUCTION_
- Abbreviations like DEV_ or PROD_ will not work
- Global settings like DEBUG, MCP_MYSQL_SSL apply to all environments
- At least one environment (typically "local") must be configured
- You only need to configure the environments you plan to use
- For security reasons, consider using environment variables or secure credential storage for production credentials
- DATETIME, DATE, and TIMESTAMP columns are returned as strings to preserve the exact value stored in MySQL without host timezone shifting
| Environment Variable | Description | Default |
|---------------------|-------------|---------|
| DEBUG | Enable debug logging | false |
| [ENV]_DB_HOST | Database host for environment | - |
| [ENV]_DB_USER | Database username | - |
| [ENV]_DB_PASS | Database password | - |
| [ENV]_DB_NAME | Database name | - |
| [ENV]_DB_PORT | Database port | 3306 |
| [ENV]_DB_SSL | Enable SSL connection | false |
| MCP_MYSQL_SSL | Enable SSL for all connections | false |
| MCP_MYSQL_REJECT_UNAUTHORIZED | Verify SSL certificates | true |
| MYSQL_TIMEZONE | Timezone mysql2 uses when sending JavaScript Date values in queries | Z |
List all configured environments from your configuration:
Use the environments tool to show me which database environments are available.
```
The MySQL Query MCP server provides three main tools:
Claude Desktop / Cursor
Paste into your MCP client config file to install this server.
{
"mcpServers": {
"mysql query mcp server": {
"mysql-query-mcp-server": {
"command": "npx",
"args": [
"mysql-query-mcp-server"
]
}
}
}
}
McpServers
{
"mysql-query-mcp-server": {
"command": "npx",
"args": [
"mysql-query-mcp-server"
]
}
}
A Model Context Protocol (MCP) server that provides read-only MySQL database queries for AI assistants. Execute queries, explore database structures, and investigate your data directly from your AI-powered tools.
<a href="https://glama.ai/mcp/servers/@devakone/mysql-query-mcp-server">
</a>
Supported AI Tools
This MCP server works with any tool that supports the Model Context Protocol, including:
- Cursor IDE: Set up in .cursor/mcp.json
- Anthropic Claude: Use with a compatible MCP client
- Other MCP-compatible AI assistants: Follow the tool's MCP configuration instructions
Features & Limitations
What It Does
- ✅ Execute read-only MySQL queries (SELECT, SHOW, DESCRIBE only) - ✅ Work with predefined environments (local, development, staging, production) - ✅ Provide database information and metadata - ✅ List available database environments - ✅ Support SSL connections for secure database access - ✅ Implement query timeouts to prevent long-running operationsWhat It Doesn't Do
- ❌ Execute write operations (INSERT, UPDATE, DELETE, CREATE, ALTER, etc.) - ❌ Support custom environment names (limited to local, development, staging, production) - ❌ Provide database design or schema generation capabilities - ❌ Function as a full database management toolThis tool is designed specifically for data investigation and exploration through read-only queries. It is not intended for database administration, schema management, or data modification.

Quick Install
```bash
Sign in to leave a review
Use Google, GitHub, or an email account so ratings stay tied to real people.
No reviews posted yet.



