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