Azure OpenAI を使用するための MCP サーバーとクライアントの実装
モデル コンテキスト プロトコル (MCP) と Azure OpenAI を活用した最小限のサーバー/クライアント アプリケーション実装。
MCP サーバーは
FastMCPを使用して構築されます。Playwrightは、最新の Web アプリケーションをテストするための、Microsoft によるオープン ソースのエンドツーエンドのテスト フレームワークです。ツールに関する MCP 応答は、OpenAI 関数呼び出し形式に変換されます。
MCP サーバー応答を OpenAI 関数呼び出し形式に変換するブリッジは
MCP-LLM Bridge実装をカスタマイズします。安定した接続を確保するために、サーバー オブジェクトはブリッジに直接渡されます。
モデルコンテキストプロトコル(MCP)
モデル コンテキスト プロトコル (MCP) MCP (モデル コンテキスト プロトコル) は、AI アプリケーションとローカルまたはリモート リソース間の安全で制御された相互作用を可能にするオープン プロトコルです。
公式リポジトリ
コミュニティリソース
関連プロジェクト
FastMCP : MCP サーバーを構築するための高速な Python の方法。
チャットMCP :MCPクライアント
MCP-LLM ブリッジ: MCP サーバーと OpenAI 互換 LLM 間の通信を可能にする MCP 実装
MCP劇作家
構成
2024年12月の開発フェーズでは、Pythonプロジェクトは「uv」で開始される予定です。「pip」や「poetry」などの他の依存関係管理ライブラリは、MCP CLIではまだ完全にサポートされていません。
.env.templateの名前を.envに変更し、Azure OpenAI の.envに値を入力します。AZURE_OPEN_AI_ENDPOINT= AZURE_OPEN_AI_API_KEY= AZURE_OPEN_AI_DEPLOYMENT_MODEL= AZURE_OPEN_AI_API_VERSION=Pythonライブラリ管理用の
uvをインストールするpip install uv uv syncpython chatgui.pyを実行するサンプル画面では、クライアントがブラウザを起動して URL に移動する様子が示されています。
'stdio' に関して
stdioはトランスポート層(生データフロー)であり、 JSON-RPCは アプリケーションプロトコル(構造化通信)です。これらは明確に区別できるものですが、プロトコルでは「JSON-RPC over stdio」のように、しばしば互換的に使用されます。
ツールの説明
ヒント: uv
ヒント
python.exe の taskkill コマンド
Visual Code: Python デバッガー: launch.json を使用してデバッグすると、.vscode/launch.json の構成を使用してデバッガーが起動します。
This server cannot be installed
hybrid server
The server is able to function both locally and remotely, depending on the configuration or use case.
モデル コンテキスト プロトコル (MCP) と Azure OpenAI を活用した最小限のサーバー/クライアント アプリケーション実装。
Related MCP Servers
- -security-license-qualityA Model Context Protocol (MCP) server that lets you seamlessly use OpenAI's models right from Claude.Last updated -9068MIT License
- Asecurity-licenseAqualityA simple MCP server for interacting with OpenAI assistants. This server allows other tools (like Claude Desktop) to create and interact with OpenAI assistants through the Model Context Protocol.Last updated -936MIT License
- -security-license-qualityA Model Context Protocol server implementation that enables connection between OpenAI APIs and MCP clients for coding assistance with features like CLI interaction, web API integration, and tool-based architecture.Last updated -35
- -security-license-qualityA Node.js-based remote Model Context Protocol (MCP) server that runs on Azure Container Apps, allowing different AI models and tools to communicate with each other in a serverless environment.Last updated -MIT License