About mysql_mcp
mysql_mcp is an MCP server for read-only exploration of MySQL databases, intended for MCP clients and AI assistants. It provides schema and table inspection alongside validated SELECT queries, while rejecting data-changing statements.
Key features
- 01Inspect table columns, types, and keys
- 02Run validated SELECT queries
- 03List database schemas and tables
- 04Schema exploration and query-building prompts
Use cases
- 01Inspect a MySQL table structure
- 02Run a read-only database query
- 03Discover available schemas and tables
- 04Get guidance exploring schemas or composing SELECT statements
MCP support
The server exposes MySQL schema and table resources, table-description and query tools, and prompts for schema exploration and query building to MCP clients. Query execution is restricted to validated SELECT statements.
Configuration
Local server config is the same for every client. Copy it into your client’s MCP config file.
We haven’t collected a package or remote endpoint for this server. Follow the instructions in the project README.
Tools
Local servers expose tools only once running on your machine, and the maintainer has not provided a tool list.
Details
From the project READMEMySQL MCP Server
A Model Context Protocol (MCP) server that provides read-only access to MySQL databases. This server allows MCP clients (like Claude Desktop or other AI assistants) to explore database schemas, inspect table structures, and execute SELECT queries safely.
Features
Tools
- describe_table - Shows table structure including columns, types, and keys
- query - Executes validated read-only SQL queries (SELECT statements only)
Resources
- mysql://schemas - Lists all available database schemas
- mysql://schemas/{schema}/tables - Lists tables in a specific schema
Prompts
- explore-schema - Guided exploration of a database schema's structure and relationships
- query-builder - Interactive help for constructing SELECT queries
Prerequisites
- Node.js (v18 or higher recommended)
- Access to a MySQL database
Installation
- Clone the repository and install dependencies:
npm install
- Build the TypeScript source:
npm run build
Configuration
Create a .env file based on the example:
cp .env.example .env
Edit .env with your MySQL connection details:
MYSQL_HOST=localhost
MYSQL_PORT=3306
MYSQL_USER=your_username
MYSQL_PASSWORD=your_password
Usage
Running Directly
npm start
Configuring with an MCP Client
Add the server to your MCP client configuration. For example, in Claude Desktop's config file:
{
"mcpServers": {
"mysql": {
"command": "node",
"args": ["/path/to/mysql_mcp/dist/index.js"],
"env": {
"MYSQL_HOST": "127.0.0.1",
"MYSQL_PORT": "3306",
"MYSQL_USER": "your_username",
"MYSQL_PASSWORD": "your_password"
}
}
}
}
Security
This server enforces read-only access by parsing and validating all queries before execution. Only SELECT statements are permitted. Any attempt to run INSERT, UPDATE, DELETE, or other modifying statements will be rejected.
License
ISC
Comments
New to MCP?
From what the protocol is to installing your first server, these answers cover most first questions.
An open protocol that defines how AI applications connect to external tools and data in a uniform way. Clients talk to the model; MCP servers provide tools, resources and prompt templates. They exchange standard messages, so one server can be reused by many clients.