MySQL MCP Server
Enables AI agents to interact with a MySQL database using natural language, automating SQL tasks like querying, inserting, updating, and deleting data.
README
š¬ MySQL MCP Server (FastMCP-Powered)
Leverage the power of AI to automate your MySQL workflows with FastMCP.
This tool enables AI agents like Claude, OpenAI, or DeepSeek to interact with your MySQL database using natural language, making database management seamless and intelligent.
Whether you're generating synthetic data, querying your tables, or performing updates, this MCP server allows AI to operate on your database through standardized interfaces ā all from your local machine.
š Best use for generating synthetic data for testing your apis.
š” Key Features
- Automates SQL tasks via AI (Claude, OpenAI, DeepSeek, etc.)
- Works over Stdio, ideal for local desktop integration
- Generates synthetic data based on your schema and recent values
- No manual SQL knowledge required
- Highly useful for test environments and data prototyping
š ļø Supported Tools
| Tool | Description |
|---|---|
get_column_names(table_name) |
Retrieve all column names of a table |
get_all_table_names() |
List all table names in the database |
select(...) |
Fetch records from any table |
insert(...) |
Insert data into a table |
update(...) |
Update records with conditions |
delete(...) |
Delete records based on criteria |
These are internally used by the AI to understand and manipulate your database efficiently.
āļø Configuration & Setup
š Prerequisites
- Python 3.10+
- MySQL (running locally or remotely)
- Anthropic Claude Desktop app (or Cursor)
- UV (Python package manager), install with
curl -LsSf https://astral.sh/uv/install.sh | sh
Steps
-
Clone this repository
git clone https://github.com/Ashutosh-rajput/mysql-mcp.git cd mysql-mcp uv pip install -r requirements.txt -
Fill the .env
MYSQL_HOST=localhost MYSQL_PORT=3306 MYSQL_USER=root MYSQL_PASSWORD=yourpassword MYSQL_DATABASE=yourdatabase -
Connect to the MCP server
Copy the below json with the appropriate {{PATH}} values:
{ "mcpServers": { "Mysql": { "command": "[path to uv]/uv", "args": [ "run", "--with", "fastmcp", "--with", "mysql-connector-python", "--with", "python-dotenv", "fastmcp", "run", "[path to your main.py]/main.py" ] } } }For Claude, save this as
claude_desktop_config.jsonin your Claude Desktop configuration directory at:~/Library/Application Support/Claude/claude_desktop_config.jsonFor Cursor, save this as
mcp.jsonin your Cursor configuration directory at:~/.cursor/mcp.json -
Restart Claude Desktop / Cursor
Open Claude Desktop and you should now see WhatsApp as an available integration.
Or restart Cursor.
š§ Tip
Use this project as a backbone to build intelligent, event-driven Mysql bots, agents.
š License
MIT License. Feel free to use and modify as per your needs.
š¤ Author: Ashutosh Rajput
š Project: MySql-MCP
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.