mcp: allowing an MCP tool by its documented name hides it; the bare name must be allowed too
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 2/5
- 预计耗时
- 1-3 小时
- 新手友好度
- 68/100
- Issue 类型
- 缺陷
- 描述清晰度
- 描述清楚
- 活跃度
- 活跃
- 技术栈
- typescript
调研方向
阅读 packages/core/src/tool.ts 第 231 行附近和 packages/core/src/tool/mcp.ts 第 52 行附近的代码,以追踪两处权限检查。使用 issue 中的权限配置和 opencode run 命令复现问题,然后验证允许 tutorapi_section_read 后,工具是否会显示并可调用。Issue 建议使用文档记载的权限名称注册 MCP 工具。
由索引模型根据 Issue 内容生成。
描述
Description
What we want: an agent that may use only one MCP tool — section_read from the local MCP server tutorapi.
As the docs say — does not work, the agent does not see the tool:
permissions:
- { action: "*", resource: "*", effect: deny }
- { action: tutorapi_section_read, resource: "*", effect: allow }
What works — the same tool allowed twice, also by its bare name:
permissions:
- { action: "*", resource: "*", effect: deny }
- { action: section_read, resource: "*", effect: allow }
- { action: tutorapi_section_read, resource: "*", effect: allow }
Why: OpenCode checks the permission twice, under different names:
section_read— when it decides whether to show the tool to the agent;tutorapi_section_read— when the agent calls the tool.
Where in the code (v2.0.27):
packages/core/src/tool.ts:231— tool list:whollyDisabled(tool.options?.permission ?? name, rules). MCP tools are registered withoutoptions.permission, so the bare name is checked.packages/core/src/tool/mcp.ts:52— tool call:permission.assert({ action: name(tool.server, tool.name), ... }).- Possible fix: register MCP tools with
options.permission: name(tool.server, tool.name).
Plugins
opencode-claude (local plugin), openchamber agent-tool
OpenCode version
2.0.25 (the same code is in v2.0.27)
Steps to reproduce
opencode run --agent <agent with the first permissions> --model <model> "List the names of all your tools."—section_readis not listed.- Same with the second permissions —
section_readis listed and the call succeeds.
Operating System
Windows 11 (10.0.26200)
Terminal
None, opencode run started from a Node script.
- 主要语言
- TypeScript
- 星标
- 213k
- 派生
- 28.4k
- 平均合并
- 8 小时 58 分钟
- 30 天内合并 PR
- 251
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
anomalyco/opencode 的其他 Issue
-
reproduced
难度 2/5 1-3 小时 新手友好度 70/100
anomalyco/opencode#56038 · 1 条评论 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 70/100
anomalyco/opencode#56002 · 1 条评论 ·
维护者通常 1 天内回复
-
app: keybinds match the produced character, so Ctrl+F and other letter shortcuts fail on non-Latin layouts可能已有人在做 @ZXLyyds100 于 1 天前认领。 未关闭reproduced
难度 2/5 1-3 小时 新手友好度 82/100
anomalyco/opencode#55676 · 2 条评论 ·
维护者通常 1 天内回复
-
tui: NumPad End/Home ignored under kitty keyboard protocol (Windows Terminal reports KP_END 57424)可能已有人在做 @argszero 于 1 天前认领。 未关闭reproduced
难度 2/5 1-3 小时 新手友好度 75/100
anomalyco/opencode#55533 · 2 条评论 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 62/100
anomalyco/opencode#55383 · 3 条评论 ·
维护者通常 1 天内回复
查看 anomalyco/opencode 的全部 Issue
相似的 Issue
-
bug engine
难度 2/5 1-3 小时 新手友好度 86/100
frostney/GocciaScript#1746 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 67/100
agilepathway/label-checker#739 · 4 条评论 ·
维护者通常 1 天内回复
-
难度 1/5 1 小时以内 新手友好度 68/100
CopilotKit/OpenBot#800 ·
维护者通常 1 天内回复
-
Endpoint links in the tag operations list are below the 24px target size可能已有人在做 @AdzerKI 今天认领。 未关闭
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 79/100
ehmpathy/rhachet-roles-bhuild#471 ·
维护者通常 1 天内回复