- Home
- MCP servers
- MCP MySQL Server
MCP MySQL Server
- javascript
5
GitHub Stars
javascript
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": {
"sajithrw-mcp-mysql": {
"command": "npx",
"args": [
"@sajithrw/mcp-mysql@1.0.0"
],
"env": {
"MYSQL_SSL": "false",
"MYSQL_HOST": "localhost",
"MYSQL_PORT": "3306",
"MYSQL_USER": "your_username",
"MYSQL_DATABASE": "your_database",
"MYSQL_PASSWORD": "your_password"
}
}
}
}You can manage MySQL databases through a Model Context Protocol (MCP) server that connects to local or cloud-based MySQL instances, executes queries, inspects schemas, and handles security and errors in a unified way. This MCP server provides practical, chained capabilities for database administration and data analysis from an MCP client or IDE integration.
How to use
Connect to your MySQL instance from an MCP client, then perform common tasks such as listing databases and tables, inspecting table structures, running prepared queries, and viewing table indexes and statistics. Use the server to securely connect to local databases or cloud services like AWS RDS and other cloud MySQL deployments. All interactions are designed to be performed through MCP client tools that issue high-level commands to the server.
How to install
Prerequisites: you need Node.js and npm installed on your machine. You will install the MCP MySQL server package, then run or integrate it into your development environment.
Configuration and usage notes
This server supports running locally via an MCP client using a standard CLI invocation, typically through npx, to ensure you always use the correct version. You can also run the server from a local clone/build path if you prefer not to install globally.
Security considerations
Use SSL/TLS when connecting to production or cloud databases. Do not hardcode credentials; rely on environment variables or secure configuration management. Use database users with minimal required permissions and prefer prepared statements to prevent SQL injection.
Troubleshooting and tips
If the server won’t start, try running it directly with its MCP command to view logs, verify environment variables are set, and check that the target MySQL server is reachable. Ensure the correct version is being used and that SSL settings, host, and port match your database configuration.
Available tools and endpoints
The MCP server exposes dedicated tools for common database tasks such as connecting, querying, listing databases and tables, describing table structures, showing indexes, and retrieving table statistics. Each tool is designed to be called through an MCP client to perform the corresponding database operation.
Notes
When integrating with IDEs or editors, configure the MCP server to point to your MySQL host, port, user, password, and database. Use environment variables to securely supply credentials and enable SSL for production connections.
Available tools
mysql_connect
Connect to a MySQL database using host, port, user, password, and optional database and SSL settings.
mysql_query
Execute a SQL query with support for prepared statements and optional parameters.
mysql_list_databases
List all databases on the connected MySQL server.
mysql_list_tables
List all tables in the current or a specified database.
mysql_describe_table
Describe the schema of a specific table, including columns and types.
mysql_show_indexes
Show indexes for a specific table to understand performance and constraints.
mysql_get_table_stats
Retrieve statistics such as row count and table size for a given table.
mysql_disconnect
Disconnect from the current MySQL connection.