Get the FREE Ultimate OpenClaw Setup Guide →

mysqldb

An MCP server implementation that enables Claude AI to interact with MySQL databases.

Installation
Run this command in your terminal to add the MCP server to Claude Code.
Run in terminal:
Command
claude mcp add --transport stdio burakdirin-mysqldb-mcp-server uvx mysqldb-mcp-server \
  --env MYSQL_HOST="localhost" \
  --env MYSQL_USER="root" \
  --env MYSQL_DATABASE="[optional]" \
  --env MYSQL_PASSWORD="password" \
  --env MYSQL_READONLY="true"

How to use

The mysqldb MCP server exposes two tools for interacting with a MySQL database: connect_database and execute_query. The connect_database tool lets you establish a connection to a specific database by providing the database name, returning a confirmation when successful. The execute_query tool lets you run one or more SQL statements against the connected database; you can pass a single query or multiple semicolon-delimited queries, and the tool will return results in JSON format. This setup is designed to simplify remote, programmatic access to a MySQL instance from within the MCP ecosystem, enabling secure, instrumented database operations through the MCP runtime.

How to install

Prerequisites:

  • Python and uv (the MCP runtime) installed on your system
  • Access to a MySQL server or a local MySQL instance

Installation steps:

  1. Install the package via uv:
uv pip install mysqldb-mcp-server
  1. Alternatively, install via pip directly:
pip install mysqldb-mcp-server
  1. Verify installation by listing or running the server as described in the project documentation. If you plan to deploy in a Claude/Smithery workflow, follow those integration steps as shown in the README.

Additional notes

Environment variables control how the server connects to MySQL. EnsureMYSQL_HOST, MYSQL_USER, and MYSQL_PASSWORD are set to valid credentials for your database. MYSQL_DATABASE is optional and can be used to select a default database upon connection. If you enable read-only mode (MYSQL_READONLY=true or 1), the server will prevent data modification commands. When deploying in continuous environments, consider supplying credentials via secure secret management and avoid embedding passwords in public configs. If you encounter connection issues, verify network access to the MySQL host and that the user has appropriate privileges for the target database.

Related MCP Servers

Sponsor this space

Reach thousands of developers