MySQL

by amornpan

Not rated
GitHub

About

Provides a MySQL database interaction server that enables listing tables, reading contents, and executing SQL queries through flexible tool configurations.

Details

Author
amornpan
Repository
amornpan/py-mcp-mysql
Categories
Design, Developer Tools, AI, Database, Infrastructure

- List available MySQL tables as resources
- Read table contents
- Execute SQL queries with proper error handling
- Secure database access through environment variables
- Comprehensive logging

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
    Command (node, npx, python, etc.) python
    Arguments
    • Argument 1 -m
    • Argument 2 src.mysql_mcp_server.server
    Environment
    • MYSQL_HOST localhost
    • MYSQL_PORT 3306
    • MYSQL_USER your_username
    • MYSQL_DATABASE your_database
    • MYSQL_PASSWORD your_password

    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

pip install -r requirements.txt

python -m venv py-mcp-mysql_venv
source py-mcp-mysql_venv/bin/activate # or py-mcp-mysql_venv\Scripts\activate on Windows

pip install -r requirements-dev.txt

Claude Desktop / Cursor

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

{
    "mcpServers": {
        "mysql": {
            "env": {
                "MYSQL_HOST": "localhost",
                "MYSQL_PORT": "3306",
                "MYSQL_USER": "your_username",
                "MYSQL_DATABASE": "your_database",
                "MYSQL_PASSWORD": "your_password"
            },
            "args": [
                "-m",
                "src.mysql_mcp_server.server"
            ],
            "command": "python"
        }
    }
}

Linux

{
    "env": {
        "MYSQL_HOST": "localhost",
        "MYSQL_PORT": "3306",
        "MYSQL_USER": "your_username",
        "MYSQL_DATABASE": "your_database",
        "MYSQL_PASSWORD": "your_password"
    },
    "args": [
        "-m",
        "src.mysql_mcp_server.server"
    ],
    "command": "python"
}

Macos

{
    "env": {
        "MYSQL_HOST": "localhost",
        "MYSQL_PORT": "3306",
        "MYSQL_USER": "your_username",
        "MYSQL_DATABASE": "your_database",
        "MYSQL_PASSWORD": "your_password"
    },
    "args": [
        "-m",
        "src.mysql_mcp_server.server"
    ],
    "command": "python"
}

Windows

{
    "env": {
        "MYSQL_HOST": "localhost",
        "MYSQL_PORT": "3306",
        "MYSQL_USER": "your_username",
        "MYSQL_DATABASE": "your_database",
        "MYSQL_PASSWORD": "your_password"
    },
    "args": [
        "-m",
        "src.mysql_mcp_server.server"
    ],
    "command": "python"
}

MySQL MCP Server

A Model Context Protocol (MCP) server that enables secure interaction with MySQL databases. This server allows AI assistants to list tables, read data, and execute SQL queries through a controlled interface, making database exploration and analysis safer and more structured.

Features

- List available MySQL tables as resources
- Read table contents
- Execute SQL queries with proper error handling
- Secure database access through environment variables
- Comprehensive logging

Configuration

Set the following environment variables:

MYSQL_HOST=localhost     # Database host
MYSQL_PORT=3306         # Optional: Database port (defaults to 3306 if not specified)
MYSQL_USER=your_username
MYSQL_PASSWORD=your_password
MYSQL_DATABASE=your_database

Usage

With Claude Desktop

Add this to your claude_desktop_config.json:

{
  "mcpServers": {
    "mysql": {
      "command": "python",
      "args": [
        "-m", 
        "src.mysql_mcp_server.server"
      ],
      "env": {
        "MYSQL_HOST": "localhost",
        "MYSQL_PORT": "3306",
        "MYSQL_USER": "your_username",
        "MYSQL_PASSWORD": "your_password",
        "MYSQL_DATABASE": "your_database"
      }
    }
  }
}

As a standalone server

```bash

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.