Skip to main content

mysql-mcp-server-ms

PyPI package for this MCP server. The GitHub repo is still mysql-mcp-server; the PyPI project is mysql-mcp-server-ms because mysql-mcp-server was already taken on PyPI.

MCP server for MySQL over stdio. Tools: connect_mysql, disconnect, list_databases, list_tables, describe_table, run_query (read-only SQL only).

After the package is on PyPI (or your private index)

Install uv, then run the server with uvx (no repo checkout):

uvx mysql-mcp-server-ms

Pin a version for reproducible MCP configs:

uvx mysql-mcp-server-ms==0.1.0

Cursor — .cursor/mcp.json:

"mysql": {
  "command": "uvx",
  "args": ["mysql-mcp-server-ms"]
}

Claude Code — project .mcp.json or:

claude mcp add --transport stdio mysql -- uvx mysql-mcp-server-ms

Private index (example):

UV_INDEX_URL=https://your-artifact-server/simple uvx mysql-mcp-server-ms

Or set UV_INDEX / PIP_INDEX_URL per uv docs for your org.

Before PyPI: install from Git (no full monorepo clone)

uvx can install the package from a Git URL pointing at this subdirectory (replace ORG, REPO, and branch/tag):

uvx --from "git+https://github.com/ORG/REPO.git#subdirectory=mysql_server&branch=main" mysql-mcp-server-ms

Use a tag or commit SHA instead of branch=main for stable installs.


Install from this repo (developers)

cd mysql_server
uv sync
uv run mysql-mcp-server-ms

Publishing (maintainers)

So others can run uvx mysql-mcp-server-ms from the default index, the package must be on PyPI (or a private index your team configures).

  1. One-time on pypi.org: add a pending trusted publisher for project mysql-mcp-server-ms (must match name in pyproject.toml exactly) → Settings → Publishing → workflow publish-mysql-mcp-server.yml on this repo (see comments in .github/workflows/publish-mysql-mcp-server.yml).
  2. Bump version in pyproject.toml and merge to the default branch.
  3. Trigger the workflow:
    • GitHub → Actions → Publish mysql-mcp-server-ms to PyPI → Run workflow, or
    • Push tag mysql-mcp-server-ms-v0.1.0 (prefix mysql-mcp-server-ms-v + semver from pyproject.toml, e.g. version 0.1.0 → tag mysql-mcp-server-ms-v0.1.0).
  4. Confirm on PyPI.

If your pending publisher used a different spelling (e.g. mysql_mcp_server_ms), remove it on PyPI and create a new one whose project name matches the name field in pyproject.toml (mysql-mcp-server-ms).

Option B — From your machine

  1. Bump version in pyproject.toml.

  2. Remove stray *.egg-info under src/ if present (rm -rf src/*.egg-info).

  3. Build and upload:

    cd mysql_server
    uv build
    uv publish
    

    Configure credentials via uv publish (UV_PUBLISH_TOKEN, or keyring / ~/.pypirc).


Prerequisites

  • Python 3.10+
  • uv on PATH (for uvx / uv sync)
  • Network access to MySQL (VPN if internal)

Installing uv

curl -LsSf https://astral.sh/uv/install.sh | sh
# or: brew install uv
uv --version

Cursor (monorepo / editable install)

If you develop inside the repo (clone path may be mysql-mcp-server):

"mysql": {
  "command": "uv",
  "args": [
    "--directory",
    "/absolute/path/to/mysql-mcp-server/mysql_server",
    "run",
    "mysql-mcp-server-ms"
  ]
}

Legacy: .venv/bin/python3 + server.py shim is supported after uv sync.


Claude Code (monorepo + REPO_ROOT)

If your monorepo uses a root env var, point it at this package directory, for example:

export REPO_ROOT="/absolute/path/to/mysql-mcp-server"
claude mcp add --transport stdio mysql -- \
  uv --directory "$REPO_ROOT/mysql_server" run mysql-mcp-server-ms

Security

  • Prefer read-only MySQL users.
  • Use VPN for internal DB hosts.
  • Never commit passwords; use connect_mysql in-session or your secret manager.

Optional: Index-aware query enforcement (reject full scans + non-indexed predicates)

This MCP server can enforce a stricter performance policy for SELECT queries (including WITH ... SELECT):

  • It parses WHERE and JOIN ... ON predicates.
  • For each predicate column, it checks INFORMATION_SCHEMA.STATISTICS to see whether that column belongs to any index on the referenced table.
  • It also runs EXPLAIN and rejects the query if MySQL reports a full table scan (type = ALL).

Enable it by setting an env var when starting the MCP server:

"mysql": {
  "command": "uvx",
  "args": ["mysql-mcp-server-ms"],
  "env": {
    "MCP_MYSQL_ENFORCE_INDEXED_COLUMNS": "1"
  }
}

If a query is rejected, you’ll get a message listing the non-indexed predicate columns (best-effort) and suggestions like “add an index” or “rewrite WHERE/JOIN to use an indexed column”.

Note: the mapping from SQL column references to tables is best-effort. For complex queries (subqueries/CTEs with ambiguous column qualifiers), the server may fall back to an EXPLAIN-only check and allow the query if no full scan is detected.

Metadata

Release files for mysql-mcp-server-ms 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for mysql-mcp-server-ms 0.1.1
File Size Uploaded Provenance
mysql_mcp_server_ms-0.1.1.tar.gz 12.3 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for mysql-mcp-server-ms 0.1.1
File Interpreter ABI Platform
mysql_mcp_server_ms-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 21.7 kB

Release files / mysql_mcp_server_ms-0.1.1.tar.gz

Download URL mysql_mcp_server_ms-0.1.1.tar.gz
Size 12.3 kB
Tags Source
SHA-256 checksum
How to use checksums
77bf752c929553937a25e41d26eb291b1172f88d6ac86c7e8e5addd25e655d49
BLAKE2b-256 checksum
How to use checksums
1a38ab1f4ed4898768a41f59e5f4c92e0317ab476865a273e375cc1d32578164
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.11.1 {"installer":{"name":"uv","version":"0.11.1","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / mysql_mcp_server_ms-0.1.1-py3-none-any.whl

Download URL mysql_mcp_server_ms-0.1.1-py3-none-any.whl
Size 9.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e0cf9606a6f57da53353d298f7fe063416e8b28959fe1423548e453d23c24aad
BLAKE2b-256 checksum
How to use checksums
2d8e122232f7c47b6aa6838186d011553db824c68872dfac5dd80a8ca9830be9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.11.1 {"installer":{"name":"uv","version":"0.11.1","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for mysql-mcp-server-ms 0.1.1

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page