Skip to content

feat(mcp): add dcd mcp install, and lead the docs with the standalone binary - #267

Merged
riglar merged 1 commit into
devfrom
feat/mcp-install
Oct 26, 2026
Merged

riglar merged 1 commit into
devfrom
feat/mcp-install

Conversation

@riglar

@riglar riglar commented Oct 26, 2026

Copy link
Copy Markdown
Contributor

Why

The MCP docs told people to start the server with npx. That needs Node 22+, checks npm every time the server starts, can run a different version than the user's dcd, and bypasses the standalone binary the README tells people to install. A bare "command": "dcd" isn't a fix either: desktop apps (Claude Desktop, Cursor) opened from the Dock or Start menu don't read the shell rc that puts ~/.dcd/bin on PATH, so they fail with "command not found".

What

dcd mcp install [client] (new)

  • Clients: claude-code, claude-desktop, cursor, vscode. Asks when left out (needs a TTY; otherwise errors with the list).
  • Claude Code: runs claude mcp add --scope user devicecloud -- …, removing an older devicecloud entry first.
  • VS Code: runs code --add-mcp '{…}' (adds it to the user profile).
  • Claude Desktop / Cursor: merges an entry into claude_desktop_config.json / ~/.cursor/mcp.json and keeps everything else in the file. A file that isn't plain JSON is left alone, and the error shows the entry to add by hand.
  • Always starts dcd by full path:
    • standalone binary: process.execPath;
    • npm install: node plus the script. It uses the node on PATH that is the same file (/opt/homebrew/bin/node), not Homebrew's versioned Cellar path that brew upgrade removes, and argv[1] as started, not resolved, so the npm bin link survives upgrades.
    • It refuses to run from source or from the npx cache, since those paths don't last.
  • --read-only, --print (show what would be added, change nothing) and --json.
  • Warns when not signed in.
  • citty runs a parent's run after its subcommand, so dcd mcp's run now returns early when a subcommand is given. Plain dcd mcp still starts the server as before.

Install scripts

  • install.sh and install.ps1 list dcd mcp install under "Get started" and print the binary's full path for hand-written configs.

README

  • Leads with dcd login + dcd mcp install.
  • Hand-written configs use the full path, with an explanation of why.
  • Adds VS Code's own format (servers plus "type": "stdio"), which the old mcpServers example didn't cover.
  • npx stays as the fallback for npm users.

CLAUDE.md: a note on the install command and the citty guard.

Testing

  • pnpm typecheck, pnpm lint (0 errors), pnpm test:unit: 471 passing, 9 new in test/unit/mcp-install.test.ts.
  • By hand, from dist/: --print for all four clients; a real write to a temporary Cursor config (other entries and keys kept, second run reports "Updated", a non-JSON file left untouched); --json; unknown client and no-TTY errors; dcd mcp --read-only still starts the server.
  • claude mcp add / remove --scope and code --add-mcp flags checked against their --help. Not run for real against Claude Code or VS Code, and not tested on Windows. On Windows, claude and code are often .cmd shims, which a spawn without a shell can't find; the command then prints the line to run by hand.
  • The standalone-binary path wasn't tested from a compiled binary (it's process.execPath).

Related: devicecloud-dev/dcd#1820 (the same setup as a dashboard config generator).

🤖 Generated with Claude Code

… binary

dcd mcp install [claude-code|claude-desktop|cursor|vscode] adds the
server to an AI tool: through claude mcp add or code --add-mcp, or by
merging an entry into the Claude Desktop / Cursor JSON config. Entries
start dcd by full path, since desktop apps don't see the shell's PATH.

The install scripts point at dcd mcp install and print the full path.
The README leads with dcd mcp install, then full-path configs for each
client (with VS Code's own format), with npx as the fallback.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@claude

claude Bot commented Oct 26, 2026

Copy link
Copy Markdown

Code review

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

🤖 Generated with Claude Code

@riglar
riglar merged commit 8bff82e into dev Oct 26, 2026
9 checks passed
@riglar
riglar deleted the feat/mcp-install branch October 26, 2026 10:34
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