MySQL MCP Server
@he426100
A Model Context Protocol (MCP) server that enables secure interaction with MySQL databases
Overview
What is MySQL MCP Server?
MySQL MCP Server is a Model Context Protocol (MCP) server that enables secure interaction with MySQL databases. It allows AI assistants to list tables, read data, and execute SQL queries through a controlled interface, making database exploration and analysis safer and more structured.
How to use MySQL MCP Server?
Clone the repository, install dependencies with Composer, and set environment variables for database connection (DB_HOST, DB_PORT, DB_USERNAME, DB_PASSWORD, DB_DATABASE). Run as a standalone server with php bin/console or via Docker.
Key features of MySQL MCP Server
- List available MySQL tables as resources
- Read table contents
- Execute SQL queries with proper error handling
- Secure database access through environment variables
- Comprehensive logging
Use cases of MySQL MCP Server
- AI-assisted database exploration and schema discovery
- Controlled read and query access for AI assistants
- Secure, logged database interaction in development environments
- Automated data retrieval and analysis workflows
FAQ from MySQL MCP Server
How does MySQL MCP Server ensure security?
It uses environment variables for credentials, recommends creating a dedicated MySQL user with minimal permissions, never uses root credentials, and enables logging for audit purposes.
What are the runtime requirements for MySQL MCP Server?
PHP and Composer are required. A MySQL database server must be accessible, with connection details provided via environment variables.
How do I run MySQL MCP Server with Docker?
Build the image with docker build -t mysql-mcp-server ., then run with docker run -i --rm mysql-mcp-server --host 127.0.0.1.
Is there support for query whitelisting?
The README suggests considering query whitelisting for production use but does not implement it by default.
Where is database connection data stored?
Connection credentials are supplied via environment variables at runtime; no persistent credential storage is provided by the server.