Skip to content

MCP: cloudpin_doctor, a read-only cloudpin doctor --json (#112, part 1) - #138

Merged
paureis merged 4 commits into
mainfrom
feat/112-mcp-doctor
Nov 2, 2026
Merged

paureis merged 4 commits into
mainfrom
feat/112-mcp-doctor

Conversation

@paureis

@paureis paureis commented Oct 23, 2026

Copy link
Copy Markdown
Owner

Part of #112 (the cloudpin_doctor half). cloudpin_switch_plan follows once #14 (#102) merges. Draft until the v1.2.0 tag; the CHANGELOG, ROADMAP and README lines get added then. README's MCP section still says "two tools", but README is over the size cap on main, and the raised limit is in release PR #132.

cloudpin_doctor returns cloudpin doctor --json for a project folder (optional cwd, like the other tools), so an agent can say why the hook isn't guarding. Account IDs come back shortened, as in doctorJson.

Read-only. Doctor had one write: the cache-folder probe (writable in src/cli.ts, now probeWritable in src/paths.ts), which creates the cache folder and a probe file. The MCP tool gives doctor a stub that writes nothing, and the cache check then reads "not checked", pointing at cloudpin doctor in a terminal. Everything else doctor runs only reads.

Checks

  • test/mcp-doctor.test.ts (new, 10 tests): before the code existed, 9 failed.
  • The no-write test compares a recursive listing of the folder before and after the call. Its control: the terminal probe does change that listing.
  • Mutation checks: giving MCP mode the real probe fails the no-write test; dropping the guard fails the cache-off test.
  • npm run typecheck: exit 0. npm test: 1277 passed, 8 skipped.
  • Real stdio exchange with the built server (initialize, tools/list, tools/call cloudpin_doctor): three tools, all readOnlyHint; the result matches its structured content; the folder is unchanged afterwards.

🤖 Generated with Claude Code

paureis and others added 2 commits October 23, 2026 19:16
A third MCP tool returns what `cloudpin doctor --json` returns for the
project folder (optional cwd, like the other tools), so an agent can say
why a hook isn't guarding: missing or out-of-date hooks, and on Windows
the execution-policy and PATH warnings. Account IDs stay shortened, as
doctorJson does.

The terminal doctor checks the identity cache by creating the cache
folder and a probe file in it. That probe moves to src/paths.ts
(probeWritable) and the MCP tool never calls it: it hands doctor a stub
that writes nothing, and reports the cache check as "not checked" (#15:
no MCP tool changes anything). With CLOUDPIN_NO_CACHE=1 the check needs
no write and stays as it was.

Tests in test/mcp-doctor.test.ts run against a real temporary folder:
listed with its schema, same JSON as doctor, IDs shortened, a missing
and an out-of-date hook, a bad cwd, and a folder listing that must not
change, with a control showing the terminal probe does change it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
README's MCP paragraph still says two tools: README is over the size
limit on main, so it is updated on the release branch instead.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
paureis and others added 2 commits November 2, 2026 13:06
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@paureis
paureis marked this pull request as ready for review November 2, 2026 18:07
@paureis
paureis merged commit c492fcf into main Nov 2, 2026
5 checks passed
@paureis
paureis deleted the feat/112-mcp-doctor branch November 2, 2026 18:09
paureis added a commit that referenced this pull request Nov 2, 2026
cloudpin_doctor (#138) made ToolContext.doctor required; this test
builds the tools without it, which typecheck rejects.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
paureis added a commit that referenced this pull request Nov 2, 2026
* Test: explain and the MCP check tool hide credential values (#134)

Every credential form block messages already hide (--token, --password,
--kube-token, Vercel's -t VALUE, -t=VALUE, -tVALUE and -dt VALUE) is
checked in explain's text output, its --json and the MCP cloudpin_check
result. Controls: other words stay as typed, the --json argv keeps its
length and positions, and the verdict still comes from the real token.

Fails until explain masks the words it repeats.

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

* Explain: mask credential values in the command it repeats (#134)

cloudpin explain (text and --json) and the MCP cloudpin_check tool repeated
a command's words unmasked, so a --token value reached the terminal or the
agent transcript. The word-level masking behind block and confirmation
messages (#123) is now maskArgv in src/format.ts, and explain uses it when
it builds each call, after the guard has decided on the real words. The
--json argv array keeps its length and positions; only the values change
to ***.

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

* Test: explain-secrets gives the MCP tools a doctor host (#134, #112)

cloudpin_doctor (#138) made ToolContext.doctor required; this test
builds the tools without it, which typecheck rejects.

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

* CHANGELOG and ROADMAP: explain masks credentials (#134)

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

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
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