mcp: allowing an MCP tool by its documented name hides it; the bare name must be allowed too
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 68/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- typescript
Hướng nghiên cứu
Đọc packages/core/src/tool.ts quanh dòng 231 và packages/core/src/tool/mcp.ts quanh dòng 52 để lần theo hai bước kiểm tra quyền. Tái hiện sự cố bằng các quyền và lệnh opencode run trong issue, sau đó xác minh rằng việc cho phép tutorapi_section_read khiến công cụ hiển thị và có thể gọi được. Issue đề xuất đăng ký các công cụ MCP bằng tên quyền đã được ghi trong tài liệu.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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.
- Ngôn ngữ chính
- TypeScript
- Star
- 213k
- Fork
- 28.4k
- Merge trung bình
- 7 giờ 22 phút
- Pull request đã merge (30 ngày)
- 276
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của anomalyco/opencode
-
pending close triaging
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
anomalyco/opencode#55070 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
opencode on clean macos zsh .export path not working because it append and it fails because no ~/.zshrc fileCó thể đã có người làm Có pull request liên kết đang mở hoặc đã được merge. Đang mởreproduced
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
anomalyco/opencode#55068 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
triaging
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 73/100
anomalyco/opencode#54887 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
reproduced
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
anomalyco/opencode#54871 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
web: sanitizer strips MathML <annotation>/<semantics> from rendered KaTeX — LaTeX source missing from DOM (copy-to-LaTeX tools broken)Có thể đã có người làm @Dante-dan đã nhận 1 ngày trước. Đang mởreproduced
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 77/100
anomalyco/opencode#54769 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của anomalyco/opencode
Issue tương tự
-
priority:high
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
immich-app/immich#32426 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
documentation good first issue hacktoberfest help wanted
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
libredb/libredb-studio#1756 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
state:triage-needed
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
Maintainer thường phản hồi trong vòng 1 ngày