# mysql_mcp_server: a MySQL MCP server for Claude Code, Cursor and other MCP hosts

> designcomputer/mysql_mcp_server exposes a MySQL database to MCP clients through three tools and a set of prompts. It installs from PyPI or runs from a container, and its main design constraint is that it executes one SQL statement at a time.

**designcomputer/mysql_mcp_server** — A Model Context Protocol (MCP) server that enables secure interaction with MySQL databases

- Repository: https://github.com/designcomputer/mysql_mcp_server
- Website: https://designcomputer.com
- Stars: 1,395 · Forks: 260
- Language: Python
- License: MIT
- Published: 2026-09-10 · Updated: 2026-09-10 · Language: en
- Canonical page: https://hysenlabs.com/projects/designcomputer-mysql-mcp-server

## What mysql_mcp_server is for, and who should install it

An MCP host is an application that speaks the Model Context Protocol to one or more servers. The host decides what the model can call; the server decides what actually reaches the database. mysql_mcp_server sits on the second side of that split. It is a Python package that connects to MySQL and exposes a small, fixed surface to the host: list tables, read a table's contents, run a query. The README describes the goal as making database exploration and analysis "safer and more structured through a controlled interface", and the interface really is narrow. There is no arbitrary shell, no file access, no migration runner.

The audience is developers who already use an MCP-capable client and want the model to look at real schema instead of guessing column names. That includes people working in Claude Code, Claude Desktop, or any other host that can register a stdio or HTTP MCP server. It is not a database administration tool. If you need to run a migration, seed a fixture set, or replay a multi-step script, this server will not do it, and the README is explicit about that boundary.

## Three tools, one connection, and the multi-database switch

The server exposes three tools. `execute_sql` takes a `query` string and supports `SELECT`, `SHOW`, `DESCRIBE` and DML (`INSERT`, `UPDATE`, `DELETE`); the README notes that DML operations are marked with a destructive hint so the host can warn before running them. `get_schema_info` takes an optional `table_name` and returns column names, types, nullability, default values and comments. `get_table_sample` takes a `table_name` and an optional `limit` capped at 20, which keeps a sampling call from pulling a large result set into the model's context.

All three accept cross-database references through `database.table` notation. Whether a bare table name resolves depends on one setting. If `MYSQL_DATABASE` is set, the server works against that database. If it is omitted, the server runs in multi-database mode: `list_resources` returns every user database (system databases are filtered out) and queries must use fully qualified names. That is a real behavioural fork, not a cosmetic option, and it changes what the model sees at the start of a session.

On top of the tools the server exposes MCP prompts, which the README describes as guided multi-step workflows. In Claude Code they show up as slash commands of the form `/mcp__<server>__<prompt>`; in Claude Desktop they appear in the prompts menu. The README table lists a prompt named `explore_databa...` (truncated in the README excerpt), so the exact set of prompts is worth checking against the current README before you build a workflow around them.

## Installing mysql_mcp_server and running a first query

The package is on PyPI as `mysql-mcp-server` and requires Python 3.11 or newer, per `pyproject.toml`. The manual install is one command:

```bash
pip install mysql-mcp-server
```

For Claude Code, the README gives a single registration command that runs the server through `uvx` over stdio:

```bash
claude mcp add --transport stdio designcomputer-mysql_mcp_server uvx mysql_mcp_server
```

After that, the server appears in the host's MCP list. The catch is credentials. The server reads `MYSQL_*` environment variables, and the README warns that Claude Code and Claude Desktop launch the server from their own working directory, so a `.env` file sitting in your project folder will not be found and you will see `Missing required database configuration`. Put the values in the host's `env` block instead. The README shows the same variables in an Autohand Code CLI registration:

```bash
autohand mcp add mysql env MYSQL_HOST=localhost MYSQL_PORT=3306 MYSQL_USER=your_username MYSQL_PASSWORD=your_password MYSQL_DATABASE=your_database uvx mysql_mcp_server
```

If you prefer to run the server yourself, copy the example environment file and edit it:

```bash
cp .env.example .env
```

The example file sets `MYSQL_HOST`, `MYSQL_PORT`, `MYSQL_USER`, `MYSQL_PASSWORD`, `MYSQL_DATABASE`, `MYSQL_CHARSET=utf8mb4`, `MYSQL_COLLATION=utf8mb4_unicode_ci`, `MYSQL_SQL_MODE=TRADITIONAL` and `MYSQL_CONNECT_TIMEOUT=10`. The server loads this file through `python-dotenv` from the process working directory and its parents. Once running, a first useful call is asking the host to sample a table; `get_table_sample` with a small `limit` returns representative rows so the model can see actual formats before it writes a query.

