MySQL MCP Server

by gopikapeenikkal

184 downloads
Not rated
GitHub

About

A Model Context Protocol (MCP) server that connects to a MySQL database and exposes a tool for AI models to execute SQL queries via natural language, without direct database access.

Details

Author
gopikapeenikkal
Downloads
184
Categories
Database

- Provides a single read_query tool for executing SELECT queries
- Allows natural language querying through AI models like Claude
- Integrates with Cursor via mcp.json configuration
- Supports manual execution and Python client usage
- Requires Python 3.11+ and a MySQL database

Setting up with Highlight

This MCP is not yet compatible with Highlight’s one-click setup. However, you can still use it with Highlight by following these steps:

  1. Download and install Highlight from highlightai.com/download
  2. Navigate to the plugins tab and select "Add Custom Plugin"
  3. Configure the plugin with the settings below
    Plugin Name MySQL MCP Server
    Command (node, npx, python, etc.)

    Please refer to the README for specific instructions on how to obtain API keys or other required environment variables.

  4. Enable "Start Automatically" if you want the plugin to start when Highlight launches

From the repository

Install with pip install mcp_mysql_connect or uv pip install mcp_mysql_connect. Set environment variables DB_HOST, DB_USER, DB_PASSWORD, and DB_NAME. Then configure in Cursor's mcp.json, use the Python client, or run manually with python -m mcp_mysql_connect.

Claude Desktop / Cursor

Paste into your MCP client config file to install this server.

{
    "mcpServers": {
        "mysql mcp server": {
            "mysql-mcp-server-gopikapeenikkal": {
                "command": "uv",
                "args": [
                    "pip",
                    "install",
                    "mcp_mysql_connect"
                ]
            }
        }
    }
}

McpServers

{
    "mysql-mcp-server-gopikapeenikkal": {
        "command": "uv",
        "args": [
            "pip",
            "install",
            "mcp_mysql_connect"
        ]
    }
}

MySQL MCP Server

A Model Context Protocol (MCP) server that provides an interface for AI models to interact with MySQL databases through natural language queries.

Overview

This package creates an MCP server that connects to a MySQL database and exposes a tool to execute SQL queries. It allows AI models like Claude to interact with your MySQL database without direct database access.

Prerequisites

- Python 3.11 or above
- MySQL database

Installation

You can install the MCP MySQL server using pip:

pip install mcp_mysql_connect

Or using UV:

uv pip install mcp_mysql_connect

Configuration

The server requires the following environment variables:

- DB_HOST - MySQL server host
- DB_USER - MySQL username
- DB_PASSWORD - MySQL password
- DB_NAME - MySQL database name

You can set these using a .env file or directly in your environment.

Usage Options

1. Using with Cursor

Add the following to your ~/.cursor/mcp.json configuration:

"mysql-mcp-server": {
  "command": "uvx",
  "args": [
    "--from",
    "mcp_mysql_connect",
    "mcp_mysql_connect"
  ],
  "env": {
    "DB_HOST": "your-mysql-host",
    "DB_USER": "your-username",
    "DB_PASSWORD": "your-password",
    "DB_NAME": "your-database"
  }
}

Alternative configuration:

"mysql-mcp-server": {
  "command": "uv",
  "args": [
    "run",
    "--with",
    "mcp_mysql_connect",
    "-m",
    "mcp_mysql_connect"
  ],
  "env": {
    "DB_HOST": "your-mysql-host",
    "DB_USER": "your-username",
    "DB_PASSWORD": "your-password",
    "DB_NAME": "your-database"
  }
}

2. Using with Python Code

```python
from mcp.client import Client
from mcp.tools import Tools

No reviews yet — be the first

Sign in to leave a review

Use Google, GitHub, or an email account so ratings stay tied to real people.

Email sign in

No reviews posted yet.