mysql
mcp model-context-protocol mysql cursor n8n
claude mcp add --transport stdio dave-wind-mysql-mcp-server npx -y @davewind/mysql-mcp-server mysql://user:password@localhost:port/database
How to use
This MCP server provides read-only access to a MySQL database for LLMs via the Model Context Protocol. It exposes automatic schema discovery for each table and a query tool that accepts and executes SELECT statements within a READ ONLY transaction. The server communicates using JSON-RPC over stdio, enabling LLMs to inspect database schemas and run safe read-only queries to gather context for reasoning and generation. To use it, point the server at your MySQL connection string, and use the provided query tool to fetch table structures or run SELECT statements against the connected database. The server enforces a strict security model: only read-only operations are allowed, with SQL validation ensuring only SELECT queries are executed and all work performed inside READ ONLY transactions.
Tools available:
- query: Executes read-only SQL queries against the connected database. Input is a string sql containing the SELECT statement. All queries run within a READ ONLY transaction. Use this to fetch data or test hypotheses without modifying the database. The server will return results including rows and column metadata for each query.
How to install
Prerequisites:
- Node.js v18 or newer installed on the host
- Access to a running MySQL database to connect to
Install steps:
-
Install the MCP server package globally (as shown in the README):
npm install @davewind/mysql-mcp-server -g
-
Ensure Node.js is available in your environment. You can verify with:
node -v
-
Prepare your MySQL connection string (for example):
mysql://user:password@localhost:3306/database
-
Run the MCP server with the configuration shown in the example (the mcp_config should be used by your MCP orchestration as needed):
npx @davewind/mysql-mcp-server mysql://user:password@localhost:port/database
-
If you’re using the JSON configuration file approach, place the mcpServers configuration in a file (e.g., config.json) and load it with your MCP runner as appropriate. The example provided uses the mcp_config structure shown in this README.
Additional notes
Tips and common considerations:
- The server is designed for read-only access. Ensure your SQL input consists of SELECT statements; the server performs validation to prevent data modification.
- If you need to connect to a different database or host, update the connection string in the configuration accordingly, including host, port, database, user, and password.
- The MCP server exposes schema information for each table, allowing LLMs to reason about table structures before querying.
- When deploying in production, consider additional security measures such as network access restrictions and secret management for database credentials.
- The npm package name for reference is @davewind/mysql-mcp-server, which is also used in the installation and execution examples.
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.