Server profile

MySQL MCP Server

Expose MySQL schema inspection, data samples, and SQL execution to MCP assistants. It supports multi-database access, optional SSH tunnels, and local or network deployment, with database permissions controlling available operations.

Server facts

MySQL MCP Server

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
Documented launch / install command
uvx --from mysql-mcp-server mysql_mcp_server

This 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.

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.

Claude Desktop configuration
{
  "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>"
      }
    }
  }
}

Read the Claude Desktop setup guide

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.

Cursor configuration
{
  "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>"
      }
    }
  }
}

Read the Cursor setup guide

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.

VS Code configuration
{
  "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>"
      }
    }
  }
}

Read the VS Code setup guide

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.

Windsurf configuration
{
  "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>"
      }
    }
  }
}

Read the Windsurf setup guide

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.

Claude Code configuration
{
  "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>"
      }
    }
  }
}

Read the Claude Code setup guide

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.

ToolWhat it does
execute_sqlRun one SQL statement, including reads and permitted data-modification operations.
get_schema_infoInspect columns, types, defaults, nullability, and comments for database tables.
get_table_sampleRead 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

No. execute_sql supports SELECT and inspection statements as well as INSERT, UPDATE, and DELETE, subject to the database user's permissions.

The server enters multi-database mode and lists user databases. Queries can target database.table names.

No. The README limits each SQL call to a single statement.

Clients can launch the process from a different directory. The README recommends putting MYSQL_* settings directly in the MCP environment configuration.

Independent listing, not an affiliation or security review. Grant the least access needed and verify the upstream instructions before running code.

Related MCP servers

Neon MCP Server

Databases

Manage Neon Postgres projects, branches, queries, and migrations through an AI assistant. The hosted MCP service supports OAuth or API keys, read-only access, and project-level scoping.

MCP Toolbox for Databases

Databases

MCP Toolbox for Databases connects agents and IDEs to enterprise data through prebuilt tools or custom query definitions. It combines database access with connection pooling, authentication integration, and observability.

MCP Server for MySQL

Databases

MCP Server for MySQL lets Claude and other AI clients inspect schemas and execute SQL. It defaults to read-only access, with optional write flags, SSH tunneling, multi-database support, and result redaction.

DBHub

Databases

DBHub exposes SQL execution and database discovery through a small MCP interface. It spans five database engines, supports multiple configured connections, and includes a web workbench for use without an assistant.

Supabase MCP Server

Databases

Connect AI assistants to Supabase projects for SQL, schema changes, debugging, and Edge Functions. Hosted HTTP setup supports project scoping, read-only access, and selectable feature groups.

Postgres MCP Pro

Databases

Give assistants PostgreSQL schema access, SQL execution, health checks, and performance analysis. Postgres MCP Pro adds query plans and hypothetical index evaluation with configurable read-only operation.

MongoDB MCP Server

Databases

MongoDB MCP Server connects AI clients to MongoDB databases and Atlas. Its tools cover queries, schema inspection, database changes, and MongoDB knowledge searches, with read-only launch examples for safer exploration.

Query MCP for Supabase

Databases

Query MCP connects coding assistants to Supabase SQL, schema changes, project management, and user administration. It includes SQL risk controls, but its author has stopped active maintenance.