Skip to main content
Glama

LLM Tool-Calling Assistant

by o6-webwork

该项目通过MCP协议将本地 LLM(例如 Qwen)连接到计算器或知识库等工具。助手会自动检测并调用这些工具来帮助解答用户疑问。


📦 功能

  • 🔧 通过 MCP 服务器执行工具
  • 🧠 通过 HTTP 或 OpenAI SDK 进行本地 LLM 集成
  • 📚 知识库支持( data.json
  • ⚡ 支持stdiosse传输

🗂 项目文件

文件描述
server.py注册工具并启动 MCP 服务器
client-http.py使用aiohttp与本地 LLM 通信
clientopenai.py使用与 OpenAI 兼容的 SDK 实现 LLM + 工具调用逻辑
client-stdio.py使用 stdio 的 MCP 客户端
client-see.py使用 SSE 的 MCP 客户端
data.json问答知识库

📥 安装

要求

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.pyclientopenai.py中,更新以下内容:

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

确保您的 LLM 提供与 OpenAI 兼容的 API 端点。


🧹 清理

客户端自动处理工具调用和响应。您可以使用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
              F
              license
              -
              quality
              An 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
            • -
              security
              F
              license
              -
              quality
              A 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
              • Linux
              • Apple
            • -
              security
              A
              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 -
              MIT License
            • -
              security
              F
              license
              -
              quality
              A 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 -
              269
              1
              • Linux
              • Apple

            View all related MCP servers

            MCP directory API

            We provide all the information about MCP servers via our MCP API.

            curl -X GET 'https://glama.ai/api/mcp/v1/servers/o6-webwork/mcp-template'

            If you have feedback or need assistance with the MCP directory API, please join our Discord server