Python MySQL MCP
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.txt2. サーバーの実行
サーバーを実行するには、 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 # 개발 환경 설정提供ツール
サーバーが提供するツールは次のとおりです。
describe_tools
利用可能なツールのリストと使用方法について説明します。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.pyとsrc/env_dev.py
MySQL接続設定を含む環境変数ファイル。環境に応じて適切な設定を読み込みます。
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
This server cannot be deployed
Maintenance
Related MCP Connectors
MCP server for querying and analyzing data from ad platforms, analytics tools, and spreadsheets
Token-free MCP server for structured RevoGrid Core, Pro, and Enterprise knowledge retrieval.
Hosted MySQL MCP server for Claude, ChatGPT and Cursor, with each action switched per account.
Text-to-SQL MCP server: read-only queries on PostgreSQL, MySQL and SQL Server with your real schema
Related MCP Servers
- AlicenseAqualityBmaintenanceAn MCP server that provides read-only access to MySQL databases.4546 npm75MIT
- AlicenseNot gradedqualityCmaintenanceA FastMCP-based server that enables executing Microsoft SQL Server data queries and table structure queries through a standardized MCP protocol interface.7MIT
- FlicenseNot gradedqualityNot gradedmaintenanceAn 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.-
- AlicenseNot gradedqualityDmaintenanceA production-ready MCP server for MySQL database operations, providing secure HTTP endpoints for read-only queries, performance analysis, and server monitoring.22MIT