Provides MCP endpoints to connect, query, and manage MySQL databases directly from Cursor IDE.
Configuration
View docs{
"mcpServers": {
"ashenud-mcp-mysql-server": {
"url": "https://mcp.example.com/mcp",
"headers": {
"MYSQL_SSL": "true",
"MYSQL_HOST": "localhost",
"MYSQL_PORT": "3306",
"MYSQL_USER": "root",
"MYSQL_DATABASE": "mydb",
"MYSQL_PASSWORD": "pa$$w0rd"
}
}
}
}You can connect to MySQL databases, run queries, and inspect schemas directly from Cursor using this MCP server. It provides secure, typed access with connection pooling and easy configuration, so you can manage databases from within your development environment without leaving your IDE.
To use this MCP server, configure your MCP client to launch the server process with the appropriate environment variables. Once running, you can connect to a MySQL database, execute queries, list databases and tables, and inspect table schemas from your Cursor workspace. Use the provided tools to perform common database tasks without writing client-side boilerplate.
Prerequisites: You need Node.js 18.0.0 or higher and npm or yarn installed on your system.
Step 1: Install the MCP MySQL server globally.
npm install -g @ashenud/mcp-mysql-serverStep 2: Prepare your environment with your MySQL credentials. You will provide these to the server via environment variables when you start it.
MYSQL_HOST=localhost
MYSQL_PORT=3306
MYSQL_USER=your_username
MYSQL_PASSWORD=your_password
MYSQL_DATABASE=your_databaseStep 3: Start the MCP MySQL server. The command to run is the package command you installed, with the environment variables set as above.
MYSQL_HOST=localhost MYSQL_PORT=3306 MYSQL_USER=your_username MYSQL_PASSWORD=your_password MYSQL_DATABASE=your_database @ashenud/mcp-mysql-serverYou configure the server by providing MySQL connection details through environment variables when you start the server. The following variables are used:
- MYSQL_HOST: Default MySQL host (e.g., localhost)
- MYSQL_PORT: MySQL port (e.g., 3306)
- MYSQL_USER: MySQL username
- MYSQL_PASSWORD: MySQL password
- MYSQL_DATABASE: Default database name
- MYSQL_SSL: Use SSL for the connection (true/false)
The MCP server exposes a set of tools you can call from your Cursor workspace to interact with MySQL.
Establish a connection to a MySQL database using specified host, port, user, password, and optional SSL and pool settings.
Execute a SQL query with optional parameters for prepared statements and receive structured results.
Retrieve a list of all available databases on the connected MySQL server.
List tables in a given database or the current database if none is provided.
Return the schema and column details for a specified table, with optional database context.
Close the active MySQL connection and release resources.