内容
# handoff-mcp

作为多个LLM(Claude、Gemini、Copilot、Codex)之间的**共享内存中心**的MCP服务器。任何进入项目的代理都立即了解其架构、模式和决策 — 并可以准确地从前一个LLM停止的地方继续。
## 工具列表
| 工具 | 描述 |
|---|---|
| `create_or_get_project` | 初始化或检索项目 |
| `save_architecture` | 保存架构概述和技术栈 |
| `get_project_summary` | 项目完整概述 — 适合作为第一个调用 |
| `save_context_snapshot` | 在移交之前保存工作状态 |
| `get_context_snapshot` | 检索前一个LLM正在执行的操作 |
| `list_sessions` | 列出所有保存的会话 |
| `save_code_pattern` | 保存可重用的代码模式(JWT、FCM等) |
| `get_code_patterns` | 按类别/语言检索模式 |
| `save_architectural_decision` | 保存ADR(决策原因) |
| `get_decisions` | 检索架构决策 |
| `search_context` | 在模式、决策和快照中搜索 |
## 安装配置
无需安装。只需将以下配置添加到您的工具中,它将自动通过`bunx`运行。
> **需要 [Bun](https://bun.sh) 安装在您的机器上。**
> 使用以下命令安装:`curl -fsSL https://bun.sh/install | bash`
### Claude Desktop
文件:`~/Library/Application Support/Claude/claude_desktop_config.json`
```json
{
"mcpServers": {
"handoff-mcp": {
"command": "bunx",
"args": ["handoff-mcp"]
}
}
}
```
### Claude Code
```bash
claude mcp add handoff-mcp bunx handoff-mcp
```
### Gemini CLI
文件:`~/.gemini/settings.json`
```json
{
"mcpServers": {
"handoff-mcp": {
"command": "bunx",
"args": ["handoff-mcp"]
}
}
}
```
### GitHub Copilot (VS Code)
文件:`.vscode/mcp.json` 在您的工作区中
```json
{
"servers": {
"handoff-mcp": {
"type": "stdio",
"command": "bunx",
"args": ["handoff-mcp"]
}
}
}
```
### OpenAI Codex CLI
文件:`~/.codex/config.yaml`
```yaml
mcpServers:
handoff-mcp:
command: bunx
args:
- handoff-mcp
```
---
### 共享数据库(推荐)
默认情况下,每个工具在其工作目录中创建自己的`context.db`。要跨所有LLM共享相同的内存,请将它们全部指向同一个文件:
```json
{
"mcpServers": {
"handoff-mcp": {
"command": "bunx",
"args": ["handoff-mcp"],
"env": { "DB_PATH": "/Users/you/handoff.db" }
}
}
}
```
---
## 工作流程
```
Claude处理项目
→ create_or_get_project("my-app")
→ save_architecture({ description: "React Native + Spring Boot" })
Claude的代币耗尽
→ save_context_snapshot({
llmModel: "claude-opus-4",
taskDescription: "实现推送通知",
recentChanges: "FCM处理程序完成",
nextSteps: "连接Foreground Service,测试Android 16"
})
Gemini接管
→ get_project_summary("my-app") # 一次调用获取完整上下文
→ get_context_snapshot("my-app") # 恰好从Claude停止的地方继续
→ 继续...
```
## 开发
```bash
git clone https://github.com/Juan-Severiano/handoff-mcp
cd handoff-mcp
bun install
bun run dev # 监视模式
bun run inspect # MCP检查器
bun run build # 编译到dist/
```