MySQL

Provides an MCP interface to list, read, and query MySQL data via a controlled channel.
  • python

3

GitHub Stars

python

Language

6 months ago

First Indexed

2 months ago

Catalog Refreshed

Documentation & install

Readme and setup notes from the catalogue, plus a client-ready config you can copy for your MCP host.

Installation

Add the following to your MCP client configuration file.

Configuration

View docs
{
  "mcpServers": {
    "youngsu5582-mcp-server-mysql": {
      "command": "uv",
      "args": [
        "--directory",
        "path/to/mysql_mcp_server",
        "run",
        "mysql_mcp_server"
      ],
      "env": {
        "MYSQL_HOST": "localhost",
        "MYSQL_PORT": "3306",
        "MYSQL_USER": "your_username",
        "MYSQL_DATABASE": "your_database",
        "MYSQL_PASSWORD": "your_password"
      }
    }
  }
}

This MCP server provides a secure, structured interface to interact with a MySQL database. It lets AI assistants discover tables, read data, and run SQL queries through a controlled channel, with built‑in logging and environment‑driven configuration to keep credentials safe.

How to use

To enable an MCP client to access your MySQL data, run the MCP server locally and connect through a configured client. You can load the server via a standard stdio workflow that launches the underlying process and passes the required environment settings. The server exposes operations to list tables, read table contents, and execute SQL queries while enforcing access controls and safe query execution.

If you use Claude Desktop, you can configure it to run the MCP server with the following setup. This launches the MCP server through a local utility and wires in the necessary environment variables for your MySQL connection.

{
  "mcpServers": {
    "mysql_mcp": {
      "command": "uv",
      "args": [
        "--directory",
        "path/to/mysql_mcp_server",
        "run",
        "mysql_mcp_server"
      ],
      "env": {
        "MYSQL_HOST": "localhost",
        "MYSQL_PORT": "3306",
        "MYSQL_USER": "your_username",
        "MYSQL_PASSWORD": "your_password",
        "MYSQL_DATABASE": "your_database"
      }
    }
  }
}

How to install

Prerequisites: you need Python and pip installed on your system, as well as network access to your MySQL instance.

Install the MCP server package from PyPI.

pip install mysql-mcp-server
````,

Configuration

Configure the MySQL connection using environment variables. The server reads these values at startup to establish a database connection.

# Example environment settings for your shell session
export MYSQL_HOST=localhost
export MYSQL_PORT=3306
export MYSQL_USER=your_username
export MYSQL_PASSWORD=your_password
export MYSQL_DATABASE=your_database

Additional notes

Security: never commit environment variables or credentials in files. Use a database user with minimum required permissions and enable logging for auditing.

Security considerations

Follow least privilege principles: create a dedicated MySQL user with restricted permissions, avoid using root credentials, and enable minimal required access only for the MCP server’s operations.

License

MIT License - see LICENSE file for details.

Contributing

Contributions are welcome. Follow standard collaboration practices: create feature branches, push commits, and open pull requests with clear changes.

Available tools

list_tables

Lists available tables in the connected MySQL database, presenting them as resources you can query or inspect.

read_table

Reads data from a specified table, returning rows and columns according to your selection criteria.

execute_query

Executes a SQL query against the database with built‑in safeguards to prevent unsafe operations.

secure_access

Manages authentication and permissions to ensure only authorized clients can perform MCP operations.

logging

Provides comprehensive logging of access and query events for auditing and debugging.

Built by
VeilStrat
AI signals for GTM teams
© 2026 VeilStrat. All rights reserved.All systems operational