Skip to main content
Glama
hoonzinope

Python MySQL MCP

by hoonzinope

pymcp

pymcp是一个基于 FastMCP 的 Python 项目,提供与 MySQL 数据库交互的工具。该项目支持服务器和客户端之间的通信,并允许通过各种工具检索和分析数据。

项目结构

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          # 프로젝트 설명

Related MCP server: Jewei MSSQL MCP Server

安装并运行

1.安装依赖项

需要 Python 3.13 或更高版本。要安装依赖项,请运行以下命令:

pip install -r requirements.txt

2. 运行服务器

要运行服务器,请运行main.py

python main.py

服务器默认在0.0.0.0:8080上运行。

3.运行客户端

要运行客户端,请运行client.py

python client.py

客户端可以与服务器通信以执行 MySQL 查询或查询工具列表。

偏好设置

根据环境的不同,MySQL 设置的应用也有所不同:

  • 本地环境src/env.py

  • 开发环境src/env_dev.py

可以通过APP_ENV环境变量设置环境。默认为local

export APP_ENV=dev  # 개발 환경 설정

提供的工具

服务器提供的工具有:

  1. describe_tools
    列出可用的工具并解释如何使用它们。

  2. query_mysql(sql: str)
    执行给定的 SQL 查询并返回结果。
    例如: query_mysql("SELECT * FROM users LIMIT 10;")

主要文件描述

main.py

这是运行服务器的入口点。初始化 MCP 实例,注册工具,然后运行服务器。

client.py

这是与服务器交互的客户端代码。您可以连接到服务器并调用该工具。

src/mysql_tool.py

这是定义MySQL相关工具的文件。您可以通过query_mysql等工具执行 SQL 查询。

src/env.pysrc/env_dev.py

包含 MySQL 连接设置的环境变量文件。根据环境加载适当的设置。

F
license - not found
-
quality - not tested
D
maintenance

Maintenance

Maintainers
Response time
Release cycle
Releases (12mo)
Commit activity

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Servers

  • A
    license
    -
    quality
    B
    maintenance
    A FastMCP-based server that enables executing Microsoft SQL Server data queries and table structure queries through a standardized MCP protocol interface.
    6
    MIT
  • F
    license
    -
    quality
    -
    maintenance
    An MCP server that enables interaction with MySQL databases through the Model Context Protocol, allowing execution of SQL queries and database table listing operations from Cline AI.
  • A
    license
    -
    quality
    D
    maintenance
    A production-ready MCP server for MySQL database operations, providing secure HTTP endpoints for read-only queries, performance analysis, and server monitoring.
    45
    11
    MIT

View all related MCP servers

Related MCP Connectors

  • GibsonAI MCP server: manage your databases with natural language

  • An MCP server giving access to Grafana dashboards, data and more.

  • MCP server for managing Prisma Postgres.

View all MCP Connectors

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/hoonzinope/pymcp-mysql'

If you have feedback or need assistance with the MCP directory API, please join our Discord server