MCP MySQL Server

Provides a read-only MCP server that queries a MySQL database via SSE-supported HTTP interface.
  • python

0

GitHub Stars

python

Language

7 months ago

First Indexed

3 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": {
    "coderleo-mcp_mysql": {
      "command": "python",
      "args": [
        "-m",
        "mcp_mysql.server"
      ],
      "env": {
        "MCP_HOST": "0.0.0.0",
        "MCP_PORT": "8000",
        "MYSQL_HOST": "YOUR_HOST",
        "MYSQL_PORT": "YOUR_PORT",
        "MYSQL_USER": "YOUR_USERNAME",
        "QUERY_TIMEOUT": "30",
        "MYSQL_DATABASE": "YOUR_DATABASE",
        "MYSQL_PASSWORD": "YOUR_PASSWORD"
      }
    }
  }
}

You run an MCP server that connects to a MySQL database and exposes a read-only, SSE-based HTTP interface for querying data. It lets you perform SELECT queries securely without enabling data modification, making it ideal for dashboards, analytics, and read-only data access.

How to use

Set up the server and connect to your MySQL database, then use your MCP client to run read-only queries against the database. You can query entire tables or filter data with standard SELECT syntax, and you will receive results via the SSE endpoint served by the MCP server.

How to install

Prerequisites you need before installing:
- Python (version 3.8+)
- pip
- Optional: uv (for an alternative installation workflow) and a Python virtual environment tool.

Install with uv (recommended)

# Install uv if not present
pip install uv

# Create a virtual environment using uv
uv venv

# Activate the virtual environment
.venv\Scripts\activate  # Windows
# source .venv/bin/activate  # macOS/Linux

# Install the project in editable mode
pip install -e .

Install with pip

# Create a virtual environment
python -m venv venv
.\\venv\\Scripts\\activate  # Windows
# source venv/bin/activate  # macOS/Linux

# Install the project in editable mode
pip install -e .

Usage details

Start the server after configuring the environment variables that point to your MySQL instance. You can run the server in one of two ways: as a Python module or as a standalone command. The server will listen for connections and expose a read-only SSE-based HTTP interface on http://localhost:8000.

Start the server using the Python module

# Set environment variables for MySQL connection
export MYSQL_HOST=localhost
export MYSQL_PORT=3306
export MYSQL_USER=your_username
export MYSQL_PASSWORD=your_password
export MYSQL_DATABASE=your_database
export QUERY_TIMEOUT=30  # query timeout in seconds

# Start SSE server
python -m mcp_mysql.server

Start the server using the standalone command

mcp-mysql

Available tools

query

Executes a SELECT query against the connected MySQL database. Enforces read-only access and returns results through the MCP interface.

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