Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

mcp: allowing an MCP tool by its documented name hides it; the bare name must be allowed too

已关闭 适合新手
#54,919 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
68/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
typescript
领域
security, tooling

调研方向

阅读 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 without options.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
  1. opencode run --agent <agent with the first permissions> --model <model> "List the names of all your tools." — section_read is not listed.
  2. Same with the second permissions — section_read is 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

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

anomalyco/opencode 的其他 Issue

查看 anomalyco/opencode 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。