# Zhwt/go-mcp-mysql [Health: Active]

**Category:** 🗄️ Databases  
**Repository:** https://github.com/Zhwt/go-mcp-mysql  
**GitHub Stars:** 66  
**Views:** 5  
**Installs:** 0  
**Upvotes:** 0  
**Directory Page:** https://allmcps.com/mcp/zhwt-go-mcp-mysql

## Description
Easy to use, zero dependency MySQL MCP server built with Golang with configurable readonly mode and schema inspection.

## Tools
Capabilities this server exposes over MCP:

- **name** — If provided, list tables with the specified name, same as SQL `SHOW TABLES LIKE '%name%'`. Otherwise, list all tables.
- **query** — The SQL query to create the table.

## Claude Desktop Quick Installation
No generated config for this server: it installs through its own setup steps.

The project's own setup steps (from https://github.com/Zhwt/go-mcp-mysql), copied verbatim. Follow them in order; they are not an mcpServers config.

1. Install:

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

## Documentation

## What Zhwt/go-mcp-mysql MCP server does

Zhwt/go-mcp-mysql MCP server gives an MCP client access to a MySQL database through a Go binary. It covers database and table discovery, table descriptions, read queries, and data-changing SQL operations. Schema operations include creating and altering tables, while data operations are split into read, write, update, and delete tools.

The project belongs in the 🗄️ Databases category. It is intended for database interaction and automation, but the README identifies it as a work in progress and cautions that it may not be ready for production use.

## How it works

The server runs as a local MCP process and connects to MySQL using either individual connection arguments or a DSN. The connection can specify a host, port, username, password, and database. A DSN also allows MySQL driver options such as `parseTime` and `loc`.

Schema discovery is handled by `list_database`, `list_table`, and `desc_table`. `list_table` can return every table or filter names using behavior equivalent to `SHOW TABLES LIKE '%name%'`. `read_query` executes read-only SQL and returns its result. `write_query`, `update_query`, and `delete_query` execute their respective mutation types and report affected rows; writes also return the last insert ID.

By default, CRUD queries are checked with an `EXPLAIN` statement before execution. The `--with-explain-check` flag disables that behavior. The `--read-only` flag restricts the exposed tools to those beginning with `list`, `read_`, and `desc_`.

## Setup and configuration

Install a released binary from the project’s GitHub releases and place it on the executable path, or build it with:

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

An MCP client can launch the binary with connection arguments such as `--host`, `--user`, `--pass`, `--port`, and `--db`. Alternatively, pass a complete connection string through `--dsn`, for example:

```text
username:password@tcp(localhost:3306)/mydb?parseTime=true&loc=Local
```

If the executable is not on `PATH`, configure the client with its full filesystem path. Add `--read-only` for restricted access, or `--with-explain-check` to turn off the default query-plan check. Restart or refresh the MCP server after changing read-only configuration.

## Tools and capabilities

- `list_database`: lists databases on the MySQL server.
- `list_table`: lists all tables or filters table names.
- `create_table`: runs a supplied table-creation statement.
- `alter_table`: alters an existing table; the LLM is informed not to drop existing tables or columns.
- `desc_table`: returns a table’s structure.
- `read_query`: runs a read-only SQL query.
- `write_query`: runs a write query and returns affected rows and the last insert ID.
- `update_query`: runs an update query and returns affected rows.
- `delete_query`: runs a delete query and returns affected rows.

## Limitations and notes

Zhwt/go-mcp-mysql is configured with command-line arguments or a DSN rather than environment variables. Read-only mode depends on restricting the exposed tool set, so connection credentials and database permissions should still be managed appropriately. The project’s README describes the implementation as work in progress, so evaluate it carefully before using it in production.

_Full upstream README: https://allmcps.com/mcp/zhwt-go-mcp-mysql/readme_

