兄弟回购
](https://www.npmjs.com/package/sibling-repo) 
MCP服务器,使Claude Code代理能够在兄弟存储库中生成完全上下文化的Claude Code会话。从前端回购中询问有关后端API的问题,计划交叉回购实现,或触发另一个代码库中的更改-所有这些都通过单个工具调用完成。支持并行运行多个代理的后台执行。
快速开始
# 1. Generate an OAuth token from your Claude subscription
claude setup-token
# Copy the output token
# 2. Create config directory and .env file
mkdir -p ~/.sibling-repo
cat > ~/.sibling-repo/.env Use sibling-repo to explore the backend and find the check-in endpoint contract安装
使用Claude Code将兄弟仓库注册为MCP服务器。无需安装--npx会自动下载并运行最新版本:
claude mcp add --scope user sibling-repo -- npx -y sibling-repo或者使用全局安装以加快启动速度:
npm install -g sibling-repo
claude mcp add --scope user sibling-repo -- sibling-repo验证:运行 claude mcp list 或使用 /mcp 在Claude Code会话中。
运作原理
┌─────────────────────────────────────────────┐
│ Claude Code session (e.g., in frontend repo)│
│ │
│ Agent calls: ask_repo("backend", prompt) │
│ │ │
│ ▼ │
│ ┌─────────────────────────┐ │
│ │ sibling-repo MCP server│ (stdio) │
│ │ (Node.js process) │ │
│ └──────────┬──────────────┘ │
│ │ │
└─────────────┼───────────────────────────────┘
│ Spawns via Claude Agent SDK
▼
┌─────────────────────────────────────────────┐
│ Ephemeral Claude Code session │
│ cwd: ~/repos/backend │
│ Loads backend's CLAUDE.md automatically │
│ Tools scoped by mode (explore/plan/execute)│
│ Returns result to MCP server │
└─────────────────────────────────────────────┘当你打电话的时候 ask_repo,同级仓库使用 Claude代理SDK。生成的代理加载目标仓库的 CLAUDE.md,具有该目录范围内的工具,并在可配置模式下运行。从调用代理的角度来看,这是一个返回兄弟代理答案的单一工具调用。
文档
故障排除
“SIBLING_REPOS未设置” 创建 ~/.sibling-repo/.env 使用您的repo配置。看 配置.
“身份验证失败” 跑 claude setup-token 生成新的OAuth令牌并更新您的 .env 文件。确保 ANTHROPIC_API_KEY 未在shell中设置(它优先于OAuth)。
“回购路径不存在” 检查您的路径 SIBLING_REPOS 配置。路径必须是绝对的。 ~ 和 $HOME 自动扩展。
代理未返回任何结果 生成的代理可能已命中 SIBLING_MAX_TURNS.提高你的限额 .env 或者写一个更具体的提示。
更新
- npx: 更新是自动的--
npx -y每次启动时获取最新版本。 - 全局安装: 跑
npm update -g sibling-repo. - 本地克隆:
git pull && npm install && npm run build
