Python MySQL MCP

Integrations

  • Allows interaction with MySQL databases, providing tools to execute SQL queries, retrieve data, and analyze results through a client-server architecture.

pymcp

pymcp is a Python project based on FastMCP that provides tools for interacting with MySQL databases. The project supports communication between servers and clients, and allows data to be retrieved and analyzed through various tools.

Project Structure

pymcp/ ├── client.py # 클라이언트 코드 ├── main.py # 서버 실행 코드 ├── src/ │ ├── env.py # 로컬 환경 설정 │ ├── env_dev.py # 개발 환경 설정 │ ├── mcp_instance.py # MCP 인스턴스 초기화 │ ├── mysql_tool.py # MySQL 관련 도구 정의 ├── pyproject.toml # 프로젝트 메타데이터 및 의존성 ├── requirements.txt # 의존성 목록 └── README.md # 프로젝트 설명

Install and run

1. Install dependencies

Requires Python 3.13 or later. To install dependencies, run the following command:

pip install -r requirements.txt

2. Run the server

To run the server, run main.py :

python main.py

The server runs on 0.0.0.0:8080 by default.

3. Run the client

To run the client, run client.py :

python client.py

Clients can communicate with the server to execute MySQL queries or query a list of tools.

Preferences

MySQL settings are applied differently depending on the environment:

  • Local environment : src/env.py
  • Development environment : src/env_dev.py

The environment can be set via APP_ENV environment variable. The default is local .

export APP_ENV=dev # 개발 환경 설정

Tools provided

The tools provided by the server are:

  1. describe_tools
    Lists available tools and explains how to use them.
  2. query_mysql(sql: str)
    Executes a given SQL query and returns the results.
    Example: query_mysql("SELECT * FROM users LIMIT 10;")

Main File Description

main.py

This is the entry point to running the server. It initializes the MCP instance, registers the tools, and then runs the server.

client.py

This is the client code that interacts with the server. It connects to the server and can call tools.

src/mysql_tool.py

This is a file that defines MySQL-related tools. You can execute SQL queries using tools such as query_mysql .

src/env.py and src/env_dev.py

Environment variable file containing MySQL connection settings. Loads appropriate settings depending on the environment.

-
security - not tested
F
license - not found
-
quality - not tested

remote-capable server

The server can be hosted and run remotely because it primarily relies on remote services or has no dependency on the local environment.

A FastMCP-based server that enables interaction with MySQL databases, supporting client-server communication for querying and analyzing MySQL data.

  1. Project Structure
    1. Install and run
      1. 1. Install dependencies
      2. 2. Run the server
      3. 3. Run the client
    2. Preferences
      1. Tools provided
        1. Main File Description
          1. main.py
          2. client.py
          3. src/mysql_tool.py
          4. src/env.py and src/env_dev.py

        Related MCP Servers

        • -
          security
          A
          license
          -
          quality
          An MCP server that integrates with MySQL databases, enabling secure read and write operations through LLM-driven interfaces with support for transaction handling and performance monitoring.
          Last updated -
          48
          3
          JavaScript
          MIT License
        • -
          security
          F
          license
          -
          quality
          Facilitates interaction with a local MySQL database via a RESTful API, supporting database queries and real-time updates with integration for Cursor MCP services.
          Last updated -
          2
          JavaScript
        • A
          security
          A
          license
          A
          quality
          An MCP server that provides read-only access to MySQL databases.
          Last updated -
          4
          695
          17
          JavaScript
          MIT License
          • Linux
          • Apple
        • -
          security
          F
          license
          -
          quality
          A server that provides MySQL database operations through SSE (Server-Sent Events) based on the MCP (Model-Controller-Provider) framework, enabling real-time data transmission from MySQL databases.
          Last updated -
          4
          Python

        View all related MCP servers

        ID: 84q03r9to7