codemod v1-to-v2: run at a monorepo root, it rewrites workspace members' source files but not their package.json
メンテナーはふだん 1 日以内に返信
@adlanehzx がすでに取り組んでいます。
2026年11月24日 から。
評価
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 初心者へのやさしさ
- 45/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
- 技術スタック
- node.js, typescript
- 領域
- tooling
調査の方向性
Start from the codemod runner source that ships as dist/runner-*.mjs: read discoverManifests(), updatePackageJson() and ownerManifest(), plus the doc comment pointing at #2393. Reproduce with a pnpm monorepo fixture where a workspace member depends on the SDK, run the codemod at the root, and confirm the member's source is rewritten while its package.json is not. Done means member manifests get the dependency swap (or the run exits non-zero) with a test covering the monorepo case.
索引モデルが issue の本文から書いたものです。
説明
Issue
Running npx @modelcontextprotocol/[email protected] v1-to-v2 . at the root of a pnpm monorepo, where the SDK is a
dependency of a workspace member (packages/<name>), not of the root:
- the member's source files are rewritten to import
@modelcontextprotocol/client,@modelcontextprotocol/server
and@modelcontextprotocol/node; - the member's
package.jsonis left as it was: it still depends on@modelcontextprotocol/sdkand doesn't declare
the new packages. The run ends with:
Manifests that declare @modelcontextprotocol/sdk but are not modified by the codemod — apply the listed changes yourself:
packages/<name>/package.json
Removed: @modelcontextprotocol/sdk
Added: @modelcontextprotocol/client, @modelcontextprotocol/server, ...
We saw this on every monorepo we ran it on.
Where
As published in @modelcontextprotocol/[email protected] (dist/runner-*.mjs):
discoverManifests()finds the nearestpackage.jsonwalking up from the target, plus every workspace member's manifest.updatePackageJson()only writes the first of those, the nearest one (here the root, which doesn't declare the SDK).
Its doc comment says the others are only reported, "so workspace members never receive writes the user did not
point the codemod at."- The source transforms have no such limit: they rewrite every file under the target, members included.
So the codemod does write to the workspace members, but only to their source files and never to their manifests.
Writing only the nearest manifest was a deliberate choice in #2393. This issue is about the mismatch with the source
transforms, which do write inside the members.
Consequences
- Each migrated member ends up half-migrated: its code imports v2 packages that its
package.jsondoesn't declare,
and it still declares the v1 SDK. - The user has to copy the reported "Removed/Added" lists into each member's
package.jsonby hand and reinstall
before anything builds against v2. - The run still exits 0 and reports its changes (e.g.
Changes: 15 across 8 file(s)). The manual step is one block
among the warnings, so it's easy to miss, and anything that only checks the exit code treats the migration as done.
Suggested fix
Apply the dependency swap to every manifest whose files the run rewrote. ownerManifest() already maps each file to its
manifest, so the rule "a manifest is written when its source is" follows the same scope the user pointed the codemod at.
If writing member manifests is deliberately out of scope, then exit non-zero when a rewritten member's manifest was
left unmodified, instead of only reporting it.
Found with modeval, which runs codemods against real repositories
that depend on a package and checks the results.
- 主要言語
- TypeScript
- スター
- 13.8k
- フォーク
- 2.5k
- 平均マージ
- 6日 23時間
- マージ済み PR(30日)
- 2
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
modelcontextprotocol/typescript-sdk のほかの issue
-
v2
難易度 1/5 1時間未満 初心者へのやさしさ 72/100
modelcontextprotocol/typescript-sdk#3270 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
`callTool` with `allowInputRequired: true` throws on an `input_required` result when the tool declares an `outputSchema`対応中かも @mgoldsborough が 6 日前に担当しました。 オープンv2
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
modelcontextprotocol/typescript-sdk#3249 ·
メンテナーはふだん 1 日以内に返信
-
v2
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
modelcontextprotocol/typescript-sdk#3243 · コメント 3 件 ·
メンテナーはふだん 1 日以内に返信
-
TypeScript client accepts an unknown `resultType` in the first `server/discover` reply対応中かも @Tidehyc が 7 日前に担当しました。 オープンv2
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
modelcontextprotocol/typescript-sdk#3235 · コメント 3 件 ·
メンテナーはふだん 1 日以内に返信
-
UriTemplate.match() throws a TypeError on an empty expression it accepts対応中かも @yunusemrejs が 12 日前に担当しました。 オープンv1 v2
難易度 2/5 1〜3時間 初心者へのやさしさ 80/100
modelcontextprotocol/typescript-sdk#3221 · コメント 3 件 ·
メンテナーはふだん 1 日以内に返信
modelcontextprotocol/typescript-sdk の issue をすべて見る
似ている issue
-
clawsweeper:intake:bug clawsweeper:intake:needs-environment
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
openclaw/openclaw#212827 · コメント 1 件 · リアクション 1 件 ·
メンテナーはふだん 1 日以内に返信
-
KT-2245 e2e specs that call the backend directly fall back to the developer's own Kronn on :3140オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信
-
Use one constant for the 10,000-character input limit対応中かも @NginxL が今日担当しました。 オープンgood first issue refactor
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
aniru-dh21/snap-validate#51 ·
メンテナーはふだん 1 日以内に返信
-
dependencies effort: small good first issue priority: low
難易度 1/5 1〜3時間 初心者へのやさしさ 88/100
TMHSDigital/screencast-mcp#509 ·
メンテナーはふだん 1 日以内に返信
-
from-review tech-debt testing
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
blamechris/chroxy#9520 ·
メンテナーはふだん 1 日以内に返信