mcp-mysql-query
MCP server for read-only MySQL queries. Only SELECT statements are allowed — all other operations are rejected at the SQL validation layer.
Features
- SELECT-only enforcement (INSERT/UPDATE/DELETE/DDL all blocked)
- AST-level SQL analysis via
sqlglotto catch injection and embedded write operations - Blocks dangerous constructs:
LOAD DATA INFILE,SELECT INTO OUTFILE,load_file(), etc. - Stacked statement prevention (
;separated statements) - Returns results as JSON with column names, rows, and truncation indicator
Configuration
Set these environment variables:
| Variable | Description | Default |
|---|---|---|
MYSQL_HOST |
MySQL hostname | localhost |
MYSQL_PORT |
Port | 3306 |
MYSQL_DATABASE |
Database name | |
MYSQL_USERNAME |
Login username | |
MYSQL_PASSWORD |
Login password |
Claude Desktop configuration
{
"mcpServers": {
"mysql": {
"command": "uvx",
"args": ["mcp-mysql-query@latest"],
"env": {
"MYSQL_HOST": "your-server",
"MYSQL_DATABASE": "your-db",
"MYSQL_USERNAME": "your-user",
"MYSQL_PASSWORD": "your-password"
}
}
}
}
Tool
query_mysql
Run a read-only SELECT query against the configured MySQL database.
Parameters:
sql(required) — MySQL SELECT statementmax_rows(optional) — Maximum rows to return, default 100, max 1000
Release files for mcp-mysql-query 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| mcp_mysql_query-0.1.0.tar.gz | 3.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| mcp_mysql_query-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 7.7 kB
Release files / mcp_mysql_query-0.1.0.tar.gz
| Download URL | mcp_mysql_query-0.1.0.tar.gz |
|---|---|
| Size | 3.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
832bbfa86834fafe31b087562bae2a3f37acfedfb05a5ce3737c060976a02d85
|
|
BLAKE2b-256 checksum How to use checksums |
2afa5208b355eb15a87c14ab54fde1586f09384012adce8a080b9f71c88d9d91
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 31, 2026.
Transparency logRelease files / mcp_mysql_query-0.1.0-py3-none-any.whl
| Download URL | mcp_mysql_query-0.1.0-py3-none-any.whl |
|---|---|
| Size | 4.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c1eed3de1838e288d7e1e4d771f6a2c57ab404ccaf7df0345e2c1ad934a3fcf1
|
|
BLAKE2b-256 checksum How to use checksums |
83c158f4e11a7a5bda58089ec46a538f3728a0ff7c0c0d1601e5480891c43730
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 31, 2026.
Transparency log