[RFC] 支持通过 repos 地址自动 clone/pull 作为 session work_dir #5
Labels
No labels
enhancement
task
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
bixiu/bixiu-mcp#5
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
动机
目前 bixiu-mcp 的 work_dir 优先级链为:
客户端需要提前知道代码在服务器上的绝对路径,或者依赖环境变量全局设置。在多项目场景下不够灵活。
提议
允许客户端在
initialize阶段通过 header / clientInfo 传入 repos 地址,bixiu-mcp 自动 clone/pull 到本地缓存目录,并将该目录设为 session 的 work_dir。工作流
需要讨论的问题
1. 传参方式
X-Repos-Url(类似X-Work-Dir)clientInfo中新增repos字段X-Work-Dir互斥?还是 repos 优先?2. 鉴权
AuthorizationHeader 或 API TokenX-Repos-Token独立传3. 目录生命周期
git pull?refresh=true)?4. 分支/标签选择
X-Repos-Refheader 来指定分支/tag/commit?5. 首次 clone 性能
6. 与现有 work_dir 的关系
关联
servers/forgejo_server.py封装 Forgejo APIX-Work-Dirheader(25a2d84)方案收敛
经过讨论,简化后的方案如下:
bixiu-mcp 的职责边界
传参方式
clientInfo新增字段:也支持
X-Repos-UrlHeader 覆盖。clone 模式
clone(默认)— 完整独立 clone 到~/.bixiu-mcp/repos/<owner>/<repo>/worktree— 创建 bare repo + worktree,适合同 repo 多分支场景鉴权
复用 API Token。如 clone 私有仓库失败,返回友好提示。
与现有 work_dir 的关系
互斥,repos 优先:
后续
initialize阶段同步 clone,60s 超时已实现并推送
基础功能已在
ipc_terminal_server.py中实现(commit141098c):新增功能
clientInfo.repos/X-Repos-UrlHeader → 自动 clone 到~/.bixiu-mcp/repos/<owner>/<repo>/https://、git@git pull使用方式
或 Header:
X-Repos-Url: git.bx.wedata.club/bixiu/bixiweave后续