## Remote deployment, Docker and SSH tunneling

STDIO is the default transport, but the README states the server also supports Streamable HTTP (SSE) and recommends SSE for remote or self-hosted deployments. Switching is a single variable: `MCP_TRANSPORT=sse`. The SSE-related settings are `MCP_SSE_HOST`, `PORT` (documented as a fallback for `MCP_SSE_PORT`), and `MCP_SSE_ALLOWED_HOSTS`, which defaults to `localhost:{port},127.0.0.1:{port}`. The README notes that `MCP_SSE_HOST=0.0.0.0` is required for Docker or hosting, and the allowed-hosts list exists precisely because that setting widens exposure. The SSE dependencies are optional and grouped under the `sse` extra in `pyproject.toml` (`starlette` and `uvicorn`), though `requirements.txt` lists them unconditionally for the container build.

The `Dockerfile` is generated by Smithery. It builds on `python:3.11-slim`, installs `requirements.txt`, copies `src/` and sets `PYTHONPATH=/app/src`, creates a non-root `appuser`, and starts the server with `python -m mysql_mcp_server.server`. It deliberately does not bake secrets into the image; the comment says to pass them at runtime via `docker run -e MYSQL_PASSWORD=...` or Docker secrets. It does set `MYSQL_HOST=host.docker.internal` and `MYSQL_PORT=3306`, which is a hint that the intended target is a database on the Docker host.

For databases that are not directly reachable, there is an SSH tunnel mode. Setting `MYSQL_SSH_ENABLE=true` turns it on, with `MYSQL_SSH_HOST`, `MYSQL_SSH_PORT` (default 22), `MYSQL_SSH_USER`, `MYSQL_SSH_KEY_PATH`, `MYSQL_SSH_REMOTE_HOST` (default `localhost`), `MYSQL_SSH_REMOTE_PORT` (default 3306) and `MYSQL_LOCAL_PORT` (default 3330). The jump host is the machine that can reach MySQL; the server opens the tunnel from your side.

## Where mysql_mcp_server stops being the right tool

The most consequential limitation is stated plainly in the README: only single SQL statements are supported, and multi-statement queries such as `USE db; SELECT ...` are not. That rules out the pattern many people reach for first, which is to prefix a session with `USE` and then run unqualified queries. In multi-database mode you qualify names instead. It also rules out any workflow that depends on a script of several statements executed as one unit, including transaction control, since the tool takes one statement and the README does not describe a transaction API.

DML is permitted. `execute_sql` supports `INSERT`, `UPDATE` and `DELETE`, and the destructive hint is a signal to the host, not a guard. Nothing in the README describes a read-only mode or a statement allowlist. The practical control is the MySQL account you configure: grants are enforced by the database, not by the server. If you point `MYSQL_USER` at an account with broad privileges, the model inherits them. That is the failure mode worth designing around before anything else.

Identifier handling is another boundary. `get_schema_info` and `get_table_sample` accept names containing only alphanumeric characters, underscores and `$`, with dots allowed as a separator between database and table. Table names outside that set cannot be addressed by those two tools. And the `.env` behaviour cuts both ways: convenient when you run the server yourself from the project folder, silently useless when a desktop host launches it from elsewhere.

## How it differs from a general-purpose MCP database server

A general-purpose MCP database server typically aims for breadth: multiple engines behind one interface, a query tool plus schema inspection, sometimes a connection manager. mysql_mcp_server takes the opposite approach. It is MySQL only, its dependency list is short (`mcp`, `mysql-connector-python`, `python-dotenv`), and its MySQL-specific surface is where the interesting choices live. `MYSQL_SSL_MODE` accepts `DISABLED`, `REQUIRED`, `VERIFY_CA` or `VERIFY_IDENTITY`. `MYSQL_AUTH_PLUGIN` exists for older servers, with `mysql_native_password` named in `.env.example` and tied to MySQL 5.7 in a comment. `MYSQL_USE_PURE` forces the pure-Python connector, and `MYSQL_RAISE_ON_WARNINGS` controls whether SQL warnings raise. None of those are portable abstractions; they are answers to real MySQL deployment problems.

