MySQL MCP Server is an MCP server that provides read-only access to MySQL databases for Model Context Protocol clients. It connects directly to a specified MySQL database instance using standard connection strings, enabling AI assistants such as Cursor to inspect schema structures and execute analytical queries. Developers, data analysts, and software engineers use this server to explore existing database schemas, understand table relations, and debug data issues within conversational coding workflows. All queries sent through the server are restricted to read-only transactions, preventing unauthorized data modification, deletion, or schema altering operations. By exposing table metadata and column types as MCP resources, the server helps language models contextualize database structures before querying. This setup enables quick troubleshooting, data exploration, and automated reporting without manually switching between database management tools and coding environments.
Category: Databases & Data Stores
Tags: database, mysql, query, SQL
Follow these steps to install and configure the server for use with Cursor: 1. Clone the repository and install dependencies: sh git clone https://github.com/shreyansh-ghl/mysql-mcp-server.git cd mysql-mcp-server npm run prepare npm install 2. Create a global command-line link: sh npm link 3. Open Cursor settings by clicking the gear icon or pressing Shift + Cmd + J on macOS, navigate to MCP in the left sidebar, and click Add Global MCP Server. 4. Add the server configuration to your MCP configuration block: json { "mcpServers": { "mysql": { "command": "mysql-mcp-server", "args": ["mysql://user:password@localhost:3306/mydb"] } } } 5. Save the configuration and restart Cursor.
Part of MCP Servers
MySQL MCP Server allows AI clients to interact with MySQL databases in a safe, read-only mode. It exposes resources that describe table schemas and column data types, and it provides a tool to run read-only SQL queries within automated read-only transactions.
Clone the repository from GitHub, run npm run prepare, and run npm install inside the project folder. Then run npm link to make the mysql-mcp-server command accessible globally across your system.
It is documented for use with Cursor, but it works with any Model Context Protocol client that supports local command execution and standard MCP tools and resources.
No. The server executes all SQL queries within an enforced read-only transaction. Additionally, it is best practice to configure the database connection string using a MySQL user with read-only permissions.
Yes, MySQL MCP Server is open source software distributed under the MIT License. You are free to inspect, modify, and distribute the code according to the repository terms.