- Home
- MCP servers
- MySQL
MySQL
- javascript
59
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": {
"dpflucas-mysql-mcp-server": {
"command": "npx",
"args": [
"mysql-mcp-server"
],
"env": {
"MYSQL_HOST": "your-mysql-host",
"MYSQL_PORT": "3306",
"MYSQL_USER": "your-mysql-user",
"MYSQL_DATABASE": "your-default-database",
"MYSQL_MAX_IDLE": "10",
"MYSQL_PASSWORD": "your-mysql-password",
"MYSQL_QUEUE_LIMIT": "0",
"MYSQL_IDLE_TIMEOUT": "60000",
"MYSQL_CONNECT_TIMEOUT": "10000",
"MYSQL_CONNECTION_LIMIT": "10"
}
}
}
}You can grant read-only access to your MySQL databases through this MCP server. It lets you list databases, explore table structures, and run safe, read-only queries from an MCP-enabled client. This makes it easier to integrate MySQL data into your MCP-powered workflows without risking data modification.
How to use
To use the MySQL MCP Server with your MCP client, connect as you would with any MCP server configured in your environment. You will access read-only capabilities such as listing databases, listing tables in a database, describing table schemas, and executing read-only SQL queries. Use the provided tools to fetch data on demand and keep queries lightweight and safe.
How to install
Prerequisites: you need Node.js and npm installed on your system.
Step 1: Install the MCP server package globally or locally.
# Install globally
npm install -g mysql-mcp-server
# Or install locally in your project
npm install mysql-mcp-server
Add to MCP settings
Configure the MCP settings to run the server as an MCP endpoint. You can choose between running via npm using npx or running from source with node. The following configurations show both options.
{
"mcpServers": {
"mysql": {
"command": "npx",
"args": ["mysql-mcp-server"],
"env": {
"MYSQL_HOST": "your-mysql-host",
"MYSQL_PORT": "3306",
"MYSQL_USER": "your-mysql-user",
"MYSQL_PASSWORD": "your-mysql-password",
"MYSQL_DATABASE": "your-default-database"
},
"disabled": false,
"autoApprove": []
}
}
}
{
"mcpServers": {
"mysql": {
"command": "node",
"args": ["/path/to/mysql-mcp-server/build/index.js"],
"env": {
"MYSQL_HOST": "your-mysql-host",
"MYSQL_PORT": "3306",
"MYSQL_USER": "your-mysql-user",
"MYSQL_PASSWORD": "your-mysql-password",
"MYSQL_DATABASE": "your-default-database"
},
"disabled": false,
"autoApprove": []
}
}
}
Environment variables you will use
Set these values to connect to your MySQL server. You can place them in the MCP settings above.
MYSQL_HOST=your-mysql-host
MYSQL_PORT=3306
MYSQL_USER=your-mysql-user
MYSQL_PASSWORD=your-mysql-password
MYSQL_DATABASE=your-default-database
Available tools
list_databases
Lists all accessible databases on the MySQL server.
list_tables
Lists all tables in a specified database; if no database is provided, the default is used.
describe_table
Shows the schema for a specific table, including column definitions and types.
execute_query
Executes a read-only SQL query such as SELECT, SHOW, DESCRIBE, or EXPLAIN against the default or a specified database.