@shopify/dev-mcp: add readOnlyHint to read-only tools so they don't prompt on every call in plan mode

未关闭 适合新手
#79 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
80/100
Issue 类型
功能
描述清晰度
描述清楚
活跃度
活跃
领域
devtools

调研方向

在 dev-mcp 包中 grep registerTool("search_docs_chunks",找到这五个工具的注册位置;同一个文件(或每个工具对应的同级模块)包含另外四个。将 issue 表格中的 annotations 对象添加到 search_docs_chunks、learn_shopify_api、validate 和 validate_theme,让 feedback 保持未标注。完成标准是复现用的 tools/list 探针恰好为这四个工具打印非 null 的 readOnlyHint。

由索引模型根据 Issue 内容生成。

描述

Summary

@shopify/dev-mcp 1.19.0 returns no annotations for any of its five tools in tools/list. MCP clients that gate on tool annotations therefore have to treat every call, including a plain docs search, as potentially state-changing.

Impact

In Claude Code's plan mode (its read-only research mode), MCP tools that the server marks readOnlyHint: true run without asking (docs). Every other MCP tool prompts for approval on each call, and those prompts don't offer "Always allow". As a result, each search_docs_chunks, learn_shopify_api and validate call during planning needs its own manual approval, even though looking up docs is exactly what plan mode is for. Other docs servers such as @upstash/context7-mcp already set readOnlyHint: true and run without prompts.

Reproduction

{ printf '%s\n' \
  '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2025-06-18","capabilities":{},"clientInfo":{"name":"probe","version":"0"}}}' \
  '{"jsonrpc":"2.0","method":"notifications/initialized"}' \
  '{"jsonrpc":"2.0","id":2,"method":"tools/list"}'; sleep 5; } \
| npx -y @shopify/[email protected] | jq -c 'select(.id==2) | .result.tools[] | {name, annotations}'

Output:

{"name":"feedback","annotations":null}
{"name":"learn_shopify_api","annotations":null}
{"name":"search_docs_chunks","annotations":null}
{"name":"validate","annotations":null}
{"name":"validate_theme","annotations":null}

Suggested fix

Based on the tool descriptions, four of the five tools only read. Annotating them would let clients run them in read-only modes:

Tool Suggested annotations
search_docs_chunks readOnlyHint: true, openWorldHint: true
learn_shopify_api readOnlyHint: true, openWorldHint: true
validate readOnlyHint: true
validate_theme readOnlyHint: true (it reads theme files; it doesn't modify them)
feedback leave unannotated, since it submits data to Shopify

With the MCP TypeScript SDK this is the annotations field on registerTool:

server.registerTool("search_docs_chunks", {
  description: "...",
  inputSchema: { /* ... */ },
  annotations: { readOnlyHint: true, openWorldHint: true },
}, handler);

Environment

  • @shopify/dev-mcp 1.19.0 (latest at time of writing), run with npx -y @shopify/dev-mcp@latest
  • Claude Code 2.1.330 (desktop app), macOS
主要语言
JavaScript
星标
652
派生
88
平均合并
6 分钟
30 天内合并 PR
2

环境准备

从这里开始

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

Shopify/Shopify-AI-Toolkit 的其他 Issue

查看 Shopify/Shopify-AI-Toolkit 的全部 Issue

相似的 Issue

更多 JavaScript Issue

把新 issue 发到你的邮箱

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