# MySQL MCP Server

> Manage and query MySQL databases through an AI assistant.

- **URL**: https://followmcp.com/en/servers/mysql-mcp
- **Category**: Database
- **Origin**: Community
- **Stars**: 83
- **FMRS Score**: 41/100 (Grade D)
- **Source**: https://github.com/guangxiangdebizi/MySQL_MCP
- **Transports**: Streamable HTTP
- **Runtimes**: Node.js 18+
- **Auth**: API key / credential required

## Overview
MySQL MCP Server is an MCP server using StreamableHTTP. It lets AI assistants inspect database structure, execute SQL, and manage multiple database connections. The README describes use with MCP clients including Claude Desktop and Cursor.

## Best for
- Developers and teams that need to inspect or operate MySQL through an MCP client.
- Use cases that require managing multiple MySQL connections.

## Not for
- Users who need support for database systems other than MySQL.
- Scenarios requiring enforced read-only access; the tools support writes and deletes.

## Required permissions
- Requires access to the configured MySQL host, port, user, password, and database.
- The database permissions required depend on the configured account's grants; the README recommends a dedicated MCP user with limited permissions.
- Adding a connection dynamically requires supplying its database connection details.

## Risks
- execute_query supports write operations such as INSERT, UPDATE, and DELETE, so incorrect or inappropriate SQL can modify or remove data.
- Dynamically adding a connection supplies credentials in conversation; the README recommends preconfiguring headers to avoid exposing credentials to the AI.
- For HTTP deployment, consider HTTPS, IP access restrictions, and log monitoring. The README says sessions are stored in memory and are lost when the server restarts.

## Client config (JSON)
```json
{
  "mcpServers": {
    "mysql-mcp": {
      "type": "streamableHttp",
      "url": "http://localhost:3001/mcp",
      "timeout": 600,
      "headers": {
        "X-MySQL-Host": "localhost",
        "X-MySQL-Port": "3306",
        "X-MySQL-User": "root",
        "X-MySQL-Password": "your_password",
        "X-MySQL-Database": "your_database"
      }
    }
  }
}
```

## Tools (8)
- `add_connection`: Add a database connection.
- `list_connections`: List current database connections.
- `select_database`: Select the active database connection.
- `remove_connection`: Remove a database connection.
- `execute_query`: Execute SQL queries or operations, including SELECT, INSERT, UPDATE, and DELETE.
- `show_tables`: Show tables in the current database.
- `describe_table`: Inspect a table's structure, field types, and sample data.
- `show_databases`: Show accessible databases.
