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 5 months ago68213JavaScriptMIT License
- AsecurityAlicenseAqualityAn MCP server that provides read-only access to MySQL databases.Last updated 3 months ago477940JavaScriptMIT License
- -securityFlicense-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 3 months ago4362JavaScript
- -securityAlicense-qualityA FastMCP-based server that enables executing Microsoft SQL Server data queries and table structure queries through a standardized MCP protocol interface.Last updated 2 months ago3PythonMIT License