mcpField
T
tollbooth

tollbooth

本地服务
github.com/chrzanowyAI 与智能体011 周前更新

关于 tollbooth

tollbooth 是面向 AI Agent 的可自托管后端,提供跨会话记忆、页面变更检查、JavaScript 渲染、代码执行和共享看板。它通过 HTTP API 和远程 MCP 服务提供这些有状态能力,并为响应附带机器可读回执。

主要功能

  1. 01跨会话事实存储与检索
  2. 02页面变更跟踪
  3. 03JavaScript 页面渲染
  4. 04运行 Python、Node 和 Bash
  5. 05共享追加式看板与摘要
  6. 06机器可读的操作回执

适用场景

  1. 01跨 Agent 会话保存部署笔记
  2. 02检查监视页面是否发生变化
  3. 03提取 JavaScript 渲染页面的文本
  4. 04在容器沙箱中运行代码
  5. 05通过共享看板协调多个 Agent

MCP 相关

在 `/mcp` 提供 streamable HTTP 远程 MCP 服务。MCP 客户端可调用记忆、监视、渲染、执行和共享看板工具。

配置

本地服务的配置在各客户端中通用,复制后粘贴到客户端的 MCP 配置文件即可。

mcp.json · 通用配置
{
"mcpServers": {
"chrzanowy-agent-tollbooth": {
"command": "docker",
"args": [
"run",
"-i",
"--rm",
"ghcr.io/chrzanowy/agent-tollbooth:v0.1.2"
]
}
}
}
启动命令docker run -i --rm ghcr.io/chrzanowy/agent-tollbooth:v0.1.2

本地服务需要在你的电脑上安装运行环境(如 Node.js 18+)。各客户端的配置文件位置不同,请参考客户端文档。

安装包
ocighcr.io/chrzanowy/agent-tollbooth:v0.1.2

工具

还没有获取到工具列表

本地服务需要在你的电脑上运行后才能读取工具,维护者暂未提供工具列表。

详细介绍

tollbooth

面向 AI Agent 的有状态后端。 Agent 是无状态的:会话结束后,它们就会忘记;它们无法等待,也无法监视。tollbooth 是一个小巧、可自托管的服务,为 Agent 提供无状态性使其无法拥有的五种能力:

原语Agent 能获得什么为什么它自己做不到
memory跨会话存储 / 回忆事实会话结束时,它的上下文也随之消失
watch“自从我上次查看后,这个页面有什么变化?”它无法记住页面之前的样子
render将 JS 渲染的页面转换为干净文本(使用真正的 Chromium)普通 fetch 无法运行 JavaScript
execute运行 python/node/bash,获取 stdout/stderr/退出代码有些运行环境没有内置沙盒
board共享的、仅追加的日志和摘要,供独立启动的 Agent 协作它们的会话和父进程没有重叠

每个响应都附带机器可读的回执(tool、price_usd、latency_ms、timestamp)。本地使用时一切免费;回执格式保持稳定,因此基于它构建的工具也能用于托管版。

快速开始(Docker)

docker run -p 4402:4402 -v tollbooth-data:/data ghcr.io/chrzanowy/agent-tollbooth:latest
# tollbooth (local tier) listening on http://localhost:4402

或者从源代码构建:

docker compose up --build

或者不使用 Docker(render 还需要额外一步):

npm install
npx playwright install chromium   # optional — enables render.extract
npm run dev

与它交互

# The homepage is machine-readable — the catalogue with prices and latencies
curl -s localhost:4402/.well-known/tollbooth.json | jq .

# memory: persist a fact, recall it in any future session
curl -s localhost:4402/memory -H 'content-type: application/json' \
  -d '{"key":"deploy-cmd","content":"make deploy ENV=prod","tags":["ops"]}' | jq .
curl -s 'localhost:4402/memory?q=deploy' | jq .

# watch: baseline now...
curl -s localhost:4402/watch -H 'content-type: application/json' \
  -d '{"url":"https://example.com/pricing","note":"competitor pricing"}' | jq .
# ...and any later session asks "what changed since I last looked?"
curl -s -X POST localhost:4402/watch/1/check | jq .

# render: JS-rendered page → clean text
curl -s localhost:4402/render -H 'content-type: application/json' \
  -d '{"url":"https://example.com","format":"text"}' | jq .

# execute: run code, get stdout/stderr/exit code
curl -s localhost:4402/execute -H 'content-type: application/json' \
  -d '{"language":"python","code":"print(6*7)"}' | jq .

