Skip to main content

MCP server for MySQL — connect to any MySQL host from Cursor, Claude Code, or any MCP client.

Project description

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).

Use without cloning (recommended for teams)

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).

Option A — GitHub Actions (recommended, no long-lived PyPI token on laptops)

  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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mysql_mcp_server_ms-0.1.0.tar.gz (5.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mysql_mcp_server_ms-0.1.0-py3-none-any.whl (5.6 kB view details)

Uploaded Python 3

File details

Details for the file mysql_mcp_server_ms-0.1.0.tar.gz.

File metadata

  • Download URL: mysql_mcp_server_ms-0.1.0.tar.gz
  • Upload date:
  • Size: 5.1 kB
  • Tags: Source
  • Uploaded using 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}

File hashes

Hashes for mysql_mcp_server_ms-0.1.0.tar.gz
Algorithm Hash digest
SHA256 f7856417dc7f12b1b26145c7482f864e18dd3bf9507830c7907f0a4c009411d6
MD5 2b0e57aeeb43bc3cdd3774ee9d96c045
BLAKE2b-256 6da53bc3cfaa59ba1343427c89fac4360be53ba8cd183860c478c3e94bca2534

See more details on using hashes here.

File details

Details for the file mysql_mcp_server_ms-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: mysql_mcp_server_ms-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 5.6 kB
  • Tags: Python 3
  • Uploaded using 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}

File hashes

Hashes for mysql_mcp_server_ms-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 aa0568ff0af4424ba2b3e3b02915d9c79febb640489282d785b762c5c301bb64
MD5 846987fc19d592ebabf775d78ac52519
BLAKE2b-256 39dfe2136ef7b0890c8da3024553aeae937c19320918def2dbd748b48449599b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page