Skip to content

fix(mcp): correct the npx setup command - #191

Merged
finalerock44 merged 2 commits into
devfrom
fix/mcp-npx-setup
Sep 23, 2026
Merged

finalerock44 merged 2 commits into
devfrom
fix/mcp-npx-setup

Conversation

@finalerock44

Copy link
Copy Markdown
Contributor

What & why

README. The MCP setup snippet told clients to run npx -y @devicecloud.dev/dcd dcd-mcp. npx runs a package's default bin, which here is dcd, so the command ran dcd dcd-mcp and printed the CLI usage instead of starting the server. It is now ["-y", "--package=@devicecloud.dev/dcd", "dcd-mcp"], with a --read-only example.

server.json (the MCP registry manifest) had the same bug in registry form. Clients assemble an npm entry as npx <runtimeArguments> <identifier>@<version> <packageArguments>; VS Code's McpManagementService does exactly this. So the dcd-mcp package argument also reached the dcd bin. Putting --package in runtimeArguments and leaving dcd-mcp as a package argument doesn't work either, because the identifier lands where npx expects the command.

The manifest now lists -y, --package <pkg>@<version> and dcd-mcp all as runtime arguments. The identifier that a client appends after them becomes an extra argument, which dcd-mcp ignores. I checked each form against the published beta:

command result
npx -y @devicecloud.dev/dcd@beta dcd-mcp (old README) prints dcd usage
npx -y --package=@devicecloud.dev/dcd@beta dcd-mcp (new README) answers initialize + tools/list
npx -y --package @devicecloud.dev/dcd@beta dcd-mcp @devicecloud.dev/dcd@beta (VS Code's assembly of the new server.json) answers tools/list
npx -y --package=@devicecloud.dev/dcd@beta @devicecloud.dev/dcd@beta dcd-mcp (--package in runtimeArguments, dcd-mcp left in packageArguments) No such file or directory

server.json version. It was still the 5.0.0-beta.0 it was written with, and release-please didn't manage it: there were no extra-files. It now carries 5.5.0, the last stable release and the value in .release-please-manifest.json. release-please's JSON extra-files now rewrite $.version, $.packages[*].version and the --package pin on each stable release.

I dry-ran release-please's GenericJson updater logic for 5.6.0: the same jsonpath-plus major, version regex and stringify. Only those three strings change, because the file is now in canonical JSON.stringify(…, 2) form. The 5.6.0 Release PR (#185) will pick this up when the promotion lands.

Other changes:

  • $schema moves to 2025-12-11/server.schema.json, because the old URL returns 404. The description is shortened to 96 characters to fit that schema's 100-character limit. The file validates cleanly with jsonschema.
  • The dcd_list_devices tool description had its mapping inverted: it maps a device to its OS versions, not the other way round.

Not done here: the manifest isn't published. dev.devicecloud/dcd isn't on registry.modelcontextprotocol.io, no workflow publishes it, and the registry's npm ownership check would also need "mcpName": "dev.devicecloud/dcd" in package.json. The docs repo's mcp/overview.md has the same broken snippet; that's covered separately.

Type of change

  • fix — bug fix
  • feat — new feature
  • perf — performance improvement
  • refactor — code change that's neither a fix nor a feature
  • docs — documentation only
  • chore / ci / build / test — tooling, no user-facing change
  • Breaking change (title has ! or PR notes a breaking-change footer)

Checklist

  • PR title follows the Conventional Commits format (see comment above)
  • pnpm lint passes (0 errors; the 32 existing warnings are unchanged)
  • pnpm typecheck passes
  • pnpm build passes
  • I have not bumped the version or edited CHANGELOG.md (release-please handles this)
  • I have signed the CLA (the bot will prompt on first contribution)
  • Docs / README.md / STYLE_GUIDE.md updated if behaviour or output changed

How to test

  • pnpm lint && pnpm typecheck && pnpm test (with MOCK_API_DIR): 231 passing, 3 more than before.
  • test/unit/server-json.test.ts assembles the command the way VS Code does, checks that the bin exists, and pins all three versions to the release manifest. A stale or unbumped pin fails CI, including on the Release PR.
  • The MCP integration test adds a case showing that dcd-mcp tolerates the appended @devicecloud.dev/dcd@<version> and still honours a trailing --read-only.
  • Manually: npx -y --package=@devicecloud.dev/dcd@beta dcd-mcp, then send initialize + tools/list.

🤖 Generated with Claude Code

The README told MCP clients to run `npx -y @devicecloud.dev/dcd dcd-mcp`.
npx runs a package's default bin, which here is `dcd`, so that command ran
`dcd dcd-mcp` and printed the CLI's usage instead of starting the server.
The server is the package's second bin and has to be named with
`npx -y --package=@devicecloud.dev/dcd dcd-mcp`.

server.json had the same problem in registry form: clients assemble
`npx <runtimeArguments> <identifier>@<version> <packageArguments>`, so a
`dcd-mcp` package argument reached the `dcd` bin too. The manifest now puts
`-y`, `--package <pkg>@<version>` and `dcd-mcp` in runtimeArguments; the
identifier a client appends after them is an extra argument that dcd-mcp
ignores. Its version was still the 5.0.0-beta.0 it was written with and
nothing kept it current, so it now carries the last stable release and
release-please rewrites all three pins on each stable release. It also
moves to the current registry schema (the old schema URL no longer
resolves), which caps the description at 100 characters.

The dcd_list_devices tool description also had its mapping inverted: each
platform maps a device to the OS versions it runs, not the other way round.
Comment thread release-please-config.json Outdated
release-please's json updater replaces the whole matched value, so the extra-files entry pointing at the --package argument would have rewritten '@devicecloud.dev/dcd@5.5.0' to a bare '5.6.0' on the next release and broken the command again. server.json now ends runtimeArguments with a bare --package, so the '<identifier>@<version>' a registry client appends becomes its value, and dcd-mcp moves to packageArguments. The pin lives only in packages[].version, which release-please already rewrites, so that extra-files entry is dropped. The assembled 'npx -y --package @devicecloud.dev/dcd@5.5.0 dcd-mcp' was checked to start the server. The unit test now guards that no argument embeds a version and that release-please only targets bare version fields.
@claude

claude Bot commented Sep 23, 2026

Copy link
Copy Markdown

Code review

No issues found. Checked for bugs and CLAUDE.md compliance.

@finalerock44
finalerock44 merged commit 72eb5bf into dev Sep 23, 2026
9 checks passed
@finalerock44
finalerock44 deleted the fix/mcp-npx-setup branch September 23, 2026 15:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant