MySQL

by kevinwatt

17 stars
2.3k downloads
Not rated
GitHub

About

Provides secure MySQL database access for LLMs, enabling read/write operations with transaction support and security features for AI-assisted data management tasks.

Details

Author
kevinwatt
Repository
kevinwatt/mysql-mcp
GitHub stars
17
Downloads
2,327
License
MIT License
Categories
Database, Other, Productivity, Developer Tools, Design, AI, Search, Security, Frontend, Automation
Tags
#integration

Read Operations
Execute read-only SELECT queries
List all database tables
Show table structures
View schema information
Write Operations
Execute INSERT/UPDATE/DELETE with transaction support
Parameterized queries for data safety
Returns affected rows and insert IDs
Security
Read-only transaction mode for SELECT queries
Query length and result size limits
Performance monitoring and logging
Automatic transaction handling

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.) npx
    Arguments
    • Argument 1 -y
    • Argument 2 @kevinwatt/mysql-mcp
    Environment
    • MYSQL_DB your_database
    • MYSQL_HOST 127.0.0.1
    • MYSQL_PASS
    • MYSQL_PORT 3306
    • MYSQL_USER root

    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

npm install -g @kevinwatt/mysql-mcp

1. Click "+ Add MCP Server" in Dive Desktop
2. Copy and paste this configuration:

{
  "mcpServers": {
    "mysql": {
      "command": "npx",
      "args": [
        "-y",
        "@kevinwatt/mysql-mcp"
      ],
      "env": {
        "MYSQL_HOST": "127.0.0.1",
        "MYSQL_PORT": "3306",
        "MYSQL_USER": "root",
        "MYSQL_PASS": "",
        "MYSQL_DB": "your_database"
      }
    }
  }
}

3. Click "Save" to install the MCP server

Ask your LLM to:

"Show me all tables in the database"
"Describe the structure of users table"
"Select all active users from the database"
"Insert a new record into orders table"

mysql_query

Execute read-only SELECT queries. Inputs: sql (string): SQL SELECT query to execute. Limits: Maximum query length: 4096 characters, Maximum result rows: 1000, Query timeout: 30 seconds.

mysql_execute

Execute data modification operations. Inputs: sql (string): SQL statement (INSERT/UPDATE/DELETE), params (array, optional): Parameters for the SQL statement. Features: Returns affected rows count, Returns last insert ID, Automatic transaction handling.

list_tables

List all tables in the current database. No inputs required.

describe_table

Show table structure. Inputs: table (string): Table name to describe.

Claude Desktop / Cursor

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

{
    "mcpServers": {
        "mysql": {
            "env": {
                "MYSQL_DB": "your_database",
                "MYSQL_HOST": "127.0.0.1",
                "MYSQL_PASS": "",
                "MYSQL_PORT": "3306",
                "MYSQL_USER": "root"
            },
            "args": [
                "-y",
                "@kevinwatt/mysql-mcp"
            ],
            "command": "npx"
        }
    }
}

Linux

{
    "env": {
        "MYSQL_DB": "your_database",
        "MYSQL_HOST": "127.0.0.1",
        "MYSQL_PASS": "",
        "MYSQL_PORT": "3306",
        "MYSQL_USER": "root"
    },
    "args": [
        "-y",
        "@kevinwatt/mysql-mcp"
    ],
    "command": "npx"
}

Macos

{
    "env": {
        "MYSQL_DB": "your_database",
        "MYSQL_HOST": "127.0.0.1",
        "MYSQL_PASS": "",
        "MYSQL_PORT": "3306",
        "MYSQL_USER": "root"
    },
    "args": [
        "-y",
        "@kevinwatt/mysql-mcp"
    ],
    "command": "npx"
}

Windows

{
    "env": {
        "MYSQL_DB": "your_database",
        "MYSQL_HOST": "127.0.0.1",
        "MYSQL_PASS": "",
        "MYSQL_PORT": "3306",
        "MYSQL_USER": "root"
    },
    "args": [
        "/c",
        "npx",
        "-y",
        "@kevinwatt/mysql-mcp"
    ],
    "command": "cmd"
}

MySQL MCP Server

An MCP server implementation that integrates with MySQL databases, providing secure database access capabilities for LLMs.

Features

Read Operations
Execute read-only SELECT queries
List all database tables
Show table structures
View schema information
Write Operations
Execute INSERT/UPDATE/DELETE with transaction support
Parameterized queries for data safety
Returns affected rows and insert IDs
Security
Read-only transaction mode for SELECT queries
Query length and result size limits
Performance monitoring and logging
Automatic transaction handling

Installation

npm install -g @kevinwatt/mysql-mcp

Usage with Dive Desktop

1. Click "+ Add MCP Server" in Dive Desktop
2. Copy and paste this configuration:

{
  "mcpServers": {
    "mysql": {
      "command": "npx",
      "args": [
        "-y",
        "@kevinwatt/mysql-mcp"
      ],
      "env": {
        "MYSQL_HOST": "127.0.0.1",
        "MYSQL_PORT": "3306",
        "MYSQL_USER": "root",
        "MYSQL_PASS": "",
        "MYSQL_DB": "your_database"
      }
    }
  }
}

3. Click "Save" to install the MCP server

Tool Documentation

mysql_query
Execute read-only SELECT queries
Inputs:
sql (string): SQL SELECT query to execute
Limits:
Maximum query length: 4096 characters
Maximum result rows: 1000
Query timeout: 30 seconds

mysql_execute
Execute data modification operations
Inputs:
sql (string): SQL statement (INSERT/UPDATE/DELETE)
params (array, optional): Parameters for the SQL statement
Features:
Returns affected rows count
Returns last insert ID
Automatic transaction handling

list_tables
List all tables in current database
No inputs required

describe_table
Show table structure
Inputs:
table (string): Table name to describe

Usage Examples

Ask your LLM to:

"Show me all tables in the database"
"Describe the structure of users table"
"Select all active users from the database"
"Insert a new record into orders table"

Manual Start

If needed, start the server manually:

npx @kevinwatt/mysql-mcp

Requirements

Node.js 18+
MySQL Server
MCP-compatible LLM service

License

MIT

Author

Dewei Yen

Keywords

mcp
mysql
database
dive
llm

  • ai

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.