mcp-rag
MCP を介して RAG アプリケーションを open-webui に接続する
1. ベアボーンMCP PoC / Hello World
SSEスニペットに関するドキュメントを調べる
uvicornを使用してサーバーを実行する
動作しません -> MCP ウェブサイトとは異なる
SseServerTranpsort
クラスのドキュメントを参照してくださいstarlette_appのルート -> マウントを変更すると動作します
starletteは307の一時的なリダイレクトを返すが、curlでテストすると、末尾のスラッシュがないことが原因であることがわかった。
githubリポジトリで調べたところ、ルートはサーバコードの末尾にスラッシュで終わっており、特に
sse = SseServerTransport("/messages/")
の部分はクライアントに何を呼び出すかを伝えていると思われます。プロンプトをいくつか追加してクライアント側で確認する
記事
open-webuiで使用するRAGプロトタイプの実験を行っていたので、モデルコンテキストプロトコルを試してみたいと思っています。MCPはLSPに似ています。サーバーとクライアントが同じマシン上に存在しないため、SSEトランスポートを使用する必要があります。
MCPの公式ドキュメントにはいくつかのスニペットが付属していますが、mcp Pythonライブラリが提供するドキュメント文字列に従って、少し調整する必要がありました。動作させるまでに少し時間がかかり、最初はサーバーが間違ったエンドポイントを送信していたため、307 Temporary Redirectエラーが発生していました。
テストしてみましょう!サーバーとやり取りできる小さなREPLを構築しましょう
ゴール
MCPとは何かを理解する
シンプルなサーバーとクライアントを実装する
関数呼び出し/ツールの使用を試してみる
2. 基本的な知識ベースを実装する
MCP サーバーに貼り付けて、クライアントを介して呼び出してコンテキストを取得できるシンプルな KnowledgeBase を構築したいと考えています。
3. MCPクライアント + Open-WebUI
This server cannot be installed
モデル コンテキスト プロトコル (MCP) を使用して RAG アプリケーションを open-webui に接続し、Server-Sent Events (SSE) を通じてリモート環境でのコンテキスト取得とツール使用のためのサーバーとクライアント間の通信を可能にします。
Related Resources
Related MCP Servers
- -securityFlicense-qualityEnables interaction with a TrueRAG system through a GraphQL API using the Model Context Protocol (MCP), facilitating access to policies with a Python SDK and GQL library integration.Last updated -2
- -securityFlicense-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
- -securityAlicense-qualityA server that enables interaction with any API that has a Swagger/OpenAPI specification through Model Context Protocol (MCP), automatically generating tools from API endpoints and supporting multiple authentication methods.Last updated -35104Apache 2.0
- AsecurityFlicenseAqualityA Model Context Protocol server that provides access to Magic UI components, allowing AI assistants and other MCP clients to discover and use UI components from the Magic UI design system.Last updated -211