LLM Tool-Calling Assistant

by o6-webwork

Integrations

  • Enables interaction with local LLMs running on the user's machine via an HTTP interface or OpenAI-compatible SDK.

  • Allows communication with OpenAI-compatible language models using the OpenAI SDK for tool-calling functionality.

このプロジェクトは、 MCPプロトコルを介してローカルLLM(例:Qwen)を電卓やナレッジベースなどのツールに接続します。アシスタントはこれらのツールを自動的に検出して呼び出し、ユーザーのクエリに回答します。


📦 機能

  • 🔧 MCP サーバーを介したツール実行
  • 🧠 HTTP または OpenAI SDK 経由のローカル LLM 統合
  • 📚 ナレッジベースのサポート ( data.json )
  • stdioおよびsseトランスポートをサポート

🗂 プロジェクトファイル

ファイル説明
server.pyツールを登録し、MCP サーバーを起動します
client-http.pyaiohttpを使用してローカル LLM と通信します
clientopenai.pyLLM + ツール呼び出しロジックに OpenAI 互換の SDK を使用
client-stdio.pystdio を使用する MCP クライアント
client-see.pySSEを使用したMCPクライアント
data.jsonQ&Aナレッジベース

📥 インストール

要件

Python 3.8以上

依存関係をインストールします:

pip install -r requirements.txt

requirements.txt

aiohttp==3.11.18 nest_asyncio==1.6.0 python-dotenv==1.1.0 openai==1.77.0 mcp==1.6.0

🚀 はじめに

1. MCPサーバーを実行する

python server.py

これにより、 addmultiplyget_knowledge_baseなどの関数を含むツール サーバーが起動します。

2. クライアントを開始する

オプション A: HTTP クライアント (生の API 経由のローカル LLM)
python client-http.py
オプションB: OpenAI SDKクライアント
python client-openai.py
オプションC: stdioトランスポート
python client-stdio.py
オプションD: SSEトランスポート

server.pyが以下を設定していることを確認します。

transport = "sse"

次に以下を実行します:

python client-sse.py

💬 プロンプトの例

数学ツールの呼び出し

What is 8 times 3?

応答:

Eight times three is 24.

ナレッジベースの質問

What are the healthcare benefits available to employees in Singapore?

応答には、 data.jsonからの関連する回答が含まれます。


📁 例: data.json

[ { "question": "What is Singapore's public holiday schedule?", "answer": "Singapore observes several public holidays..." }, { "question": "How do I apply for permanent residency in Singapore?", "answer": "Submit an online application via the ICA website..." } ]

🔧 構成

client-http.pyまたはclientopenai.py内で、以下を更新します。

LOCAL_LLM_URL = "..." TOKEN = "your-api-token" LOCAL_LLM_MODEL = "your-model"

LLM が OpenAI 互換の API エンドポイントを提供していることを確認します。


🧹 クリーンアップ

クライアントはツールの呼び出しと応答を自動的に処理します。Ctrl Ctrl+Cでサーバーまたはクライアントを停止できます。


🪪 ライセンス

MITライセンス。LICENSEファイルを参照してください。

-
security - not tested
A
license - permissive license
-
quality - not tested

hybrid server

The server is able to function both locally and remotely, depending on the configuration or use case.

MCP プロトコルを介してローカル LLM を外部ツール (計算機、ナレッジ ベース) に接続し、自動ツール検出と実行を可能にしてクエリ応答を強化します。

  1. 🗂 プロジェクトファイル
    1. 📥 インストール
      1. 要件
      2. requirements.txt
    2. 🚀 はじめに
      1. 1. MCPサーバーを実行する
      2. 2. クライアントを開始する
    3. 💬 プロンプトの例
      1. 数学ツールの呼び出し
      2. ナレッジベースの質問
    4. 📁 例: data.json
      1. 🔧 構成
        1. 🧹 クリーンアップ
          1. 🪪 ライセンス

            Related MCP Servers

            • -
              security
              A
              license
              -
              quality
              MCP server for toolhouse.ai. This does not rely on an external llm unlike the official server.
              Last updated -
              1
              Python
              MIT License
            • -
              security
              A
              license
              -
              quality
              A comprehensive toolkit that enhances LLM capabilities through the Model Context Protocol, allowing LLMs to interact with external services including command-line operations, file management, Figma integration, and audio processing.
              Last updated -
              14
              Python
              Apache 2.0
              • Linux
              • Apple
            • -
              security
              A
              license
              -
              quality
              An MCP server that provides tools to load and fetch documentation from any llms.txt source, giving users full control over context retrieval for LLMs in IDE agents and applications.
              Last updated -
              177
              Python
              MIT License
              • Apple
            • -
              security
              -
              license
              -
              quality
              A tool server that processes mathematical expressions via Multi-Chain Protocol (MCP), allowing LLMs to solve math problems through tool integration.
              Last updated -
              Python
              MIT License

            View all related MCP servers

            ID: d0hc6ovns6