mcp-mysql
MCP server from Malove86/mcp-mysql-server
claude mcp add --transport stdio malove86-mcp-mysql-server npx -y @malove86/mcp-mysql-server \ --env MYSQL_HOST="your_host" \ --env MYSQL_PORT="3306" \ --env MYSQL_USER="your_user" \ --env MYSQL_DATABASE="your_database" \ --env MYSQL_PASSWORD="your_password"
How to use
This MCP server provides a MySQL operation interface that allows AI models to interact with a MySQL database through standardized tools. It supports two hosting modes: local execution via MCP configuration and a remote URL mode where the server is accessed over HTTP. The built-in tools include connect_db for establishing a connection (if not already set via environment variables), query for executing parameterized SELECT statements, list_tables to enumerate tables in the database, and describe_table to retrieve table schemas. In remote mode, you can point your MCP client to the server URL and secrets are kept server-side to protect credentials. The server also emphasizes per-request isolation, detailed logging, and robust error handling to ensure safe, observable interactions with databases. To use it locally, provide the MySQL connection details in the mcpServers configuration; to use remotely, deploy the server somewhere accessible and configure the remote URL in your MCP setup, then reference the URL in your client configuration as shown in the README sample. Tools like list_tables and describe_table enable data discovery without requiring a prior manual connect step, improving usability in stateless setups.
How to install
Prerequisites:
- Node.js (LTS) and npm or npx installed
- Access to a MySQL server (host, user, password, database) or environment to supply credentials
Install and run locally:
# Install and run the MCP server via npx
npx @malove86/mcp-mysql-server
Alternatively, configure via MCP settings (local mode) by including in your MCP config:
{
"mcpServers": {
"mysql": {
"command": "npx",
"args": ["-y", "@malove86/mcp-mysql-server"],
"env": {
"MYSQL_HOST": "your_host",
"MYSQL_USER": "your_user",
"MYSQL_PASSWORD": "your_password",
"MYSQL_DATABASE": "your_database",
"MYSQL_PORT": "3306"
}
}
}
}
Remote URL mode (v0.2.2+):
{
"mcpServers": {
"mcp-mysql-server": {
"url": "http://your-server-address:port/mcp-mysql-server"
}
}
}
On the remote server, set environment variables and start the server similarly:
export MYSQL_HOST=your_host
export MYSQL_USER=your_user
export MYSQL_PASSWORD=your_password
export MYSQL_DATABASE=your_database
export MYSQL_PORT=3306
npx @malove86/mcp-mysql-server
Additional notes
Tips and notes:
- If you run in local mode, ensure the host, user, password, and database are correctly set in the MCP config env. The port is optional if your MySQL uses the default 3306.
- In v0.2.2+ remote mode, credentials are not exposed to clients; use the URL mode for stateless access.
- The server supports up to 50 concurrent connections via an optimized pool (configurable in newer versions). Expect improved performance with prepared statements to prevent SQL injection.
- Tools available: connect_db (optional if env vars are set), query (with optional parameters), list_tables (no args from v0.2.4+), describe_table (requires table name).
- If you encounter connection failures, check network access from the MCP host to the MySQL server and verify that MYSQL_HOST, MYSQL_USER, and MYSQL_PASSWORD are correct.
- For debugging, enable detailed logging in the server configuration to trace request flow and resource usage.
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.