STEP 1589 — MCP tool migration audit

STEP 1589 · 82+ MCP tool 全 audit + migration candidate 分類 · scripts/audit-mcp-tool-migration.ts · Rei-AIOS · 2026-08-30

目的

藤本さん directive「82+ 全 MCP tool の migration 自動化 script」 応答。 STEP 1533 wrapper factory + STEP 1571/1576/1579/1584 積み上げの 適用対象を audit script で明示化する。

Non-goal (別 STEP): .ts 自動生成 / MCP server case handler 直接修正 (別 tab 衝突リスク) / 実 hardware 呼出。 本 script は migration candidate list を出力するのみ、 実 wrap 追加は手動 review を強制。

分類 3 軸

判定 heuristic
hazardblockedpower_ / firmware_ / kikusui_cr_mode / scpi_write_ / wipe_
cautionbenchtop_probe / d8_verdict / disk_health / environment_read / smart_ / update_ / write_ 等
safe_verdict / read_ / query_ / get_ / list_ / inspect_ / search_ 等 (default)
protocol shapeuniqueness-checkpuzzle_verify (STEP 1536)
uniqueness-necessityverify_mystery / mystery_reasoning (STEP 1538)
single-verdict_verdict / get_ / list_ / search_ / find_ / describe_ / explain_
unknownheuristic 不一致 → manual review
migrationalready-wrappedPILOT_TOOL_NAMES (STEP 1533、 3 tool)
wrappableshape 判定成功 + pilot 外
manual-review-neededshape = unknown

現状 audit 結果 (2026-08-30)

HazardShapeMigration
safe~78single-verdict35already-wrapped3
caution少数uniqueness-check1wrappable33
blocked0uniqueness-necessity0manual-review44
unknown44

Manifest: data/mcp-migration/audit-2026-08-30.json (80 tool の完全 classification)

Usage

# Human report
npm run audit:mcp-migration
# → 統計 + top 20 wrappable + top 10 manual-review-needed

# JSON manifest
npx tsx scripts/audit-mcp-tool-migration.ts --json

# JSON to file
npx tsx scripts/audit-mcp-tool-migration.ts --json --out data/mcp-migration/audit-YYYY-MM-DD.json

Migration workflow (推奨)

  1. npm run audit:mcp-migration で最新 status 確認
  2. Wrappable top N を選択 (例: 5-10 tool、 hazard=safe 優先)
  3. 各 tool を src/mcp/wrapped-tools.ts に手動追加 (import + wrapAsMsgTool)
  4. test/step1533-msg-tool-wrapper-test.ts に coverage 追加 (optional)
  5. Manual-review-needed は shape 判定 (return 実 shape を source から確認) → shape 判明後 wrappable として再分類
  6. Re-run audit で coverage% 上昇確認

Test — 55/55 PASS

  1. classifyHazard — 15 pattern (blocked / caution / safe)
  2. classifyShape — 11 pattern (4 shape)
  3. classifyMigration — pilot / wrappable / manual (3 assertion + 3 pilot)
  4. scanToolDeclarations — MCP server から 30+ tool parse + STEP marker + duplicate なし
  5. summarize — aggregate counts + coverage %
  6. End-to-end audit — real MCP server scan で 30+ tool + ≥3 already-wrapped
  7. Pilots are classified as already-wrapped in real audit

Honest scope