Fix: declare @modelcontextprotocol/sdk in the workspace root manifest - #707
Open
AmaadMartin wants to merge 1 commit into
Open
Fix: declare @modelcontextprotocol/sdk in the workspace root manifest#707AmaadMartin wants to merge 1 commit into
AmaadMartin wants to merge 1 commit into
Conversation
…nifest tests/e2e/tools/mcp/mcp_resource_server.mjs imports @modelcontextprotocol/sdk. That file belongs to the workspace root package, but the root manifest does not declare the package. Node resolves the import only through packages that other manifests declare: core's dependency, and @google/genai's optional peer dependency. The root gates cannot see the gap. The ts:check, lint and format:check scripts all match *.ts only, and the importer is a .mjs file. The root manifest now declares the package at ^1.26.0, the range core already declares. The installed tree does not change: @modelcontextprotocol/sdk stays at 1.29.0, and no package is added, removed or upgraded.
AmaadMartin
force-pushed
the
fix/root-manifest-declare-mcp-sdk
branch
from
August 6, 2026 09:03
b734ef3 to
0a78373
Compare
7 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Please ensure you have read the contribution guide before creating a pull request.
Link to Issue or Description of Change
Link to an existing issue (if applicable):
N/A
Or, if no issue exists, describe the change:
Problem:
tests/belongs to no npm workspace, so the rootpackage.jsonis the nearest manifest on the Node resolution path for every file under it.tests/e2e/tools/mcp/mcp_resource_server.mjsimports@modelcontextprotocol/sdk, and the root manifest does not declare it. The import resolves only through packages that other manifests declare:core's dependency, and@google/genai's optional peer dependency. No root gate can see the gap, becauselintandformat:checkglob**/*.tsandtsc --noEmitdoes not include a.mjsfile.Solution: The root manifest now declares
@modelcontextprotocol/sdkat^1.26.0, the rangecore/package.jsonalready uses. Mirroringcore's range stops the two declarations from disagreeing, and the installed copy already satisfies it. I regenerated the lockfile withnpm install; it added one line and re-resolved nothing. The whole diff is 2 files and 2 insertions.Notes:
@modelcontextprotocol/sdk@1.29.0already satisfies^1.26.0and is already the single hoisted copy.devunset, because the package stays a production dependency ofcore.npm ci --omit=devand the published@google/adkpackage are unaffected.@modelcontextprotocol/sdkfromcore/package.jsonin a scratch clone and reinstalled: the package is still installed, because@google/genaideclares it as an optional peer at^1.25.2. So no single-variable mutation makes the root test suite fail today. The value is that the root package now asks for what it imports, instead of relying on two indirect providers it does not own.@modelcontextprotocolor that touches a manifest. None adds@modelcontextprotocol/sdkto the rootpackage.json. Fix: declare zod, @google-cloud/vertexai and openapi-types at the workspace root #601 (zod,@google-cloud/vertexai,openapi-types) and Fix: declare dotenv in the workspace root manifest #602 (dotenv) edit the samedevDependenciesblock, so a textual conflict is possible, but they declare different packages. Feat: add a phantom-dependency checker and gate CI on it #450 adds@modelcontextprotocol/sdkto a phantom-dependency allowlist; if both land, that allowlist entry goes stale.Testing Plan
Please describe the tests that you ran to verify your changes. This is required for all PRs that are not small documentation or typo fixes.
Unit Tests:
[ ] I have added or updated unit tests for my change.
[x] All unit tests pass locally.
This change adds no executable code, so there is no new line to cover. A test that asserts the content of
package.jsonwould test npm, not ADK, and the repository has no such pattern.I proved the existing regression signal is load-bearing instead.
tests/e2e/tools/mcp/load_mcp_resource_e2e_test.tsspawns the real.mjsserver as a child process. I hid the installed copy and ran that server the way the test spawns it:The e2e suite never reports that cause directly. The failure happens in a spawned child process, so the suite reports an MCP stdio connect failure instead.
Manual End-to-End (E2E) Tests:
Results:
Test Files 1 passed (1),Tests 3 passed (3). This suite needs no credentials and no network. It spawns the realmcp_resource_server.mjsover stdio.Test Files 1 passed (1),Tests 1 passed (1). This is the other root-owned consumer, throughvi.mock('@modelcontextprotocol/sdk/client/index.js').npm run build: succeeded for all workspaces.npm run lintandnpm run format:check: pass.npx prettier --check package.json package-lock.jsonreportsAll matched files use Prettier code style!.npm run ts:check: fails, and already fails onmain. I ran it on the parent commit and on this commit; the output is byte-identical, so this change neither causes nor hides those errors.rm -rf node_modules && npm ci, then re-run the e2e file: stillTests 3 passed (3), andgit statusstays clean. The lockfile is in sync with the manifests.git show --stat HEAD:2 files changed, 2 insertions(+).npm ls @modelcontextprotocol/sdknow lists an unindented@modelcontextprotocol/sdk@1.29.0under the root package, next to the existing deduped entries.Checklist
[x] I have read the CONTRIBUTING.md document.
[x] I have performed a self-review of my own code.
[x] I have commented my code, particularly in hard-to-understand areas.
[ ] I have added tests that prove my fix is effective or that my feature works.
[x] New and existing unit tests pass locally with my changes.