The trade-off is that you cannot point this server at Postgres and reuse the host configuration. If your stack is mixed, a multi-engine server costs you less configuration churn. If your stack is MySQL and you have hit the 5.7 auth plugin problem or need an SSH jump host, this server has the knobs already. The README also lists two hosted routes, Fronteir AI and Smithery, which shift the operational burden off your machine at the cost of running the server somewhere you do not control.

## Licence, maintenance and what an upgrade costs

The project is MIT licensed, declared in both `pyproject.toml` and the repository `LICENSE` file. MIT is permissive: you can use, modify and redistribute it, including in closed products, provided the copyright notice and permission notice are retained. That is the general shape of the licence, not legal advice for your situation; if you are embedding it in a product, have your own counsel read the text.

The repository is not archived, and the last push was on 2026-08-02. The most recent release listed is v0.4.4 from 2026-07-30, with v0.4.3 the same day and v0.4.2 on 2026-06-20. Version numbers and the CHANGELOG file are the upgrade surface. Because the package is installed from PyPI or run via `uvx`, an upgrade is a version bump in your host configuration or a `pip install --upgrade`, and the risk sits in the environment variables: the README's configuration block is the contract, and a release that changes a default such as `MYSQL_SQL_MODE=TRADITIONAL` or the SSE allowed-hosts list changes behaviour without changing your config. Pin the version in environments where the model's access to production data matters, and read `CHANGELOG.md` before moving the pin.

## Conclusion

Adopt mysql_mcp_server if you want an MCP host such as Claude Code or Claude Desktop to inspect a MySQL schema and run single statements, and you are willing to hand it a database user whose grants match what you actually want the model to touch. Skip it if your workflow depends on multi-statement scripts, since the README states that multi-statement queries are not supported and the server has no transaction control. Before registering it anywhere, confirm that your MySQL account is not root, decide whether MYSQL_DATABASE is set (multi-database mode changes what list_resources returns and how you must qualify table names), and check whether you need MYSQL_AUTH_PLUGIN=mysql_native_password for MySQL 5.7.

## FAQ

### Does MySQL have an MCP server?

Yes. designcomputer/mysql_mcp_server is a Model Context Protocol server for MySQL, published on PyPI as mysql-mcp-server and licensed under MIT. It exposes tools for listing tables, reading schema information and executing SQL queries.

### What is the purpose of an MCP server like mysql_mcp_server?

It gives an MCP host such as Claude Code or Claude Desktop a controlled way to reach a MySQL database. The README describes the goal as making database exploration and analysis safer and more structured through a controlled interface, with tools for schema inspection, sampling and query execution.

### Can an MCP server be used with a database?

Yes. mysql_mcp_server connects to MySQL through environment variables such as MYSQL_HOST, MYSQL_USER and MYSQL_PASSWORD, and exposes the database to the host through the execute_sql, get_schema_info and get_table_sample tools.

### How do I run an MCP server like mysql_mcp_server?

The server runs over stdio by default, or over Streamable HTTP (SSE) when MCP_TRANSPORT is set to sse. In SSE mode the README recommends setting MCP_SSE_HOST=0.0.0.0 for Docker or hosting and lists MCP_SSE_ALLOWED_HOSTS for controlling which Host headers are accepted.

### How do I install mysql_mcp_server?

Install it with pip install mysql-mcp-server, or register it directly in a host with a command such as claude mcp add --transport stdio designcomputer-mysql_mcp_server uvx mysql_mcp_server. The README also documents installation through Smithery and a manual .env setup.

### Is there an official mysql_mcp_server?

The repository is maintained by Dana K. Williams under the designcomputer organisation, with the homepage listed as designcomputer.com. The README does not describe the project as an official MySQL or Oracle product.

## Sources

- [designcomputer/mysql_mcp_server on GitHub](https://github.com/designcomputer/mysql_mcp_server)
- [License: MIT](https://github.com/designcomputer/mysql_mcp_server/blob/main/LICENSE)
- [Project website](https://designcomputer.com)
- [README](https://github.com/designcomputer/mysql_mcp_server/blob/main/README.md)
- [Releases](https://github.com/designcomputer/mysql_mcp_server/releases)

---

Hysen Labs editorial analysis, written from the project's own repository and release notes. Cite the canonical page: https://hysenlabs.com/projects/designcomputer-mysql-mcp-server
