MySQL MCP Server
by xiangma9712
An MCP server designed for interacting with MySQL databases. It supports executing read-only queries and testing write queries that are ultimately rolled back.
Last updated: N/A
What is MySQL MCP Server?
The MySQL MCP Server is a server that allows you to interact with MySQL databases using a simplified interface. It provides functionality to execute read-only queries and test write queries without permanently modifying the database.
How to use MySQL MCP Server?
To use the server, you need to configure environment variables for MySQL connection details in ~/.mcp/.env
. Then, configure the mcp.json
file to use the Docker image. Start the server using the provided Docker command. You can then send JSON commands to the server via standard input to execute queries, test updates, list tables, and describe tables.
Key features of MySQL MCP Server
Executes read-only queries
Tests write queries with rollback
Lists available tables
Describes table schema
Runs as a Docker container
Uses JSON commands for interaction
Use cases of MySQL MCP Server
Testing SQL queries before applying them to a production database
Retrieving data from a MySQL database in a controlled environment
Automating database interactions through scripts
Providing a simplified interface for non-technical users to query a database
FAQ from MySQL MCP Server
What is host.docker.internal
?
What is host.docker.internal
?
host.docker.internal
is a special DNS name that allows Docker containers to access services running on the host machine.
How do I prevent SQL injection?
How do I prevent SQL injection?
SQL injection prevention is the responsibility of the implementer. Ensure you properly sanitize and validate all user inputs before constructing SQL queries.
What MySQL versions are supported?
What MySQL versions are supported?
The server should be compatible with most MySQL versions, as it uses the standard mysql2 package. However, compatibility may vary depending on the specific SQL features used.
Can I use this server for production?
Can I use this server for production?
While the server can be used in production, it's important to implement proper security measures, including network configuration, firewall settings, and SQL injection prevention.
How do I update the server?
How do I update the server?
To update the server, pull the latest Docker image from ghcr.io/xiangma9712/mcp/mysql
.