Skip to main content

mcps-mysql-server

Repository: https://github.com/Shubham9975/mcp-mysql-server.git

A MySQL server implementation for the MCP (Model Control Protocol) framework. This server allows you to interact with MySQL databases through the MCP protocol, enabling SQL execution, table/resource listing, and schema retrieval.

Features

  • Execute SQL queries
  • List MySQL tables as resources
  • Get table schemas
  • Configurable through environment variables
  • Supports various MySQL character sets and collations

Installation

From PyPI

pip install mcps-mysql-server

From Source (GitHub)

git clone https://github.com/Shubham9975/mcp-mysql-server.git
cd mcp-mysql-server
pip install .

Or for development (editable) mode:

pip install -e .

Configuration

Set the following environment variables (required for connection):

  • MYSQL_HOST: MySQL server host (default: "localhost")
  • MYSQL_PORT: MySQL server port (default: 3306)
  • MYSQL_USER: MySQL username (required)
  • MYSQL_PASSWORD: MySQL password (required)
  • MYSQL_DATABASE: MySQL database name (required)
  • MYSQL_CHARSET: MySQL character set (default: "utf8mb4")
  • MYSQL_COLLATION: MySQL collation (default: "utf8mb4_unicode_ci")
  • MYSQL_SQL_MODE: MySQL SQL mode (default: "TRADITIONAL")

Example:

export MYSQL_USER="your_user"
export MYSQL_PASSWORD="your_password"
export MYSQL_DATABASE="your_database"

Usage

After setting environment variables, start the server:

mcps-mysql-server

MCP/Claude/Cursor Integration

Add this to your MCP configuration (e.g., ~/.cursor/mcp.json):

{
  "mcpServers": {
    "mysql-server": {
      "command": "mcps-mysql-server",
      "env": {
        "MYSQL_HOST": "localhost",
        "MYSQL_USER": "your_user",
        "MYSQL_PASSWORD": "your_password",
        "MYSQL_DATABASE": "your_database"
      }
    }
  }
}

Available Tools

execute_sql

Execute an SQL query on the MySQL server.

Example:

SELECT * FROM users LIMIT 10;

Available Resources

  • mysql://tables — List all tables in the database.
  • mysql://table/{table_name} — Get the schema of a specific table. Example: mysql://table/users

Development

  • All main code is in the mysql_server/ directory.
  • Use pip install -e . for editable installs during development.
  • If you add tests, place them in a tests/ directory.

Project Structure

.
├── mysql_server/           # Main package code
├── pyproject.toml          # Build system and metadata
├── README.md               # This file
├── LICENSE                 # License file
└── .gitignore              # Git ignore rules

Troubleshooting

  • Command not found:
    Ensure your Python Scripts directory is in your PATH.
    On Windows, this is usually C:\Users\<YourUser>\AppData\Local\Programs\Python\Python3x\Scripts.

License

MIT License

Metadata

Release files for mcps-mysql-server 0.1.5

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

Source distribution (sdist)

Source distribution for mcps-mysql-server 0.1.5
File Size Uploaded Provenance
mcps_mysql_server-0.1.5.tar.gz 5.1 MB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for mcps-mysql-server 0.1.5
File Interpreter ABI Platform
mcps_mysql_server-0.1.5-py3-none-any.whl Python 3 none any Details

Total release size: 11.2 MB

Release files / mcps_mysql_server-0.1.5.tar.gz

Download URL mcps_mysql_server-0.1.5.tar.gz
Size 5.1 MB
Tags Source
SHA-256 checksum
How to use checksums
362ee886cd66e2868a7902f5d7f59f65cdabea07127519681c9ff7e9bee91c13
BLAKE2b-256 checksum
How to use checksums
0e858af5e96e449cee49c8d7a0625b665e27479b078a55b71d2b5bdb4e335c51
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.3

Release files / mcps_mysql_server-0.1.5-py3-none-any.whl

Download URL mcps_mysql_server-0.1.5-py3-none-any.whl
Size 6.1 MB
Tags Python 3
SHA-256 checksum
How to use checksums
ee65f7ad62b1c2d05181d30a183f9fc0402f2e01025a3ca454d6ff36d3d8f865
BLAKE2b-256 checksum
How to use checksums
b8e2b9db7d4f96ae26eafab430d06859df5ac54ea3c7828b485f1f7c52d97d6a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.3

Security for mcps-mysql-server 0.1.5

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.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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