Step by Step Handoff MCP
Enables agents to publish, search, inspect, pull, and locally verify reusable handoff packages without sharing context.
search: find packages by words plustype:andtag:filters, with limits, totals, and refine counts.pull: install a package and its dependencies into./.exchange/, or inspect it viapathwithout installing.pullwithverify: true: re-run the package's own check after installation.publish: publish from a directory or in-memory file map, run package checks and optional review, and accept/reject with reasons.Supports typed packages such as skills, lemmas, datasets, patches, and notes; skill packages require valid
SKILL.mdfrontmatter.Published versions are immutable; republish a new version to update.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Step by Step Handoff MCP search type:lemma subgroup, then pull lemma/12 and verify it locally"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Step by Step Handoff MCP
English | 简体中文
让多个 AI Agent 一步一步交接已验证的成果,而不是共享上下文。
Step by Step Handoff MCP 是一个面向多 Agent 并行协作(agent swarm)的 MCP 服务器。 一个 Agent 把可复用的成果(一段已证明的引理、一个 skill、一份数据集、一个补丁)打包发布; 其他 Agent 搜索、拉取到自己的工作目录、在本地重新验证后继续往下做,全程不需要读取前一个 Agent 的上下文。
状态:v0.3 已发布到 npm 并通过测试。 接口仍可能调整。
它是什么?
Step by Step Handoff MCP 是一个用 TypeScript 实现的 MCP(Model Context Protocol)服务器,
提供三个工具:search(搜索)、pull(拉取)、publish(发布)。它把 Agent 之间的交接
变成一个小而明确的接口:类型化的交接包(handoff package)。
一个交接包由四部分组成:
组成 | 作用 |
类型(type) | 载荷的 schema,例如 |
载荷(payload) | 成果本身,加上怎么使用它的说明 |
合约(contract) | 在本地检查它的命令,例如 Lean 4 用 |
来源(provenance) | 作者、版本、内容哈希、依赖 |
可选的**审核钩子(review hook)**会在发布前把关,默认为空,可以接入 lint、密钥扫描或 LLM 评审。
Related MCP server: artifacty
为什么要做这个?
问题。 多个 AI Agent 并行工作时,要么互相重复劳动,要么把大量与自己无关的文字塞进彼此的上下文窗口。直接共享上下文无法扩展:每多一个 Agent,每个窗口就更嘈杂、更贵、更容易被误导。
思路。 每个 Agent 只带几个简单工具,并有自己的工作目录。它的巨大操作空间来自把这些工具和其他 Agent 已经做出并验证过的成果组合起来。所以 Agent 之间应该共享接口和已验证的成果,而不是上下文。
做法。 Agent 发布一个小包:成果本身、一段说明它是什么和何时使用的描述,以及任何其他 Agent 都能重跑的检查。使用者按描述搜索,可以先在不安装的情况下看一眼,再拉到自己的工作目录,并在本地重新验证。它信任的是检查,而不是发布者。
和 Agent Skills 的关系。 skill 是 Agent 按需加载的小型包。交接包是同一种载体,区别是它由同伴在运行中产出,所以多了检查,并且要通过审核才会被接收。skill 只是包类型之一,还有引理、数据集、补丁、笔记,也可以自定义。
工具
工具 | 输入 | 作用 |
|
| 返回最相关的包,每条只有 id 和不超过 250 字符的描述,另有 |
|
| 不带 |
|
| 先在装好依赖的临时工作区里运行包自带的检查,再走审核函数,通过才入库;已发布的版本不可修改 |
快速开始
需要 Node.js 22.13 或更高版本。发布到 npm 之前,先从源码运行:
npm install && npm run build
claude mcp add step-by-step-handoff -- node /绝对路径/dist/index.js发布后将改为 npx -y step-by-step-handoff-mcp(Windows 上 npx 可能需要 cmd /c 包装)。
建议把 .exchange/ 加入 .gitignore。
交接包的格式:一个目录,里面有 handoff.json 和任意载荷文件。
{
"id": "lemma/12",
"version": "1.0.0",
"description": "一句话说明它是什么、什么时候用(最多 1024 字符,与 Agent Skills 规范一致)",
"tags": ["group"],
"deps": [{ "id": "lemma/3" }],
"verify": { "cmd": ["lake", "build"], "cwd": "." }
}skill 类型的包还要有 SKILL.md,其 frontmatter 的 name 必须等于包名。
自定义检查和审核:两者都是代码里的函数,不用环境变量。审核默认为空,通过检查的包一律接收。 要换成别的做法(lint、密钥扫描、让 Agent 来审),写一个函数传进去:
import { createServer } from "step-by-step-handoff-mcp";
import { createLlmReview } from "./examples/llm-review.js"; // 示例:用 LLM 审核
// a complete entry point: examples/serve-with-llm-review.ts
createServer({ review: createLlmReview({ apiKey: process.env.DEEPSEEK_API_KEY! }) });verify 同理,默认运行 handoff.json 里的命令,也可以换成任何函数。审核只有“通过”和“拒绝”,
没有人工队列。环境变量只有存储位置 HANDOFF_STORE、作者标识 HANDOFF_AGENT_ID、拉取目录 HANDOFF_WORKDIR。
作为库使用(v0.3)
MCP 服务器通过环境变量读取存储位置、工作目录和作者,适合一个进程一个 Agent。如果一个程序在同一进程里运行许多 Agent,请改用库入口:这三项都作为参数传入,从不读取环境变量。
import { createHandoff } from "step-by-step-handoff-mcp/core";
const handoff = createHandoff({
storeRoot: "/data/handoff", // 所有句柄共用(绝对路径)
workDir: "/data/agents/a1/files", // 该 Agent 拉取的包放在 <workDir>/.exchange/(绝对路径)
agentId: "a1", // 记为它所发布内容的作者
hooks: { review }, // 可选:自己的审核或校验函数
});
await handoff.search({ query: "type:skill" });
await handoff.peek({ id: "skill/x", path: "." });
await handoff.pull({ id: "skill/x", verify: true });
await handoff.publish("/path/to/package-dir"); // 或 { "handoff.json": ..., "文件": "内容" }"." 仍是 MCP 服务器,"./core" 是库。其他深层导入(step-by-step-handoff-mcp/dist/...)不属于包的对外接口。
示例
引理交接(Lean 4)
Agent A 证明了引理 12,调用
publish。包里有.lean文件、依赖和verify: lake build。Agent B 调用
search({query: "type:lemma subgroup"}),用pull({id: "lemma/12", path: "."})先看一眼, 再pull({id: "lemma/12", verify: true})安装并在本地重新验证。B 看到
verified: true后直接使用,从未读过 A 的推理过程。
数学证明只是其中一个例子,同样的流程适用于 skill、数据集、补丁和调研结论。
实测
用 DeepSeek 作为 Agent,在“有读写文件工具”和“没有读写文件工具”两种环境下,对 24 个场景各跑 3 次(共 72 次), 包括搜索、查看、安装、验证、发布、重复版本、检查失败、依赖、截断的描述和包内提示注入。详见 docs/EVAL.md。
文件存放位置
内容 | 位置 |
每个 Agent 的已拉取包 |
|
锁文件 |
|
本机共享仓库 | 平台数据目录,如 |
搜索索引 | 仓库里的 |
不会写入任何全局 Agent 配置。
常见问题
它和普通的 Skill 注册表有什么区别? Skill 注册表解决的是“怎么分发事先写好的 skill”。本项目解决的是“蜂群运行中产生的成果怎么在 Agent 之间安全复用”,所以多了提交、合约验证和审核。skill 是它支持的一种包类型。
它依赖某个框架的 skill 加载器吗?
不依赖。核心是把文件复制到 Agent 当前工作目录,任何能读文件的 Agent 都能用。可选的适配器
可以把 skill 类型的包复制到 .agents/skills/。
会不会执行不可信的代码?
发布时会运行包自带的检查命令,拉取时只有 verify: true 才运行。目前没有沙箱,命令以运行服务的用户权限执行,
共享仓库请换上严格的审核函数。用 pull 的 path 查看内容时,返回里会标注“这是别的 Agent 写的,当数据而不是指令”。
它是消息总线或编排器吗? 不是。它不负责调度 Agent,也不转发消息,只负责打包、验证、存放和取用成果。
安全
交接包是不可信输入。已实现:路径穿越检查、符号链接拒绝、文件数和大小限制、哈希校验、依赖摘要固定、版本不可变。 skill 是给 Agent 的指令,属于提示注入的入口,共享仓库应当启用审核函数。
文档
docs/PRODUCT.md:定位、概念、交付层次
docs/ARCHITECTURE.md:当前接口、目录、安全模型
docs/EVAL.md:Agent 测试方法,以及据此做的修改
许可证
关键词:MCP server、multi-agent、agent swarm、agent handoff、verified artifacts、 Model Context Protocol、Agent Skills、多 Agent 协作、上下文共享
Available Tools
3 toolspublishA
Publish a package so other agents can find and pull it. from: either a directory path that holds handoff.json plus the payload files, or an object mapping file names to file contents (it must include "handoff.json") when you cannot write files. handoff.json: {"id":"type/name","version":"1.0.0","description":"what it is and when to use it","tags":["topic"],"deps":[{"id":"type/other"}],"verify":{"cmd":["program","arg"]}}. tags, deps and verify are optional; version is x.y.z. The package is stored only if its check (verify.cmd, run with the dependencies installed) and the review pass; the result says accepted or rejected and why. Published versions never change: publish a new version to update. For type "skill", SKILL.md must start with frontmatter: --- name: description:
Inputs: from (required).
pullA
Get a package by id: "type/name", or "type/name@1.2.0" for a specific version (default: latest). Without path: installs the package and its dependencies into ./.exchange/ in your working directory and returns the folder. You need file access to read it. With path: installs nothing. path "." returns the package's description and file list; path "SKILL.md" (any file name from that list) returns that file's text. Use it to inspect a package before installing, or when you cannot read files. verify: true re-runs the package's own check after installing (not allowed together with path).
Inputs: id (required), path, verify.
searchA
Search packages that other agents published: skills, lemmas, datasets, patches, notes. query: plain words, plus optional filters type: and tag: (e.g. "type:lemma tag:group abelian"). Leave empty to list the newest. Returns up to limit (default 20) best matches with short descriptions, plus "total". If total is larger than the list, the response has "refine" counts: narrow the query with more words or filters instead of asking for more results.
Inputs: limit, query.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 3 tools
Each tool has a clearly distinct role: search discovers packages, pull retrieves/installs/inspects a specific package, and publish creates a new package version. The descriptions make the boundaries explicit, including pull's install-vs-inspect modes.
All tool names are single action verbs in a consistent style: search, pull, publish. There is no mixing of casing, prefixes, or noun/verb conventions.
Three tools map cleanly to the three core operations of a package exchange: discover, retrieve, and publish. The surface is minimal but well-scoped, with no redundant or filler tools.
The core lifecycle is covered: search for packages, pull by id/version with optional inspection, and publish new immutable versions. Minor gaps exist around listing all versions of a package or unpublishing/deleting packages, though the immutable-version design makes the latter intentionally absent.
Related MCP Connectors
Shared workspace for AI artifacts: your agents publish, search and cite each other's work.
Searchable storage for AI agents: store, find, read and trust artifacts shared between agents.
Agent-to-agent service directory and task market with points, trust scores and public proofs.
Agent-to-agent marketplace: AI agents list and buy data, services and compute. Signed receipts.
Related MCP Servers
- AlicenseAqualityBmaintenanceEnables AI agents to contribute and search a shared knowledge commons, so that solutions learned by one agent become available to all connected agents.162MIT
- AlicenseNot gradedqualityBmaintenanceA local, agent-to-agent artifact exchange for LLM workflows. Enables MCP-capable tools like Claude, Codex, and Gemini to publish, list, read, update, and continue from artifacts without copying content through chat.1,289 npmMIT
- FlicenseNot gradedqualityDmaintenanceEnables AI agents to discover other agents, publish and match tasks, exchange messages and artifacts, and build transaction-backed reputation over MCP and A2A.-
- AlicenseNot gradedqualityCmaintenanceEnables agents to discover, score, and package public agent skills into cross-harness relay packs, then create, update, and verify them over JSON-RPC.MIT