Repository navigation
Closed
Labels
agent-runtimeAgent orchestration, memory, and extensionsAgent orchestration, memory, and extensionsenhancementNew feature or requestNew feature or requestgoPull requests that update go codePull requests that update go codehelp wantedExtra attention is neededExtra attention is neededjavascriptPull requests that update javascript codePull requests that update javascript codesecuritySecurity boundary or high-risk capabilitySecurity boundary or high-risk capability高难度
Description
Parent: #98
问题概述 / Summary
项目已有面向外部客户端的只读 MCP Server、声明式 Skill 包和不可信候选审查,但没有 MCP Client、真正的 Plugin 包或生命周期 Hooks。需要建立统一扩展运行时,同时确保外部工具、认证和钩子不能成为第二控制平面。
优先级 / Priority
P1。在模型工具 registry 稳定后接入。
当前基线 / Current baseline
- feat(mcp): Go 控制平面的 MCP Server v1 #52 已交付 Go 控制平面的 MCP Server v1,当前主要发布只读 Workspace 工具;它不是 MCP Client。
- feat(skills): 签名 Skill 包、团队 Catalog 与安全 URL/Git 导入 #53 及后续工作已建立外部 Skill 来源/模式元数据和不可信候选人工审查状态机;Skill 仍是声明式低权限资源。
- 没有远程工具发现、MCP Server 连接管理、OAuth/credential 映射、Plugin manifest/安装生命周期。
- 没有 Pre/Post Tool、Session、Compaction、Subagent 等可审计 Hook 入口。
范围 / Scope
- 实现 Go-owned MCP Client:stdio 与明确批准的远程 transport、初始化/能力协商、工具/资源/Prompt 发现、schema 校验、超时/取消、重连和健康状态。
- 每个 Server 保存来源、版本/指纹、transport、目标、认证引用、声明能力、实际能力、信任状态和 Run/Workspace Scope。
- 远程 MCP 的 OAuth/credential 由凭证管理器保存;模型、Plugin、日志和前端永不获得 bearer/raw secret。
- 定义签名
plugin.v1包,可声明 Skills、MCP server descriptors、UI metadata 与 Hooks;安装进入隔离 staging、默认禁用、人工审查后逐能力启用。 - 建立兼容/升级/回滚/撤销、publisher trust、内容 hash、固定 Git commit/HTTPS 来源和审计账本。
- 定义受限 Hooks:Pre/Post Tool、Run/Session、Compaction、Subagent、Checkpoint;输入输出有 schema、大小/时间上限、确定性和失败策略。
- Hook 只能拒绝、缩小、注释或异步记录;不得静默扩大工具参数、权限、网络、预算或替换用户决定。
- MCP tool/resource 返回值一律标记不可信,通过统一 Tool Gateway、Policy、Approval、Budget、Sandbox 和结果清洗。
非目标 / Non-goals
- 不执行 preinstall/postinstall、包管理器脚本、任意二进制或仓库内 Hook。
- 不让 Plugin 自带 credential、启动系统服务、监听公网或修改全局配置。
- 不把 MCP Server 的 capability 声明当作本地授权。
- 不自动导入 run-skill-generator 产生的候选;仍需人工审查。
- 不提供 Cyber 扩展面。
涉及目录 / Affected directories
internal/mcp/internal/plugins/internal/hooks/internal/skills/internal/toolgateway/internal/application/internal/credential/internal/policy/internal/approval/internal/store/internal/events/internal/httpapi/cmd/web/src/configs/docs/
依赖 / Dependencies
- 被“模型可调用的工作区工具”阻塞,以便复用同一 registry、schema、可见性、调用账本和结果回送协议。
- 可提前完成 Plugin manifest、安装审查和 MCP 连接状态模型,但不得开放运行入口。
验收条件 / Acceptance criteria
- 可连接至少一个本地 stdio MCP Server 和一个经明确批准的远程测试 Server,并正确协商/展示实际能力。
- MCP 工具调用全部经过统一 Tool Gateway;未授权网络、Workspace 外路径和 capability 漂移 fail closed。
- OAuth/credential 只以引用和受控注入存在,模型/UI/事件/错误不泄露 bearer。
- Plugin 包有版本、签名、publisher、hash、来源、文件清单和 capability;unsigned/untrusted 默认禁用。
- 安装/升级/回滚/撤销不执行包内代码,zip-slip、symlink、超大包、redirect/branch 漂移被拒绝。
- Hooks 有固定顺序、超时、输出上限、重入/循环保护和失败策略;不能提权或静默改写高风险调用。
- Server 重启、断线、schema 变化、工具重名和 stale capability 有确定性恢复/隔离行为。
- Desktop 可查看连接、健康、权限、来源、审查和调用审计,并逐 Server/Plugin 立即禁用。
- 单元、集成、恶意 Server/Plugin、并发、重启恢复和双语文档完成。
安全边界 / Security boundaries
MCP、Plugin 和 Hook 是低信任扩展,不拥有执行权;Go 控制平面必须在每次调用时重新做最终授权。
Metadata
Metadata
Assignees
Labels
agent-runtimeAgent orchestration, memory, and extensionsAgent orchestration, memory, and extensionsenhancementNew feature or requestNew feature or requestgoPull requests that update go codePull requests that update go codehelp wantedExtra attention is neededExtra attention is neededjavascriptPull requests that update javascript codePull requests that update javascript codesecuritySecurity boundary or high-risk capabilitySecurity boundary or high-risk capability高难度
Activity