A Model Context Protocol server providing read-only access to MySQL databases, enabling LLMs to inspect database schemas and execute read-only queries.
A Model Context Protocol server that provides read-only access to MySQL databases. This server enables LLMs to inspect database schemas and execute read-only queries.
The server supports MySQL authentication through the database URL. The URL format is:
mysql://username:password@host:port/database
Examples:
mysql://user:pass@localhost:3306/mydb
Note: Always ensure your credentials are properly secured and not exposed in public configurations.
sql
(string): The SQL query to executeThe server provides schema information for each table in the database:
mysql:////schema
)
git clone https://github.com/yourusername/mysql-mcp-server.git cd mysql-mcp-server
npm run prepare npm install
npm link
Now you can use the mysql-mcp-server
command from anywhere in your terminal:
mysql-mcp-server mysql://user:password@localhost:3306/mydb
Open Cursor's settings:
Shift + Cmd + J
on macOSConfigure MCP Server:
{ "mcpServers": { "mysql": { "command": "mysql-mcp-server", "args": ["mysql://user:password@localhost:3306/mydb"] } } }
Cmd + S
Open the Agentic chat on Cursor and start asking questions related to our DB and it will have all the context
Use environment variables for sensitive credentials:
{ "mcpServers": { "mysql": { "command": "mysql-mcp-server", "args": ["mysql://${MYSQL_USER}:${MYSQL_PASSWORD}@host:3306/mydb"] } } }
Ensure the MySQL user has minimal required permissions (READ-ONLY access)
Use strong passwords and follow security best practices
Avoid committing configuration files with credentials to version control
This MCP server is licensed under the MIT License. This means you are free to use, modify, and distribute the software, subject to the terms and conditions of the MIT License. For more details, please see the LICENSE file in the project repository.
Discover shared experiences
Shared threads will appear here, showcasing real-world applications and insights from the community. Check back soon for updates!