mysql mcp
A natural language interface that allows Claude to execute SQL queries on your local MySQL databases, enabling database interaction using natural language.
A natural language interface that allows Claude to execute SQL queries on your local MySQL databases, enabling database interaction using natural language.
A natural language interface to your local MySQL databases through Claude Desktop. This MCP (Machine Communication Protocol) server allows Claude to execute SQL queries on your local MySQL databases, enabling you to interact with your databases using natural language.
Clone this repository:
git clone [email protected]:meanands/mysql-mcp.git
cd mysql-mcp
Create and activate a virtual environment:
# For macOS/Linux
python -m venv venv
source venv/bin/activate
# For Windows
python -m venv venv
venvScriptsactivate
Install dependencies:
pip install -r requirements.txt
Create a .env
file in the project root with your MySQL credentials:
MYSQL_HOST=localhost
MYSQL_USER=your_username
MYSQL_PASSWORD=your_password
Update the directory path in run.sh
:
# Open run.sh and replace this line:
cd /Users/yourname/code/sql-mcp
# with your actual project directory path, for example:
cd /Users/yourname/projects/mysql-mcp
Make the run script executable:
chmod +x run.sh
{
"sql": {
"command": "/absolute/path/to/your/mysql-mcp/run.sh"
}
}
Replace /absolute/path/to/your/mysql-mcp
with the actual absolute path to your project directory.Once configured, you can interact with your databases through Claude Desktop using natural language. Examples:
Selecting a database and creating a table:
Use the 'employees' database and create a table for storing employee information with fields for name, email, and department.
Inserting data:
Insert a new employee named John Doe with email [email protected] in the Engineering department.
Querying data:
Show me all employees in the Engineering department.