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.6.0.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.6.0-py3-none-any.whl (6.4 MB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: llm_toolforge-0.6.0.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.6.0.tar.gz
Algorithm Hash digest
SHA256 9ee8e03b8589e2398bbfd8799fedba7e123f8e0a03b5639bd9899378473e1cde
MD5 27bae9d0c5ea56cfc7bffe9030ae7397
BLAKE2b-256 4d70c2dc8bedd8fe32744775e6433e97e9066b55753e71c7412b9ec5eb8683b4

See more details on using hashes here.

File details

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

File metadata

  • Download URL: llm_toolforge-0.6.0-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.6.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e3d538a6aef1df3c4ad3c842655c4d4af00f03388981353bb3fc276582f42065
MD5 3494aa90d9c0aeb9eaeb141f204134ac
BLAKE2b-256 b0ac23eddb944ca49a4e72358c4ed27099bb0bbb6b80f6ff49b21ea9696b9368

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

This release

0.6.0 This release

2 files

0.5.9

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