Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

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

Đang mở Phù hợp với người mới
#54,919 1 bình luận 0 reaction 0 người được giao Xem trên GitHub

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
Lĩnh vực
security, tooling

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 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.

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

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. 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.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của anomalyco/opencode

Tất cả issue của anomalyco/opencode

Issue tương tự

Thêm issue về TypeScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.