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

オープン 初心者向け
#79 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
80/100
issue の種類
機能追加
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
node.js, typescript
領域
devtools

調査の方向性

dev-mcp パッケージで registerTool("search_docs_chunks" を grep し、5 つのツールが登録されている場所を見つける。同じファイル(またはツールごとの兄弟モジュール)に残り 4 つが入っている。issue の表にある annotations オブジェクトを search_docs_chunks、learn_shopify_api、validate、validate_theme に追加し、feedback は注釈なしのままにする。完了とは、再現用の tools/list プローブが、まさにこれら 4 つのツールについて非 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分
マージ済み PR(30日)
2

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

Shopify/Shopify-AI-Toolkit のほかの issue

Shopify/Shopify-AI-Toolkit の issue をすべて見る

似ている issue

JavaScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。