Skip to main content

llm-toolforge

用语大模型的工具的框架,同时提供 HTTP API(FastAPI)和 MCP Server(SSE transport)两种接入方式。


快速开始

安装框架

pip install llm-toolforge

# 如果是克隆的代码安装,则在根目录执行
pip install -e .

# 验证
toolforge --help

安装示例工具环境

cd examples
pip install -r requirements.txt
  • 编辑示例工具的配置文件
cp config.example.yaml config.yaml
# 根据注释填写配置即可
  • 运行:
toolforge run

打开页面http://localhost:12345进行测试。

默认同时启动 API 和 MCP。只需要其中一种服务时可在 config.yaml 中配置:

server:
  enable_api: true
  enable_mcp: false

部署

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

仅启用 API 时不需要映射 MCP 端口 12346

同一套基础设施(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

框架安装说明

一条命令即可安装全部组件(日志后端、对象存储等都已默认包含):

pip install llm-toolforge

默认包含的可选后端:

  • 日志后端(由 config.yaml 的 infra_mode 决定):MySQL + Redis(mysql_redis 模式)、SQLite(sqlite_standalone 模式)
  • 对象存储(工具上传文件时用):阿里云 OSS(oss2)、腾讯云 COS(cos-python-sdk-v5

旧的 pip install llm-toolforge[all] 等命令仍可用,extra 现已为空别名,效果与直接安装一致。

框架命令

toolforge new project my-app   # 创建 ./my-app/ 并生成项目初始文件
toolforge new project .        # 在当前目录初始化项目(目录已存在时使用)
toolforge new tool <name>      # 在 tools/<name>/ 下生成工具骨架
toolforge list                 # 列出已发现的工具(确认插件加载正常)
toolforge run                  # 按 config.yaml 启动服务(默认 API + MCP)
toolforge run --api-only       # 临时覆盖配置,只启动 HTTP API
toolforge run --mcp-only       # 临时覆盖配置,只启动 MCP SSE
toolforge run -c path/cfg.yaml # 指定配置文件路径

文档

文档 内容
工具开发指南 从零创建工具 + Generator / Plugin / InputField 完整说明
接口参考 HTTP API / MCP 协议
运行观测 日志 / 统计 / 负载监控 / 并发调优

环境变量

少量字段可由环境变量覆盖(优先级高于 config.yaml):

变量 覆盖字段
SERVICE_NAME service.name
SERVICE_VERSION service.version

K8s 多实例部署时推荐通过 Deployment 注入 SERVICE_NAME,避免镜像里写死。


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

llm_toolforge-0.5.9.tar.gz (6.4 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

llm_toolforge-0.5.9-py3-none-any.whl (6.4 MB view details)

Uploaded Python 3

File details

Details for the file llm_toolforge-0.5.9.tar.gz.

File metadata

  • Download URL: llm_toolforge-0.5.9.tar.gz
  • Upload date:
  • Size: 6.4 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.9

File hashes

Hashes for llm_toolforge-0.5.9.tar.gz
Algorithm Hash digest
SHA256 1b40784330dea3024c50943fae18fd03f1da5986314158b3e008f6d1554aef70
MD5 c978af57747031d3b9c55e285dccee8e
BLAKE2b-256 90835ca04a2b74c12163fb088af2e7a52385713e4799acf11fb553106d8cd79e

See more details on using hashes here.

File details

Details for the file llm_toolforge-0.5.9-py3-none-any.whl.

File metadata

  • Download URL: llm_toolforge-0.5.9-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.13.9

File hashes

Hashes for llm_toolforge-0.5.9-py3-none-any.whl
Algorithm Hash digest
SHA256 c42f59ddb22d7209a4fa2d7797cbf52015b26807535441ea8a4526485ef18d38
MD5 05bf70be363137f345ec233e9f15c804
BLAKE2b-256 98192b25c8dd1c7b2e4cf07d5e9f39232f232475f7a5e160f565bf0d46e180ff

See more details on using hashes here.

Release history Release notifications | RSS feed

0.8.1

2 files

0.8.0

2 files

0.7.3

2 files

0.7.2

2 files

0.7.1

2 files

0.7.0

2 files

0.6.3

2 files

0.6.0

2 files

This release

0.5.9 This release

2 files

0.5.8

2 files

0.5.7

2 files

0.5.6

2 files

0.5.5

2 files

0.5.4

2 files

0.5.3

2 files

0.5.2

2 files

0.5.1

2 files

0.5.0

2 files

0.4.1

2 files

0.4.0

2 files

0.3.2

2 files

0.3.1

2 files

0.3.0

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page