mysql
🔧 MySQL MCP Server for Model Context Protocol Features: • Execute any MySQL query • List all databases • List tables in database • Describe table structure • Environment-based configuration • Built with TypeScript & MCP SDK Ready to use with Claude Desktop, Cursor, and other MCP clients.
claude mcp add --transport stdio myheisenberg-mysql-mcp-server node path/to/mysql-mcp-server/dist/index.js \ --env DB_HOST="localhost" \ --env DB_PORT="3306" \ --env DB_USER="your_username" \ --env DB_PASSWORD="your_password"
How to use
This MCP server provides four tools to interact with a MySQL database from any Model Context Protocol client: mysql_query to run arbitrary SQL queries, mysql_databases to list all databases, mysql_tables to list tables in a database, and mysql_describe to inspect table structures. The server reads database connection details from environment variables, ensuring credentials are not hard-coded. To use it, deploy the server in your environment and point your MCP client to the node-based server entrypoint (dist/index.js) with the appropriate environment variables for DB_HOST, DB_USER, DB_PASSWORD, and DB_PORT. Once running, invoke the specific MCP tools by name (e.g., mysql_query, mysql_databases) and supply the required prompts or messages that describe the operation you want performed.
How to install
Prerequisites:
- Node.js and npm installed on your system
- Access to a MySQL server
Installation steps:
- Clone the repository:
git clone https://github.com/myheisenberg/mysql-mcp-server.git
cd mysql-mcp-server
- Install dependencies:
npm install
- Build the project (if applicable):
npm run build
- Run the server (example):
DB_HOST=localhost DB_USER=root DB_PASSWORD=your_password DB_PORT=3306 npm start
- Verify the server is running and available to MCP clients by checking logs or health endpoints as defined by the project.
Additional notes
Tips and caveats:
- Do not store credentials in code; use environment variables as shown in the configuration examples.
- If your MySQL server uses a non-standard port, update DB_PORT accordingly.
- Ensure your MySQL user has appropriate permissions for the operations you intend to perform via mysql_query (SELECT, INSERT, UPDATE, DELETE).
- Enable connection pooling in your environment if supported by the driver/version you are using for improved performance.
- If you encounter connection errors, verify network access from the MCP server host to the MySQL host and confirm user privileges.
- Review error messages from the MCP server for hints about credentials or network issues, and avoid exposing sensitive details in logs.
Related MCP Servers
zen
Selfhosted notes app. Single golang binary, notes stored as markdown within SQLite, full-text search, very low resource usage
MCP -Deepseek_R1
A Model Context Protocol (MCP) server implementation connecting Claude Desktop with DeepSeek's language models (R1/V3)
mcp-fhir
A Model Context Protocol implementation for FHIR
mcp
Inkdrop Model Context Protocol Server
mcp-appium-gestures
This is a Model Context Protocol (MCP) server providing resources and tools for Appium mobile gestures using Actions API..
dubco -npm
The (Unofficial) dubco-mcp-server enables AI assistants to manage Dub.co short links via the Model Context Protocol. It provides three MCP tools: create_link for generating new short URLs, update_link for modifying existing links, and delete_link for removing short links.