このプロジェクトは、 MCPプロトコルを介してローカルLLM(例:Qwen)を電卓やナレッジベースなどのツールに接続します。アシスタントはこれらのツールを自動的に検出して呼び出し、ユーザーのクエリに回答します。
📦 機能
- 🔧 MCP サーバーを介したツール実行
- 🧠 HTTP または OpenAI SDK 経由のローカル LLM 統合
- 📚 ナレッジベースのサポート (
data.json
) - ⚡
stdio
およびsse
トランスポートをサポート
🗂 プロジェクトファイル
ファイル | 説明 |
---|---|
server.py | ツールを登録し、MCP サーバーを起動します |
client-http.py | aiohttp を使用してローカル LLM と通信します |
clientopenai.py | LLM + ツール呼び出しロジックに OpenAI 互換の SDK を使用 |
client-stdio.py | stdio を使用する MCP クライアント |
client-see.py | SSEを使用したMCPクライアント |
data.json | Q&Aナレッジベース |
📥 インストール
要件
Python 3.8以上
依存関係をインストールします:
requirements.txt
🚀 はじめに
1. MCPサーバーを実行する
これにより、 add
、 multiply
、 get_knowledge_base
などの関数を含むツール サーバーが起動します。
2. クライアントを開始する
オプション A: HTTP クライアント (生の API 経由のローカル LLM)
オプションB: OpenAI SDKクライアント
オプションC: stdioトランスポート
オプションD: SSEトランスポート
server.py
が以下を設定していることを確認します。
次に以下を実行します:
💬 プロンプトの例
数学ツールの呼び出し
応答:
ナレッジベースの質問
応答には、 data.json
からの関連する回答が含まれます。
📁 例: data.json
🔧 構成
client-http.py
またはclientopenai.py
内で、以下を更新します。
LLM が OpenAI 互換の API エンドポイントを提供していることを確認します。
🧹 クリーンアップ
クライアントはツールの呼び出しと応答を自動的に処理します。Ctrl Ctrl+C
でサーバーまたはクライアントを停止できます。
🪪 ライセンス
MITライセンス。LICENSEファイルを参照してください。
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 プロトコルを介してローカル LLM を外部ツール (計算機、ナレッジ ベース) に接続し、自動ツール検出と実行を可能にしてクエリ応答を強化します。
Related MCP Servers
- -securityFlicense-qualityAn MCP server that allows Claude to interact with local LLMs running in LM Studio, providing access to list models, generate text, and use chat completions through local models.Last updated -10
- -securityFlicense-qualityA customized MCP server that enables integration between LLM applications and documentation sources, providing AI-assisted access to LangGraph and Model Context Protocol documentation.Last updated -1
- -securityAlicense-qualityA tool server that processes mathematical expressions via Multi-Chain Protocol (MCP), allowing LLMs to solve math problems through tool integration.Last updated -MIT License
- -securityFlicense-qualityA tool that connects to local MySQL databases and enables large language models (LLMs) to execute SQL queries through the Model Context Protocol (MCP).Last updated -2691