- Home
- MCP servers
- MySQL Query
MySQL Query
- typescript
10
GitHub Stars
typescript
Language
6 months ago
First Indexed
2 months ago
Catalog Refreshed
Documentation & install
Readme and setup notes from the catalogue, plus a client-ready config you can copy for your MCP host.
Installation
Add the following to your MCP client configuration file.
Configuration
View docs{
"mcpServers": {
"devakone-mysql-query-mcp-server": {
"command": "npx",
"args": [
"mysql-query-mcp-server@latest"
],
"env": {
"DEBUG": "false",
"LOCAL_DB_HOST": "<LOCAL_DB_HOST>",
"LOCAL_DB_NAME": "<LOCAL_DB_NAME>",
"LOCAL_DB_PASS": "<LOCAL_DB_PASS>",
"LOCAL_DB_PORT": "3306",
"LOCAL_DB_USER": "<LOCAL_DB_USER>",
"MCP_MYSQL_SSL": "true",
"STAGING_DB_HOST": "<STAGING_DB_HOST>",
"STAGING_DB_NAME": "<STAGING_DB_NAME>",
"STAGING_DB_PASS": "<STAGING_DB_PASS>",
"STAGING_DB_PORT": "3306",
"STAGING_DB_USER": "<STAGING_DB_USER>",
"PRODUCTION_DB_HOST": "<PRODUCTION_DB_HOST>",
"PRODUCTION_DB_NAME": "<PRODUCTION_DB_NAME>",
"PRODUCTION_DB_PASS": "<PRODUCTION_DB_PASS>",
"PRODUCTION_DB_PORT": "3306",
"PRODUCTION_DB_USER": "<PRODUCTION_DB_USER>",
"DEVELOPMENT_DB_HOST": "<DEVELOPMENT_DB_HOST>",
"DEVELOPMENT_DB_NAME": "<DEVELOPMENT_DB_NAME>",
"DEVELOPMENT_DB_PASS": "<DEVELOPMENT_DB_PASS>",
"DEVELOPMENT_DB_PORT": "3306",
"DEVELOPMENT_DB_USER": "<DEVELOPMENT_DB_USER>",
"MCP_MYSQL_REJECT_UNAUTHORIZED": "false"
}
}
}
}You can run a read-only MCP server that lets AI assistants execute safe, read-only MySQL queries, explore database structures, and investigate data across multiple environments without altering any data. This MCP server is designed for data exploration and verification through natural interactions with your AI tools.
How to use
Use an MCP client to connect to the MySQL Query MCP Server and perform read-only queries against one or more predefined environments. You can run SELECT queries to fetch data, run SHOW commands to inspect metadata, and DESCRIBE tables to understand structure. You can also list available environments and inspect server status. Ensure you select an environment (local, development, staging, or production) and issue queries that do not modify data.
How to install
# Install the MCP server globally
npm install -g mysql-query-mcp-server
# Or run directly with no global install
npx mysql-query-mcp-server
Configuration and usage notes
The server supports two ways to configure how you run it. You can choose either a binary configuration or a command-based configuration. The binary method runs the MCP server executable directly, while the command method uses a package runner like npx to fetch and run the latest version.
# Example: Binary configuration (local run)
command: mysql-query-mcp
args: []
# Example: Command-based configuration (latest version)
command: npx
args: ["mysql-query-mcp-server@latest"]
Security and usage tips
- Only read-only queries are allowed, such as SELECT, SHOW, and DESCRIBE.
- SSL connections are supported for secure access to databases that require encryption.
- Each environment uses its own connection settings and can be configured to time out long-running queries to prevent hangs.
- Use secure credential management for production database credentials.
Environment and credential setup
Configure environments for local, development, staging, and production. You can set environment-specific hosts, users, passwords, database names, and ports. Global settings like DEBUG and SSL controls apply to all environments.
Examples of practical usage patterns
- Quickly fetch a subset of data from a production database for validation by running a read-only query in the production environment.
- Inspect which databases and tables exist in a given environment with DESCRIBE and SHOW commands.
- List all configured environments to verify available data sources before running analyses.
Available tools
query
Execute read-only SQL queries against a chosen environment using SELECT, SHOW, and DESCRIBE statements.
info
Retrieve detailed metadata about the connected database, including server version, status, and variables.
environments
List all configured database environments available for querying.