Repository navigation
feat: Connect clients with plug and check connections with doctor - #4
Merged
Merged
Conversation
plug connects Claude Code, Codex, Cursor, VS Code, and Claude Desktop to https://www.taskade.com/mcp with the browser sign-in. It runs the command of the client, or it merges one entry into the JSON config file with a diff, a backup, and an atomic write. --token reads a personal access token from TASKADE_TOKEN only. doctor checks Node.js, the server and its sign-in metadata, a token with MCP initialize and tools/list, and the client config files. whoami is now an alias of doctor, so the old command works again. Version 0.2.0. The package now ships src/.
Each test gets its own HOME, USERPROFILE, APPDATA, and PATH. Fake claude, codex, code, and clipboard commands record their arguments. A fake MCP server on 127.0.0.1 answers with JSON, with an event stream, with 401, and with 403.
CI runs npm test on Node 18, 20, 22, and 24 on Linux, and on Node 22 on macOS and Windows. The release workflow checks that the tag equals the package version, then publishes through npm trusted publishing.
Lead with the one command, say what each command changes on the machine, and point to the setup prompt that needs no CLI. Add the changelog and the security policy. The copyright holder is TASKCADE INC.
There was a problem hiding this comment.
🟡 Changes recommended
Several unresolved security, cross-platform configuration, error-handling, and rollback issues could expose tokens, prevent existing configs from being updated, or leave integrations disconnected.
5 open issues
What changed in this PR
This pull request replaces the legacy token-printing CLI with OAuth-first MCP client connections and Taskade server diagnostics.
Changes:
- Adds
plug/connectsupport for Claude Code, Codex, Cursor, VS Code, and Claude Desktop. - Adds
doctor/whoamichecks for Node.js, OAuth metadata, MCP authentication, tools, and client configurations. - Adds configuration merging and backups, comprehensive tests, security documentation, CI, and npm release automation.
| File | Description |
|---|---|
| test/system.test.mjs | Tests terminal prompts, secret masking, and system helper behavior. |
| test/plug.test.mjs | Tests client connection flows, configuration updates, token handling, and command execution. |
| test/helpers.mjs | Provides isolated test environments, subprocess helpers, and fake MCP server utilities. |
| test/fixtures/fake-client.mjs | Provides fake client and clipboard commands for integration tests. |
| test/doctor.test.mjs | Tests server discovery, OAuth metadata, MCP requests, token failures, and client diagnostics. |
| test/cli.test.mjs | Tests command parsing, aliases, options, help, version output, errors, and URL validation. |
| src/system.mjs | Provides environment, process, path, terminal, clipboard, and redaction helpers. |
| src/plug.mjs | Implements client connection flows, prompts, token handling, command execution, and configuration updates. |
| src/doctor.mjs | Implements server, OAuth, token, MCP, and client configuration diagnostics. |
| src/config-file.mjs | Implements JSON parsing, merging, backups, formatting preservation, and atomic writes. |
| src/clients.mjs | Defines supported clients, configuration formats, detection, and server URL handling. |
| src/cli.mjs | Parses commands, aliases, options, validation, help, and version output. |
| SECURITY.md | Documents vulnerability reporting and token-handling practices. |
| README.md | Documents supported clients, connection commands, diagnostics, token usage, and release procedures. |
| package.json | Updates the package version, metadata, scripts, published files, and publishing configuration. |
| LICENSE | Updates the project copyright information. |
| CHANGELOG.md | Records the 0.2.0 feature set and behavior changes. |
| bin/cli.mjs | Provides the executable entry point for the modular CLI. |
| .github/workflows/release.yml | Adds version-checked npm trusted publishing with provenance. |
| .github/workflows/ci.yml | Adds cross-version and cross-platform Node.js test automation. |
Review effort: Lite
| try { | ||
| writeFileSync(temp, text, { mode }); | ||
| chmodSync(temp, mode); | ||
| renameSync(temp, target); |
Comment on lines
+344
to
+346
| let backup; | ||
| try { | ||
| backup = writeConfig(file, text, { newMode: token ? 0o600 : 0o644 }); |
| } | ||
| const maxArgs = name === "plug" ? 1 : 0; | ||
| if (rest.length > maxArgs) { | ||
| io.stderr.write(`Too many arguments for ${command}: ${rest.slice(maxArgs).join(" ")}\n`); |
| } | ||
| add("server", "ok", `Sign-in metadata: ${match[1]}`); | ||
|
|
||
| const issuer = new URL(servers[0]); |
Comment on lines
+183
to
+187
| if (existing) { | ||
| const removed = await runCommand(io, bin, ["mcp", "remove", "--scope", scope, SERVER_NAME]); | ||
| if (removed.code !== 0) return fail(`claude mcp remove failed (${removed.error || `exit code ${removed.code}`}).`); | ||
| } | ||
| const added = await runCommand(io, bin, args); |
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.


What changes
plug <client>(aliasconnect) connects Claude Code, Codex, Cursor, VS Code, or Claude Desktop tohttps://www.taskade.com/mcp. The default is the browser sign-in (OAuth). No token goes anywhere.plugwith no client lists the clients on the machine and the command for each. It changes nothing.doctor(aliaswhoami) checks Node.js, the server and its OAuth metadata, a token with MCPinitializeandtools/list, and the client config files. The oldwhoamicalled a path that does not exist and always failed with 404.--yes,--print,--project,--token,--json,--verbose,--version. An unknown command exits 1.npx @taskade/cli plug claude-desktopnow gives the steps and copies the URL.node:testin a temporary HOME, CI on Node 18 to 24, a release workflow with npm trusted publishing, a new README,CHANGELOG.md, andSECURITY.md. Version 0.2.0. No runtime dependency.Each client config shape comes from the public documentation of the client, cited in
src/clients.mjs. Windsurf is left out: its docs now give two different config files for two builds, and a wrong config is worse than a missing client.What each command does on your machine
plugplug claude-codeclaude mcp add --transport http --scope user taskade https://www.taskade.com/mcp. Claude Code writes~/.claude.json. With--project, Claude Code writes.mcp.jsonin the current folder.plug codexcodex mcp add taskade --url https://www.taskade.com/mcp, thencodex mcp login taskadeif the add step did not sign in. Codex writes~/.codex/config.toml.plug cursortaskadeentry into~/.cursor/mcp.json(or.cursor/mcp.jsonwith--project). It writes<file>.bak-<timestamp>first.plug vscodecode --add-mcp(the user profile). With--project, it merges one entry into.vscode/mcp.json.plug claude-desktopplug ... --printplug ... --tokenTASKADE_TOKEN(Codex keeps only the variable name).doctorBefore and after
How to check
Run each step in a temporary HOME, so that your real configs stay as they are.
git clone -b feat/connect-doctor https://github.com/taskade/cli && cd cli && npm testexport HOME=$(mktemp -d) && cd "$HOME"node <clone>/bin/cli.mjs plugnode <clone>/bin/cli.mjs plug claude-code --printclaude mcp addcommand. Nothing runs.node <clone>/bin/cli.mjs plug cursorin a terminal, answery~/.cursor/mcp.jsonholds thetaskadeentry.echo '{ bad' > ~/.cursor/mcp.json && node <clone>/bin/cli.mjs plug cursor --yesnode <clone>/bin/cli.mjs plug claude-desktopnode <clone>/bin/cli.mjs doctoroklines for the server, the token check skipped, exit 0 if every client file is valid.TASKADE_TOKEN=tskdp_fake node <clone>/bin/cli.mjs doctorfail The server refused the token (401: Invalid or expired token), exit 1.node <clone>/bin/cli.mjs plug cursor --token=abcFor the owner
main:npm publish --access public.@taskade/cliand add a trusted publisher: GitHub Actions, organizationtaskade, repositorycli, workflowrelease.yml. From then on, a published GitHub release with the tagv<version>publishes the package with provenance and no token secret.npx @taskade/cli plug claude-desktopand says "writes this for you automatically". After step 1 that command runs, and it gives the 3 Connectors steps and copies the URL. Claude Desktop has no supported file entry for a remote server with sign-in, so the CLI cannot write it. The settings text can say "copies the URL and gives the steps" to match.npx github:taskade/clitonpx @taskade/cliin the README and in theRUNconstant insrc/clients.mjs.