
MCP MySQL App
A Model Context Protocol (MCP) server that enables AI assistants to interact with MySQL databases by executing SQL queries and checking database connectivity.
README
MCP MySQL App
A Model Context Protocol (MCP) tools server implementation for interacting with MySQL databases through AI interfaces.
Overview
This project provides a set of tools that allow AI systems to connect to and query MySQL databases through the Model Context Protocol. It enables AI assistants to execute SQL queries and check database connectivity.
Features
- Simple but powerful MySQL tool integration
- Type-safe tool definitions
- Enhanced error handling
- Support for handling request abort signals
- Session awareness
Installation
- Clone this repository
- Install dependencies:
npm install
How to Use the Tool
1. Initial Setup
Clone this repository:
git clone <repository-url>
cd mcp-mysql-app
Install dependencies:
npm install
Create a .env
file in the root directory:
MYSQL_HOST=your_mysql_host
MYSQL_USER=your_mysql_username
MYSQL_PASSWORD=your_mysql_password
MYSQL_DATABASE=your_database_name
MYSQL_PORT=3306
Build the project:
npm run build
The dist
folder is now ready to be used for configuration in various AI platforms.
2. Cursor Configuration
Find your Cursor MCP configuration file:
- Windows:
C:\Users\<username>\.cursor\mcp.json
- macOS:
~/.cursor/mcp.json
- Linux:
~/.cursor/mcp.json
Edit the file to add the MySQL MCP server configuration:
{
"mcpServers": {
"mysql": {
"command": "<path-to-node>",
"args": [
"<path-to-project>/dist/index.js"
],
"env": {
"MYSQL_HOST": "your_mysql_host",
"MYSQL_USER": "your_mysql_username",
"MYSQL_PASSWORD": "your_mysql_password",
"MYSQL_DATABASE": "your_database_name",
"MYSQL_PORT": "3306"
}
}
}
}
Replace the placeholders:
<path-to-node>
: Path to your Node.js executable<path-to-project>
: Absolute path to your MCP MySQL App project directory- MySQL environment variables with your actual database connection details
Example configuration:
{
"mcpServers": {
"mysql": {
"command": "C:\\nvm4w\\nodejs\\node.exe",
"args": [
"H:\\mcp\\my-mysql\\dist\\index.js"
],
"env": {
"MYSQL_HOST": "localhost",
"MYSQL_USER": "root",
"MYSQL_PASSWORD": "password123",
"MYSQL_DATABASE": "todo_app",
"MYSQL_PORT": "3306"
}
}
}
}
Save the file and restart Cursor for the changes to take effect.
3. Claude Configuration
To use MCP MySQL Tools with Claude, you need to add configuration to Claude's settings file. Follow these steps:
- Open Claude AI desktop app settings
- Navigate to the "Developer" section
- Look for the "Tools" configuration section
- Add configuration for MySQL MCP as follows:
{
"tools": {
"mysql": {
"command": "<path-to-node>",
"args": [
"<path-to-project>/dist/index.js"
],
"env": {
"MYSQL_HOST": "your_mysql_host",
"MYSQL_USER": "your_mysql_username",
"MYSQL_PASSWORD": "your_mysql_password",
"MYSQL_DATABASE": "your_database_name",
"MYSQL_PORT": "3306"
}
}
}
}
Replace the placeholders:
<path-to-node>
: Path to your Node.js executable<path-to-project>
: Absolute path to your MCP MySQL App project directory- MySQL environment variables with your actual database connection details
Example configuration:
{
"tools": {
"mysql": {
"command": "/usr/local/bin/node",
"args": [
"/Users/username/projects/mcp-mysql-app/dist/index.js"
],
"env": {
"MYSQL_HOST": "localhost",
"MYSQL_USER": "root",
"MYSQL_PASSWORD": "password123",
"MYSQL_DATABASE": "todo_app",
"MYSQL_PORT": "3306"
}
}
}
}
4. Configuration on Other Platforms
The basic principle is the same for other AI platforms that support MCP:
- Find the configuration area for external tools or MCP
- Configure it to run Node.js with the
dist/index.js
file from this repository - Include your MySQL connection details in the environment configuration
Available Tools
After configuration, your AI will have access to the following MySQL tools:
sql_check_connection
- Check if the MySQL connection is workingsql_query
- Execute SQL queries on the connected database
Using MySQL Tools in AI Environments
Once you've configured the MySQL tools in your AI environment, you can start using them by prompting the AI. Here are some examples:
Using MySQL Tools in Cursor
In Cursor, you can simply ask Claude to perform MySQL-related tasks:
- Check if the MySQL connection is working.
- Show me all databases on the server.
- Get all tables from the current database.
- Execute a query to retrieve all users from the users table.
- Update a record in the products table.
Example Workflow: Querying and Manipulating Data
Here's an example workflow showing how you might use these tools:
-
Checking connection:
"Check if the MySQL connection is working."
Claude will use the
sql_check_connection
tool to verify the database connection. -
Viewing databases:
"Show me all the databases on this MySQL server."
Claude will use the
sql_query
tool withSHOW DATABASES;
. -
Exploring tables:
"List all tables in the current database."
Claude will use the
sql_query
tool withSHOW TABLES;
. -
Querying data:
"Show me the first 10 records from the users table."
Claude will use the
sql_query
tool withSELECT * FROM users LIMIT 10;
. -
Creating tables:
"Create a new table named 'products' with columns for id, name, price, and description."
Claude will use the
sql_query
tool to create the table with an appropriate CREATE TABLE statement. -
Inserting data:
"Insert a new product with the name 'Smartphone', price 499.99, and description 'Latest model'."
Claude will use the
sql_query
tool with an INSERT statement. -
Updating records:
"Update the price of the 'Smartphone' product to 449.99."
Claude will use the
sql_query
tool with an UPDATE statement.
These examples demonstrate how naturally you can interact with MySQL through your AI assistant once the tools are properly configured.
Support and Help
If you experience problems using this tool, please:
- Check that your MySQL connection details are correct
- Make sure Node.js is properly installed
- Check your MCP configuration in your AI platform
- Check log files for any error messages that might appear
- Verify network connectivity to your MySQL server
License
This project is licensed under the MIT License - see the LICENSE file for details.
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
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.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.