- Home
- MCP servers
- MySQL
MySQL
- javascript
7
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": {
"leonmelamud-mysql-mcp": {
"command": "node",
"args": [
"/path/to/mysql-server/build/index.js"
],
"env": {
"MYSQL_HOST": "localhost",
"MYSQL_USER": "your_username",
"MYSQL_DATABASE": "your_database",
"MYSQL_PASSWORD": "your_password"
}
}
}
}You run a MySQL MCP Server that lets AI agents connect to your MySQL databases, run SQL queries, and manage content through a straightforward interface. It exposes common database actions as tools and keeps data accessible via simple URIs and plain text content.
How to use
You interact with the server through an MCP client to perform actions such as listing tables, describing table structures, executing SQL, and creating notes stored in the database. The available tools are designed to be intuitive and cover the core database tasks you need for AI-assisted data management.
Key capabilities you can leverage in conversations include: - Listing all tables in your connected database. - Describing the schema of a specific table. - Executing custom SQL queries directly. - Creating text notes that are stored inside the MySQL database and retrievable via note:///{id} URIs. - Accessing note titles and content as plain text.
To access a note, reference its URI in your queries or prompts, and obtain the title and content as plain text. Use execute_sql for complex queries, and describe_table to inspect table structures before querying.
How to install
Prerequisites you need before installing: - Node.js 18 or higher - MySQL server installed and running - A database with appropriate permissions for access and manipulation
Step-by-step setup flow you should follow to get the server running locally:
- Clone this project to your working directory
git clone git@github.com:LeonMelamud/mysql-mcp.git
cd mysql-mcp
- Install dependencies for the server
npm install
- Create a
.envfile in the root directory with your MySQL connection details
MYSQL_HOST=localhost
MYSQL_USER=your_username
MYSQL_PASSWORD=your_password
MYSQL_DATABASE=your_database
- Build the server
npm run build
Additional notes
The MCP server uses a local stdio-based runtime. You invoke it with Node and point to the built entry file. You can run the server directly in your environment using the following configuration snippet.
{
"mcpServers": {
"mysql": {
"type": "stdio",
"command": "node",
"args": ["/path/to/mysql-server/build/index.js"],
"env": {
"MYSQL_HOST": "localhost",
"MYSQL_USER": "your_username",
"MYSQL_PASSWORD": "your_password",
"MYSQL_DATABASE": "your_database"
}
}
}
}
Available tools
create_note
Create a new text note in the database with a title and content.
list_tables
List all tables in the connected database.
count_tables
Return the total number of tables in the database.
search_tables
Search for tables using a LIKE pattern.
describe_table
Get the structure of a specific table.
execute_sql
Execute a custom SQL query against the database.