pymcp
pymcp
はFastMCPベースのPythonプロジェクトで、MySQLデータベースと対話するためのツールを提供します。このプロジェクトはサーバーとクライアント間の通信をサポートし、さまざまなツールを使用してデータを照会および分析できます。
プロジェクト構造
インストールと実行
1. 依存インストール
Python 3.13以降が必要です。依存関係をインストールするには、以下のコマンドを実行してください。
2. サーバーの実行
サーバーを実行するには、 main.py
を実行してください。
サーバーはデフォルトで0.0.0.0:8080
で実行されます。
3. クライアントの実行
クライアントを実行するにはclient.py
を実行します。
クライアントはサーバーと通信してMySQLクエリを実行したり、ツールのリストを検索したりできます。
環境設定
環境によっては MySQL 設定が異なる場合があります。
- ローカル環境:
src/env.py
- 開発環境:
src/env_dev.py
環境はAPP_ENV
環境変数で設定できます。デフォルトはlocal
です。
提供ツール
サーバーが提供するツールは次のとおりです。
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接続設定を含む環境変数ファイル。環境に応じて適切な設定を読み込みます。
This server cannot be installed
hybrid server
The server is able to function both locally and remotely, depending on the configuration or use case.
A FastMCP-based server that enables interaction with MySQL databases, supporting client-server communication for querying and analyzing MySQL data.
Related MCP Servers
- -securityAlicense-qualityAn 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 -483JavaScriptMIT License
- -securityFlicense-qualityFacilitates 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 -2JavaScript
- AsecurityAlicenseAqualityAn MCP server that provides read-only access to MySQL databases.Last updated -441917JavaScriptMIT License
- -securityAlicense-qualityA 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 -53PythonMIT License