Navigation
Go-mcp-mysql: Zero-Config Automation & Seamless Workflow Control - MCP Implementation

Go-mcp-mysql: Zero-Config Automation & Seamless Workflow Control

Go-mcp-mysql: Instant MySQL automation via MCP – no Node.js/Python setup. Deploy, integrate, and control workflows seamlessly. Zero friction, full power.

Developer Tools
4.7(91 reviews)
136 saves
63 comments

94% of users reported increased productivity after just one week

About Go-mcp-mysql

What is Go-mcp-mysql: Zero-Config Automation & Seamless Workflow Control?

Go-mcp-mysql is a lightweight, no-setup-required server designed to simplify MySQL database interactions. It eliminates the need for Node.js or Python dependencies, providing out-of-the-box tools for CRUD operations, schema management, and workflow automation. Key features include read-only safeguards, query plan validation, and seamless integration with MCP protocols. While currently under active development, it’s ideal for prototyping, testing, and lightweight production-like environments.

How to use Go-mcp-mysql: Zero-Config Automation & Seamless Workflow Control?

Installation Options:

  • Download the latest binary from GitHub Releases and add to your system path.
  • Or build directly with Go: go install github.com/Zhwt/go-mcp-mysql@latest

Configuration Methods:

// Method A: Command-line parameters
{
  "mcpServers": {
    "mysql": {
      "command": "go-mcp-mysql",
      "args": [
        "--host=localhost",
        "--user=root",
        "--pass=your_password",
        "--port=3306",
        "--db=your_database"
      ]
    }
  }
}

// Method B: MySQL DSN (recommended for advanced options)
{
  "mcpServers": {
    "mysql": {
      "command": "go-mcp-mysql",
      "args": [
        "--dsn=username:password@tcp(localhost:3306)/mydb?parseTime=true&loc=Local"
      ]
    }
  }
}

Go-mcp-mysql Features

Key Features of Go-mcp-mysql: Zero-Config Automation & Seamless Workflow Control?

  • Zero Configuration: Start interacting with MySQL immediately without complex setup
  • Mode Flexibility: Toggle read-only mode to restrict operations to safe commands like list and desc
  • Query Validation: Use --with-explain-check to analyze query plans before execution
  • Full Tool Suite: Includes 9+ tools for schema management (e.g., create_table), data manipulation (e.g., write_query), and inspection

Use cases of Go-mcp-mysql: Zero-Config Automation & Seamless Workflow Control?

Common scenarios include:

  • Automating database migrations and schema updates in CI/CD pipelines
  • Enforcing safe operations during development via read-only mode
  • Rapid prototyping with instant MySQL access without environment dependencies
  • Performance tuning using built-in EXPLAIN analysis for complex queries
  • Building database-aware chatbots or automation workflows

Go-mcp-mysql FAQ

FAQ from Go-mcp-mysql: Zero-Config Automation & Seamless Workflow Control?

  • Q: Does it work with MySQL 8.0?
    Yes, supports modern MySQL versions including 8.0+
  • Q: How do I enable read-only mode?
    Add the --read-only flag to your command arguments
  • Q: Can I customize query execution?
    Use the --with-explain-check flag to disable automatic query plan validation
  • Q: Is this ready for production?
    Marked as work-in-progress. Use in production only after thorough testing
  • Q: How do I view table structures?
    Use desc_table with the table name parameter

Content

go-mcp-mysql

Overview

Zero burden, ready-to-use Model Context Protocol (MCP) server for interacting with MySQL and automation. No Node.js or Python environment needed. This server provides tools to do CRUD operations on MySQL databases and tables, and a read-only mode to prevent surprise write operations. You can also make the MCP server check the query plan by using a EXPLAIN statement before executing the query by adding a --with-explain-check flag.

Please note that this is a work in progress and may not yet be ready for production use.

Installation

  1. Get the latest release and put it in your $PATH or somewhere you can easily access.

  2. Or if you have Go installed, you can build it from source:

go install -v github.com/Zhwt/go-mcp-mysql@latest

Usage

Method A: Using Command Line Arguments

{
  "mcpServers": {
    "mysql": {
      "command": "go-mcp-mysql",
      "args": [
        "--host", "localhost",
        "--user", "root",
        "--pass", "password",
        "--port", "3306",
        "--db", "mydb"
      ]
    }
  }
}

Method B: Using DSN With Custom Options

{
  "mcpServers": {
    "mysql": {
      "command": "go-mcp-mysql",
      "args": [
        "--dsn", "username:password@tcp(localhost:3306)/mydb?parseTime=true&loc=Local"
      ]
    }
  }
}

Please refer to MySQL DSN for more details.

Note: For those who put the binary outside of your $PATH, you need to replace go-mcp-mysql with the full path to the binary: e.g.: if you put the binary in the Downloads folder, you may use the following path:

{
  "mcpServers": {
    "mysql": {
      "command": "C:\\Users\\<username>\\Downloads\\go-mcp-mysql.exe",
      "args": [
        ...
      ]
    }
  }
}

Optional Flags

  • Add a --read-only flag to enable read-only mode. In this mode, only tools beginning with list, read_ and desc_ are available. Make sure to refresh/restart the MCP server after adding this flag.
  • By default, CRUD queries will be first executed with a EXPLAIN ? statement to check whether the generated query plan matches the expected pattern. Add a --with-explain-check flag to disable this behavior.

Tools

Schema Tools

  1. list_database
* List all databases in the MySQL server.
* Parameters: None
* Returns: A list of matching database names.
  1. list_table
* List all tables in the MySQL server.
* Parameters: 
  * `name`: If provided, list tables with the specified name, same as SQL `SHOW TABLES LIKE '%name%'`. Otherwise, list all tables.
* Returns: A list of matching table names.
  1. create_table
* Create a new table in the MySQL server.
* Parameters: 
  * `query`: The SQL query to create the table.
* Returns: x rows affected.
  1. alter_table
* Alter an existing table in the MySQL server. The LLM is informed not to drop an existing table or column.
* Parameters: 
  * `query`: The SQL query to alter the table.
* Returns: x rows affected.
  1. desc_table
* Describe the structure of a table.
* Parameters: 
  * `name`: The name of the table to describe.
* Returns: The structure of the table.

Data Tools

  1. read_query
* Execute a read-only SQL query.
* Parameters: 
  * `query`: The SQL query to execute.
* Returns: The result of the query.
  1. write_query
* Execute a write SQL query.
* Parameters: 
  * `query`: The SQL query to execute.
* Returns: x rows affected, last insert id: <last_insert_id>.
  1. update_query
* Execute an update SQL query.
* Parameters: 
  * `query`: The SQL query to execute.
* Returns: x rows affected.
  1. delete_query
* Execute a delete SQL query.
* Parameters: 
  * `query`: The SQL query to execute.
* Returns: x rows affected.

License

MIT

Related MCP Servers & Clients