drio
Open app

MySQL MCP Server

Source

mcp server accessing MySQL database

Catalog onlyCatalog onlySTDIO

Overview

MySQL MCP Server is a server designed for interacting with MySQL databases, allowing users to execute read-only queries and test write queries that are rolled back.

To use the MySQL MCP Server, set up the required environment variables in ~/.mcp/.env, start the server using Docker, and send JSON commands to execute queries.

  • Execute read-only SQL queries. - Test SQL queries without making permanent changes. - List and describe database tables. - Built with TypeScript and runs as a Docker container.
  1. Running SQL queries for data retrieval without modifying the database.
  2. Testing SQL commands to ensure they work before executing them.
  3. Listing available tables in a MySQL database for exploration.

Add to your AI client

Use these steps to connect MySQL MCP Server in Cursor, Claude, VS Code, and other MCP-compatible apps. The same JSON appears in the Use with menu above for one-click copy.

Cursor

Add this to your .cursor/mcp.json file in your project root, then restart Cursor.

.cursor/mcp.json

{
  "mcpServers": {
    "mysql-mcp-server-xiangma9712": {
      "command": "npx",
      "args": [
        "-y",
        "@modelcontextprotocol/server-mysql-mcp-server-xiangma9712"
      ]
    }
  }
}

Claude Desktop

Add this server entry to the mcpServers object in your Claude Desktop config, then restart the app.

~/Library/Application Support/Claude/claude_desktop_config.json (macOS) or %APPDATA%\Claude\claude_desktop_config.json (Windows)

{
  "mcpServers": {
    "mysql-mcp-server-xiangma9712": {
      "command": "npx",
      "args": [
        "-y",
        "@modelcontextprotocol/server-mysql-mcp-server-xiangma9712"
      ]
    }
  }
}

Claude Code

Add this to your project's .mcp.json file. Claude Code will detect it automatically.

.mcp.json (project root)

{
  "mcpServers": {
    "mysql-mcp-server-xiangma9712": {
      "command": "npx",
      "args": [
        "-y",
        "@modelcontextprotocol/server-mysql-mcp-server-xiangma9712"
      ]
    }
  }
}

VS Code (Copilot)

Add this to your .vscode/mcp.json file. Requires the GitHub Copilot extension with MCP support enabled.

.vscode/mcp.json

{
  "servers": {
    "mysql-mcp-server-xiangma9712": {
      "type": "stdio",
      "command": "npx",
      "args": [
        "-y",
        "@modelcontextprotocol/server-mysql-mcp-server-xiangma9712"
      ]
    }
  }
}

Windsurf

Add this to your Windsurf MCP config file, then restart Windsurf.

~/.codeium/windsurf/mcp_config.json

{
  "mcpServers": {
    "mysql-mcp-server-xiangma9712": {
      "command": "npx",
      "args": [
        "-y",
        "@modelcontextprotocol/server-mysql-mcp-server-xiangma9712"
      ]
    }
  }
}

Cline

Open Cline settings, navigate to MCP Servers, and add this server configuration.

Cline MCP Settings (via UI)

{
  "mcpServers": {
    "mysql-mcp-server-xiangma9712": {
      "command": "npx",
      "args": [
        "-y",
        "@modelcontextprotocol/server-mysql-mcp-server-xiangma9712"
      ]
    }
  }
}

FAQ

Can I use MySQL MCP Server with any MySQL version?

Yes, as long as the connection details are correctly configured.

Is MySQL MCP Server free to use?

Yes, it is open-source and available under the MIT license.

How do I configure the server?

You need to set environment variables and configure the `mcp.json` file as per the documentation.