Skip to main content

database-mcp-mysql

PyPI CI License: MIT

MCP server giving AI clients safe, structured access to a MySQL database. Two tools, guardrails on by default.

Quick start (Claude Desktop / Claude Code / Cursor)

{
  "mcpServers": {
    "mysql": {
      "command": "uvx",
      "args": ["database-mcp-mysql"],
      "env": {
        "MYSQL_HOST": "127.0.0.1",
        "MYSQL_USER": "youruser",
        "MYSQL_PASSWORD": "yourpassword",
        "MYSQL_DATABASE": "yourdb"
      }
    }
  }
}

Configuration

Sources, highest precedence first: flags, --config YAML, environment variables, defaults.

Environment variables

MYSQL_HOST, MYSQL_PORT, MYSQL_USER, MYSQL_PASSWORD, MYSQL_DATABASE, or a full MYSQL_DSN (mysql://user:pass@host:3306/db, inline credentials discouraged).

Password without plaintext

  • MYSQL_PASSWORD_FILE=/run/secrets/mysql_password (Docker/Kubernetes secrets convention)
  • In YAML: connection.password: ${MYSQL_PASSWORD} (env expansion, never a literal)

The password is held in a non-printable type and redacted from all output.

Config file

--config /absolute/path/to/database-mcp.yaml:

connection:
  host: 127.0.0.1
  port: 3306
  user: mcpuser
  password: ${MYSQL_PASSWORD}
  database: yourdb

guardrails:
  readOnly: true
  maxRows: 1000
  queryTimeoutMs: 30000

Tools

  • execute_sql: run a single SQL statement. Returns a summary line and compact JSON {columns, rows}.
  • search_objects: list tables with estimated row counts, or describe one table (columns, indexes, foreign keys).

Guardrails

  • Read-only by default, enforced twice: a SQL guard plus SET SESSION TRANSACTION READ ONLY at the server. Pass --allow-write to enable writes.
  • Results capped at maxRows (default 1000, MAX_ROWS).
  • Statements exceeding queryTimeoutMs (default 30000, QUERY_TIMEOUT_MS) are aborted.

Full contract: docs/tool-contract.md


mcp-name: io.github.arifulislamat/database-mcp-mysql

Metadata

Release files for database-mcp-mysql 0.2.0

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

Source distribution (sdist)

Source distribution for database-mcp-mysql 0.2.0
File Size Uploaded Provenance
database_mcp_mysql-0.2.0.tar.gz 5.1 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for database-mcp-mysql 0.2.0
File Interpreter ABI Platform
database_mcp_mysql-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 10.9 kB

Release files / database_mcp_mysql-0.2.0.tar.gz

Download URL database_mcp_mysql-0.2.0.tar.gz
Size 5.1 kB
Tags Source
SHA-256 checksum
How to use checksums
b0db427e27da08d14ce080e5230a7f5a0bc696393dd5c4765940c29f676564f6
BLAKE2b-256 checksum
How to use checksums
5157a1bc4951883d9f11527a80ad85c9bd3b606567c12af0e97fc52993ab066a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.1 {"installer":{"name":"uv","version":"0.13.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 / database_mcp_mysql-0.2.0-py3-none-any.whl

Download URL database_mcp_mysql-0.2.0-py3-none-any.whl
Size 5.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
bcefc0a915bf1536b0d5c247260fbf921dcf888657f584f242ac35a8edc3d5c8
BLAKE2b-256 checksum
How to use checksums
60268cfd366b0850a1a3277eae4b09616408aa64856693a853e9d05515a45c81
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.1 {"installer":{"name":"uv","version":"0.13.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 database-mcp-mysql 0.2.0

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.

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