Server facts
MySQL MCP Server
Project
- Author
- designcomputer
- Website
- designcomputer.com
- License
- MIT
- Category
- Databases
Tech
- Runtime / language
- pythonPython
- Transports
- stdio
- Remote available
- No
- Authentication
- Not specified
Activity
- GitHub stars
- 1,399
- Last commit
- Data as of
Tags
- Database Analysis
- Mysql
- Python
- Schema Inspection
- Sql
Overview
MySQL MCP Server connects AI applications to MySQL through a small set of database tools and resources. An assistant can discover tables, inspect column metadata, sample records, and execute SQL. Guided prompts combine those operations into database exploration and table-analysis workflows. This is useful when a developer or analyst needs to understand unfamiliar data before constructing more specific queries.
A configured database is optional. Without one, resource discovery lists user databases while filtering system databases, and fully qualified table names identify the desired target. Cross-database schema inspection and sampling are also supported when a default database is set. SQL execution accepts one statement per call and includes both reading and data-modification operations. Insert, update, and delete operations carry a destructive hint, so this should not be mistaken for an inherently read-only integration. Sampling is bounded to a maximum of 20 records.
The README documents stdio and an SSE-oriented network mode, along with TLS settings and SSH tunneling. Database credentials are supplied through environment variables. Although the server loads dotenv files from its working-directory context, desktop clients may start it elsewhere, making explicit client environment settings more reliable. The network mode has no built-in authentication, so deployments beyond localhost need an authenticating reverse proxy. The security guidance also calls for a dedicated MySQL account with minimal privileges rather than administrative credentials.
Install & configure
Requirements
- uv for the documented uvx launch
- An accessible MySQL instance
- MySQL credentials with the required permissions
- An MCP-compatible client
uvx --from mysql-mcp-server mysql_mcp_serverThis is the README's VS Code stdio launch. Put database values in the client's env block rather than assuming the project's .env will be discovered. Network SSE deployments require an authentication proxy outside localhost.
Examples are translated from the published configuration. Supply your own credentials and verify requirements in the upstream README. Remote connectors are shown only where a supported configuration format is known.
Config file · macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
Windows: %APPDATA%\Claude\claude_desktop_config.json
Use Settings → Developer → Edit Config when available. Do not assume a Linux configuration path; check the client documentation for your platform. Remote servers use the app’s connector flow when supported, not the local stdio file shown here. Merge this example with existing settings; do not overwrite unrelated servers.
{
"mcpServers": {
"mysql_mcp_server": {
"command": "uvx",
"args": [
"--from",
"mysql-mcp-server",
"mysql_mcp_server"
],
"env": {
"MYSQL_HOST": "<MySQL hostname>",
"MYSQL_PORT": "<MySQL port, default 3306>",
"MYSQL_USER": "<dedicated least-privilege MySQL username>",
"MYSQL_PASSWORD": "<MySQL account password>",
"MYSQL_DATABASE": "<optional default database; omit for multi-database mode>"
}
}
}
}Config file · Project: .cursor/mcp.json
User: ~/.cursor/mcp.json
The project path is relative to the workspace root. The tilde denotes your user home directory. Use Cursor’s MCP settings to confirm which configuration and scope your installed version is reading. Merge this example with existing settings; do not overwrite unrelated servers.
{
"mcpServers": {
"mysql_mcp_server": {
"command": "uvx",
"args": [
"--from",
"mysql-mcp-server",
"mysql_mcp_server"
],
"env": {
"MYSQL_HOST": "<MySQL hostname>",
"MYSQL_PORT": "<MySQL port, default 3306>",
"MYSQL_USER": "<dedicated least-privilege MySQL username>",
"MYSQL_PASSWORD": "<MySQL account password>",
"MYSQL_DATABASE": "<optional default database; omit for multi-database mode>"
}
}
}
}Config file · Workspace: .vscode/mcp.json
For user scope, use the “MCP: Open User Configuration” command if available. Do not guess a user configuration path across operating systems, profiles, containers, or remote workspaces; check the client documentation. Merge this example with existing settings; do not overwrite unrelated servers.
{
"servers": {
"mysql_mcp_server": {
"type": "stdio",
"command": "uvx",
"args": [
"--from",
"mysql-mcp-server",
"mysql_mcp_server"
],
"env": {
"MYSQL_HOST": "<MySQL hostname>",
"MYSQL_PORT": "<MySQL port, default 3306>",
"MYSQL_USER": "<dedicated least-privilege MySQL username>",
"MYSQL_PASSWORD": "<MySQL account password>",
"MYSQL_DATABASE": "<optional default database; omit for multi-database mode>"
}
}
}
}Config file · macOS/Linux: ~/.codeium/windsurf/mcp_config.json
Windows: %USERPROFILE%\.codeium\windsurf\mcp_config.json
Open the MCP configuration through Windsurf’s settings when possible to confirm the active file. Paths can differ in managed or future releases; check the client documentation if this location is not present. Merge this example with existing settings; do not overwrite unrelated servers.
{
"mcpServers": {
"mysql_mcp_server": {
"command": "uvx",
"args": [
"--from",
"mysql-mcp-server",
"mysql_mcp_server"
],
"env": {
"MYSQL_HOST": "<MySQL hostname>",
"MYSQL_PORT": "<MySQL port, default 3306>",
"MYSQL_USER": "<dedicated least-privilege MySQL username>",
"MYSQL_PASSWORD": "<MySQL account password>",
"MYSQL_DATABASE": "<optional default database; omit for multi-database mode>"
}
}
}
}Config file · Project scope: .mcp.json at the repository root
The project file uses mcpServers. For user scope, use claude mcp add --scope user rather than assuming .mcp.json in your home directory is the user configuration. Check the client documentation for managed settings and storage details. Merge this example with existing settings; do not overwrite unrelated servers.
{
"mcpServers": {
"mysql_mcp_server": {
"type": "stdio",
"command": "uvx",
"args": [
"--from",
"mysql-mcp-server",
"mysql_mcp_server"
],
"env": {
"MYSQL_HOST": "<MySQL hostname>",
"MYSQL_PORT": "<MySQL port, default 3306>",
"MYSQL_USER": "<dedicated least-privilege MySQL username>",
"MYSQL_PASSWORD": "<MySQL account password>",
"MYSQL_DATABASE": "<optional default database; omit for multi-database mode>"
}
}
}
}Examples are translated from the published configuration. Supply your own credentials and verify requirements in the upstream README. Remote connectors are shown only where a supported configuration format is known.
Tools
Source: repository README. Tool descriptions are a documented snapshot, not a live capability check.
| Tool | What it does |
|---|---|
| execute_sql | Run one SQL statement, including reads and permitted data-modification operations. |
| get_schema_info | Inspect columns, types, defaults, nullability, and comments for database tables. |
| get_table_sample | Read a table sample capped at 20 rows, including cross-database targets. |
Names, permissions, and defaults can change. Check the current upstream documentation before granting access.
Use cases
- Explore an unfamiliar database's tables and column types.
- Preview representative rows before writing analysis queries.
- Query multiple databases using qualified table names.
- Reach a MySQL instance through a configured SSH tunnel.
Strengths
- Combines schema metadata, samples, SQL, and guided exploration prompts.
- Supports optional default-database and multi-database workflows.
- Documents TLS and SSH-tunnel configuration.
Limitations
- SQL execution includes writes when database permissions allow them.
- Only single-statement SQL calls are supported.
- SSE mode needs external authentication when exposed beyond localhost.
Frequently asked questions
Independent listing, not an affiliation or security review. Grant the least access needed and verify the upstream instructions before running code.