mysql-mcp-server
Provides tools for executing SQL queries, listing databases, listing tables, and describing table structures on a MySQL server.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@mysql-mcp-serverShow me all databases"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
๐ง MySQL MCP Server
A Model Context Protocol (MCP) server for MySQL database operations. Provides 4 powerful tools for database interaction through any MCP-compatible client.
โจ Features
๐ Execute SQL Queries - Run any SELECT, INSERT, UPDATE, DELETE commands
๐ List Databases - View all available databases
๐ List Tables - Show tables in any database
๐๏ธ Describe Tables - Get detailed table structure information
๐ Secure - Environment-based configuration, no hardcoded credentials
โก Fast - Built with TypeScript and connection pooling
Related MCP server: MariaDB-MCP
๐ Quick Start
Installation
# Clone the repository
git clone https://github.com/myheisenberg/mysql-mcp-server.git
cd mysql-mcp-server
# Install dependencies
npm install
# Build the project
npm run buildConfiguration
The server uses environment variables for database configuration:
DB_HOST=localhost # MySQL host (default: localhost)
DB_USER=root # MySQL username (default: root)
DB_PASSWORD= # MySQL password (default: empty)
DB_PORT=3306 # MySQL port (default: 3306)๐ Usage
With Claude Desktop
Add to your claude_desktop_config.json:
{
"mcpServers": {
"mysql": {
"command": "node",
"args": ["path/to/mysql-mcp-server/dist/index.js"],
"env": {
"DB_HOST": "localhost",
"DB_USER": "your_username",
"DB_PASSWORD": "your_password",
"DB_PORT": "3306"
}
}
}
}With Cursor IDE
Add to your MCP configuration:
{
"mcpServers": {
"mysql": {
"command": "node",
"args": ["path/to/mysql-mcp-server/dist/index.js"],
"env": {
"DB_HOST": "localhost",
"DB_USER": "your_username",
"DB_PASSWORD": "your_password",
"DB_PORT": "3306"
}
}
}
}๐ ๏ธ Available Tools
1. mysql_query
Execute any MySQL query and get formatted results.
Example: "Run a SELECT query on the users table"
2. mysql_databases
List all available databases on the MySQL server.
Example: "Show me all databases"
3. mysql_tables
List all tables in a specific database.
Example: "What tables are in the blog database?"
4. mysql_describe
Get detailed information about a table's structure.
Example: "Describe the structure of the users table"
๐ง Development
# Install dependencies
npm install
# Development mode (watch for changes)
npm run dev
# Build for production
npm run build
# Start the server
npm start๐ฆ Project Structure
mysql-mcp-server/
โโโ src/
โ โโโ index.ts # Main MCP server implementation
โโโ dist/ # Compiled JavaScript (auto-generated)
โโโ package.json # Project dependencies and scripts
โโโ tsconfig.json # TypeScript configuration
โโโ .gitignore # Git ignore rules
โโโ README.md # This file๐ Security
No hardcoded credentials - All database connection details come from environment variables
Connection pooling - Efficient and secure database connections
Error handling - Proper error messages without exposing sensitive information
๐ค Contributing
Fork the repository
Create your feature branch (
git checkout -b feature/amazing-feature)Commit your changes (
git commit -m 'Add some amazing feature')Push to the branch (
git push origin feature/amazing-feature)Open a Pull Request
๐ License
This project is licensed under the MIT License - see the LICENSE file for details.
๐ Acknowledgments
Built with the Model Context Protocol SDK
Uses mysql2 for MySQL connectivity
Inspired by the MCP community
๐ Support
If you encounter any issues or have questions:
Check the Issues page
Create a new issue if your problem isn't already reported
Provide as much detail as possible including error messages and configuration
Made with โค๏ธ for the MCP community
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections. Dates show when Glama detected each change.
No tool schema history has been recorded yet.
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Connectors
The Instant MCP server is a wrapper around the Instant Platform SDK that enables creating, managing, and updating InstantDB applications directly within an editor. It provides tools for fetching rules files for LLMs, retrieving and pushing app schemas, managing permission rules, and executing database queries. Key capabilities include schema management (get-schema, push-schema), permission management (get-perms, push-perms), query execution, and listing recent query history.
Query, join, profile, clean and convert CSV/JSON/Parquet with server-side DuckDB over MCP.
Let AI agents query data and act across all your business apps via MCP.
Governed data discovery, exact queries, decisions, simulations, and runtime utilities over MCP.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceEnables interaction with MySQL databases through MCP, supporting query execution, table operations (insert, update, delete), and schema inspection for natural language database management.102MIT
- FlicenseAqualityBmaintenanceEnables interaction with MariaDB/MySQL databases via MCP, supporting read-only mode, SQL execution, and schema inspection.6-
- AlicenseNot gradedqualityCmaintenanceProvides MySQL database operations through MCP, enabling users to execute SQL queries, retrieve table structures, and check database connectivity using natural language.102Apache 2.0
- AlicenseAqualityAmaintenanceEnables secure interaction with MySQL databases through MCP, offering tools for SQL queries, schema inspection, and data sampling, with support for multiple databases, SSH tunnels, and safe write operations.31MIT
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/myheisenberg/mysql-mcp-server'
If you have feedback or need assistance with the MCP directory API, please join our Discord server