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
- -security-license-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 -8717MIT License
- Asecurity-licenseAqualityAn MCP server that provides read-only access to MySQL databases.Last updated -449643MIT License
- -security-license-qualityAn MCP server that allows working with MySQL databases by providing tools for executing read-only SQL queries, getting table schemas, and listing database tables.Last updated -3114
- -security-license-qualityA containerized server that allows interaction with MySQL databases through Model Context Protocol (MCP), enabling SQL query execution, schema retrieval, and table listing via natural language.