LLM工具调用框架,同时提供 HTTP API 和 MCP Server 两种接入方式
Project description
llm-toolforge
用语大模型的工具的框架,同时提供 HTTP API(FastAPI)和 MCP Server(SSE transport)两种接入方式。
快速开始
安装框架
pip install llm-toolforge[all]
# 如果是克隆的代码安装,则在根目录执行
pip install -e ".[all]"
# 验证
toolforge --help
安装示例工具环境
cd examples
pip install -r requirements.txt
- 编辑示例工具的配置文件
cp config.example.yaml config.yaml
# 根据注释填写配置即可
- 运行:
toolforge run
打开页面http://localhost:12345进行测试。
部署
toolforge new project 会在项目目录下生成 Dockerfile
docker build -t llm-toolforge-example:v0.1.0 .
docker run --rm \
-v "$(pwd)/config.yaml:/app/config.yaml" \
-e SERVICE_NAME=llm-toolforge-example \
-p 12345:12345 \
-p 12346:12346 \
llm-toolforge-example:v0.1.0
同一套基础设施(Redis / MySQL)跑多个 toolset 时,必须为每个 Deployment 设置唯一的 SERVICE_NAME,否则日志、统计、心跳会串在一起。
优先级:环境变量 > config.yaml,两者都缺失时启动直接报错。
方式 1(推荐):环境变量
env:
- name: SERVICE_NAME
value: my-toolset
- name: SERVICE_VERSION
value: v1.0.0
方式 2:config.yaml
service:
name: my-toolset
version: v1.0.0
框架安装说明
命令llm-toolforge[all]将会安装包含的所以组件
pip install llm-toolforge[all]
如果想指定组件,可以先安装基础核心
pip install llm-toolforge
然后根据需要安装下列依赖
# 日志后端(与 config.yaml 的 logging.storage 对应)
pip install llm-toolforge[mysql] # MySQL
pip install llm-toolforge[sqlite] # SQLite
pip install llm-toolforge[redis] # Redis(心跳 / 实时流 / 统计缓存)
# AI 模型渠道
pip install llm-toolforge[ai] # 所有支持的 AI 渠道(OpenAI / 豆包 /千问)
# 对象存储(工具上传文件时用)
pip install llm-toolforge[aliyun] # 阿里云 OSS
pip install llm-toolforge[tencent] # 腾讯云 COS
框架命令
toolforge run # 启动 HTTP API + MCP 服务
toolforge run --api-only # 只起 HTTP API
toolforge run --mcp-only # 只起 MCP SSE
toolforge list # 列出已发现的工具
toolforge new project . # 初始化项目
toolforge new tool <name> # 生成工具骨架
文档
| 文档 | 内容 |
|---|---|
| 工具开发指南 | 从零创建工具 + Generator / Plugin / InputField 完整说明 |
| 接口参考 | HTTP API / MCP 协议 |
| 运行观测 | 日志 / 统计 / 负载监控 / 并发调优 |
环境变量
少量字段可由环境变量覆盖(优先级高于 config.yaml):
| 变量 | 覆盖字段 |
|---|---|
SERVICE_NAME |
service.name |
SERVICE_VERSION |
service.version |
K8s 多实例部署时推荐通过 Deployment 注入 SERVICE_NAME,避免镜像里写死。
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file llm_toolforge-0.3.1.tar.gz.
File metadata
- Download URL: llm_toolforge-0.3.1.tar.gz
- Upload date:
- Size: 6.4 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
36498fff46987b0641ea69bbeb40b0a9cd4af3f63186f48e2a4fde563f01ffe3
|
|
| MD5 |
dcc41a707cda96e7cbede605c00f366d
|
|
| BLAKE2b-256 |
f4c50065f824f92d8ae5d88ca4bf048d3cac679baca0a6a638c6ca4810a51838
|
File details
Details for the file llm_toolforge-0.3.1-py3-none-any.whl.
File metadata
- Download URL: llm_toolforge-0.3.1-py3-none-any.whl
- Upload date:
- Size: 6.4 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
156186760eee2e2b3b5fc759e93d3f8b53e56a76534afc62fdf20abba1df7171
|
|
| MD5 |
51c4cb94e9bd6e3bb0bb5fbb23bd87fb
|
|
| BLAKE2b-256 |
74a691772b2cf88e597fb5d64a5a483780ec913519e44c90aaf905fede6174a9
|