mcpField
M
Mysql

Mysql

Local
github.com/midu2Databases0Updated 87w ago

About Mysql

Mysql is an MCP server for LLMs that need to inspect and work with MySQL databases. It provides read-only queries, transactional data changes, and limits on query length and result size.

Key features

  1. 01Run read-only SELECT queries
  2. 02List tables and inspect schemas
  3. 03Perform transactional data changes
  4. 04Use parameterized queries and automatic transactions
  5. 05Limit query length and result rows

Use cases

  1. 01Inspect database tables and schemas
  2. 02Filter and read database records
  3. 03Insert, update, or delete records

MCP support

As an MCP server, it exposes MySQL query, execution, and table-inspection tools to compatible LLM services.

Configuration

Local server config is the same for every client. Copy it into your client’s MCP config file.

mcp.json · Universal config
{
"mcpServers": {
"mysql-mcp-midu2": {
"command": "npx",
"args": [
"-y",
"@kevinwatt/mysql-mcp"
],
"env": {
"MYSQL_HOST": "<MYSQL_HOST>",
"MYSQL_PORT": "<MYSQL_PORT>",
"MYSQL_USER": "<MYSQL_USER>",
"MYSQL_PASS": "<MYSQL_PASS>",
"MYSQL_DB": "<MYSQL_DB>"
}
}
}
}
Run commandnpx -y @kevinwatt/mysql-mcp
Environment variables to set
MYSQL_HOST
MYSQL_PORT
MYSQL_USER
MYSQL_PASS
MYSQL_DB

Local servers need a runtime on your machine (e.g. Node.js 18+). Config file locations differ by client; see your client’s docs.

Packages
npm@kevinwatt/mysql-mcp

Tools

4

Saved tool list · updated 3w ago

ParameterTypeRequiredDescription
sqlstringYesSQL SELECT query to execute

Details

From the project README

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"
      }
    }
  }
}
  1. 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

Comments

Markdown supported

New to MCP?

From what the protocol is to installing your first server, these answers cover most first questions.

An open protocol that defines how AI applications connect to external tools and data in a uniform way. Clients talk to the model; MCP servers provide tools, resources and prompt templates. They exchange standard messages, so one server can be reused by many clients.