# board: open a rendezvous point for a repo or feature
curl -s localhost:4402/board/open -H 'content-type: application/json' \
  -d '{"topic":"repo:github.com/owner/name"}' | jq .
# boards form a namespace: the topic above is the project's inbox, and each
# workstream gets its own board (own digest, own lock) under a ctx: suffix.
# The one-line description is what board listings show as the menu label.
curl -s localhost:4402/board/open -H 'content-type: application/json' \
  -d '{"topic":"repo:github.com/owner/name/ctx:auth-refactor","description":"auth refactor workstream"}' | jq .
# board: list a project's contexts in one call — the prefix query is the map lookup
curl -s 'localhost:4402/board?query=repo:github.com/owner/name' | jq .
# board: post a finding (replace 1 with the returned board id)
curl -s localhost:4402/board/1/post -H 'content-type: application/json' \
  -d '{"author":{"name":"agent-a","model":"haiku"},"content":"Tests pass after the parser change."}' | jq .
# board: catch up from the latest digest
curl -s 'localhost:4402/board/1?limit=200' | jq .
# board: write a digest after reviewing the log
curl -s localhost:4402/board/1/digest -H 'content-type: application/json' \
  -d '{"author":{"name":"janitor","model":"haiku"},"content":"Parser change is tested and ready for review.","expected_version":0}' | jq .

从 Agent 使用(MCP)

tollbooth 在 /mcp 提供远程 MCP 端点(可流式传输的 HTTP)——无需启动本地进程,因此也适用于能发起 HTTPS 请求、但无法安装任何内容的运行环境。

Claude Code:

claude mcp add --transport http tollbooth http://localhost:4402/mcp

提供的工具:memory_store、memory_recall、watch_add、watch_check、watch_list、render_extract、execute_run、board_open、board_list、board_post、board_read、board_digest。

教会你的 Agent 如何使用它

如果 Agent 不知道何时该使用某个工具,它就不会使用。本仓库提供了五个技能,位于 .claude/skills/:

技能说明
tollbooth何时使用各个原语,以及何时不必使用
checkpoint按需将本次会话中有长期价值的结论保存到 board
janitor将 board 精简为摘要(使用轻量模型运行)
warmstart使用 board 为新会话预热,而不是重新阅读对话记录(为避开保留的 /resume 内置命令而命名)
toolbox机器全局的问题 → 有效工具日志(在 memory 中使用 ns=toolbox):构建前先回忆,只存储你亲眼确认有效的内容

将它们复制到 ~/.claude/skills/,即可在每个项目中使用(也可以复制到某个项目的 .claude/skills/);或者将其内容用作非 Claude 运行环境(GPT、DeepSeek、GLM、Grok)的系统提示词章节(API 使用纯 HTTP,因此相同的指令可在任何地方使用)。

cp -R .claude/skills/* ~/.claude/skills/

如需零 token 的上下文捕获,scripts/tollbooth-hook.mjs 会自动将每个会话结束时的上下文发送到对应项目的 board — 有关一次性 hook 设置,以及将这些捕获内容转为预热内容的轻量模型摘要方案,请参阅 docs/warm-start.md。

配置

环境变量默认值含义
PORT4402HTTP 端口(402 = Payment Required——这个玩笑就是路线图)
TOLLBOOTH_DATA_DIR./dataSQLite 状态数据的存放位置
TOLLBOOTH_TIERlocalcloud 会在目录 / 回执中启用非零价格

关于 execute 的安全说明

容器就是沙盒边界:提交的代码会以容器权限运行。如果不受信任的 Agent 能访问 tollbooth,请在随附的 Docker 镜像(或等效的一次性容器)中运行 tollbooth,切勿直接在你在意的机器上运行。

路线图

  • 后台轮询监视 + Webhook(真正的“通知我”,而不只是按需比较差异)
  • 托管版:在相同 API 后接入 Stripe 额度和 x402 按次付费,供无法自托管的沙盒中的 Agent 使用
  • distill(针对目标压缩日志 / HTML / 仓库),作为免费的本地工具

许可证

MIT

评论

支持 Markdown

第一次接触 MCP?

从协议是什么,到在客户端里装上第一个服务,这几条回答覆盖了大多数入门问题。

一个开放协议,规定了 AI 应用如何以统一方式连接外部工具与数据源。客户端负责与模型对话,MCP 服务负责提供工具、资源和提示模板,两者通过标准消息通信,同一个服务可以被不同客户端复用。