Skip to content

Improve mcpc connect (no-args) config discovery output#255

Merged
jancurn merged 17 commits into
mainfrom
claude/stoic-pascal-S0RiS
Jun 2, 2026
Merged

Improve mcpc connect (no-args) config discovery output#255
jancurn merged 17 commits into
mainfrom
claude/stoic-pascal-S0RiS

Conversation

@jancurn

@jancurn jancurn commented May 31, 2026

Copy link
Copy Markdown
Member

Improves the output and behaviour of mcpc connect run with no arguments (standard-config discovery): it surfaces config files it can't use instead of dropping or misreporting them, reports each server's status inline within its config file, and prints copy-pasteable paths.

  • Config files that can't provide servers are now shown, not dropped: empty ones as 0 servers, and broken ones (invalid JSON, a project config missing mcpServers/servers, or unreadable) as (invalid) with the reason — instead of the misleading No MCP config files found.
  • Each server's status shows inline within its config file: ● live / ● connecting / ● failed / ○ skipped.
  • An already-live stdio server shows ● live on a plain connect; the --stdio note appears only when a stdio server is genuinely unconnected.
  • Paths containing spaces (e.g. macOS Library/Application Support/…) are quoted so they can be pasted into a shell; error details never echo raw file content.
  • Dev: hardens the CLAUDE.md rule to keep PR descriptions short.

https://claude.ai/code/session_014KxRpMiJm8daSQBVrxK1bS

claude added 10 commits May 30, 2026 23:24
`mcpc connect` (no args) discovered standard config files but silently
dropped any whose `mcpServers` object was empty, then reported "No MCP
config files found in standard locations" — listing the empty file among
the searched paths, so it looked like the file wasn't found at all.

Distinguish "a config exists but defines no servers" from "no config
exists at all": scanMcpConfigFiles() now returns empty-but-present files
separately, and the error points at the file and explains how to add a
server (or connect one directly). Files without a servers key and invalid
JSON stay silently skipped; JSON mode still returns [] with exit 0.

https://claude.ai/code/session_014KxRpMiJm8daSQBVrxK1bS
Drop the unnecessary readMcpConfigStatus/ConfigReadResult refactor and
reuse the existing tryReadMcpConfig: scanMcpConfigFiles() now just
partitions its results into `discovered` vs `empty`, and
discoverMcpConfigFiles() is a thin wrapper over it.

Trim the unit tests to the three behaviours that matter, and add an e2e
case asserting the empty-config (no servers) message instead of the
misleading "No MCP config files found".

Refs #255

https://claude.ai/code/session_014KxRpMiJm8daSQBVrxK1bS
Strengthen the PR-description guidance in CLAUDE.md into an explicit hard
rule with a rough length cap, and state that it applies to already-opened
PRs too (e.g. auto-generated bodies must be shortened/refreshed).

https://claude.ai/code/session_014KxRpMiJm8daSQBVrxK1bS
`mcpc connect` (no args) used to silently drop config files with an empty
`mcpServers` from the "Found N config files" summary when other configs
supplied servers — so a local `./mcp.json` skeleton vanished from the list.
They're now listed as `(0 servers)` and counted.

Also add a `formatPath()` display helper and use it for every config path
printed by discovery, so paths containing spaces (e.g. macOS
`Library/Application Support/...`) are quoted and can be copy-pasted into a
shell instead of being split.

Refs #255

https://claude.ai/code/session_014KxRpMiJm8daSQBVrxK1bS
In the bulk-discovery summary, the per-server result badge ("● @name …")
printed after the "↳ run: mcpc connect --stdio" hint, so it read out of
context. Print the badge directly under the "Connecting N servers" line
and move the hint below it. Also capitalize "Skipped" — it starts a
sentence in "Connecting N servers. Skipped M stdio servers."

Refs #255

https://claude.ai/code/session_014KxRpMiJm8daSQBVrxK1bS
`mcpc connect` (no args) showed connection results in a separate block at
the bottom, disconnected from the config entries they belonged to. Now the
servers are connected first (quietly), then each discovered config file is
rendered with its servers' status inline — "● connecting" / "● already
active" / "● failed" alongside the existing "○ skipped" markers — and the
--stdio hint trails the listing. Newly spawned sessions are shown
optimistically as "connecting" (no blocking on full readiness).

Refs #255

https://claude.ai/code/session_014KxRpMiJm8daSQBVrxK1bS
- Already-connected sessions now show a green "● live already" badge in the
  discovery listing, matching the session list's green "● live" state,
  instead of a dim "● already active".
- Replace the dim "↳ run: mcpc connect --stdio" hint with a plain note:
  "To include stdio servers, run: mcpc connect --stdio".

Refs #255

https://claude.ai/code/session_014KxRpMiJm8daSQBVrxK1bS
On a plain `mcpc connect` (no --stdio), a stdio server that is already live
from an earlier `connect --stdio` was misreported as "○ skipped (stdio)".
Now it shows its real "● live" status, the "To include stdio servers" note
is printed only when a stdio server is genuinely unconnected, and the
already-active badge reads just "● live" (matching the session list).

Refs #255

https://claude.ai/code/session_014KxRpMiJm8daSQBVrxK1bS
Match the spacing other commands (e.g. the session list) leave before the
next prompt. Human output only — JSON output is unchanged.

Refs #255

https://claude.ai/code/session_014KxRpMiJm8daSQBVrxK1bS
The no-args `connect` discovery listing now reports an already-live session
as "● live"; align the APIFY_API_TOKEN auto-connect badge to the same
wording so a single `mcpc connect` is internally consistent.

Refs #255

https://claude.ai/code/session_014KxRpMiJm8daSQBVrxK1bS
@jancurn jancurn changed the title Distinguish empty config files from missing ones in error messages Improve mcpc connect (no-args) config discovery output May 31, 2026
claude added 7 commits May 31, 2026 21:34
A malformed config file was logged once to stderr and dropped from the
listing. `scanMcpConfigFiles()` now returns such files under `invalid`
(with the parser's error), and the discovery listing shows them inline as
`(invalid format)` with the error beneath — counted alongside the other
config files, instead of a stray warning above the output.

Refs #255

https://claude.ai/code/session_014KxRpMiJm8daSQBVrxK1bS
V8's JSON.parse error embeds a snippet of the file content
(`Unexpected token X, "<snippet>"... is not valid JSON`) that spans
newlines — breaking the listing layout — and echoes untrusted input. Strip
the snippet so the discovery listing shows a safe one-liner like
`Unexpected token '{'. Not a valid JSON file.`

Refs #255

https://claude.ai/code/session_014KxRpMiJm8daSQBVrxK1bS
Generalize the previous "(invalid format)" handling: `mcpc connect`
(no args) now lists any config file it can't use as "(error)" with the
reason inline — invalid JSON, an unreadable file (e.g. permissions), or a
project config missing an "mcpServers"/"servers" property. Global files
without a servers object (e.g. ~/.claude.json app state) stay silent.

Refs #255

https://claude.ai/code/session_014KxRpMiJm8daSQBVrxK1bS
"(invalid)" makes clear the config file is the problem (external), not an
internal mcpc error. Display-label change only; the parse error / reason is
still shown beneath.

Refs #255

https://claude.ai/code/session_014KxRpMiJm8daSQBVrxK1bS
Dedupe the skipped-entry JSON construction into the one branch that uses it
(JSON mode), and fold the discovery header into the single human-output
section instead of a separate pre-connect block. No behaviour change.
Add a direct unit test for formatConnectStatusBadge.

Refs #255

https://claude.ai/code/session_014KxRpMiJm8daSQBVrxK1bS
The README only covered `mcpc connect <server> @session`. Document the
no-argument auto-discovery and bare-config-file (connect-all) forms, the
--stdio flag, and that unusable configs are listed (`0 servers` / `(invalid)`)
— in "Server formats", with a cross-reference from the config-file section.

Refs #255

https://claude.ai/code/session_014KxRpMiJm8daSQBVrxK1bS
… note

- Usage now shows `connect [<server>] [@session]` — the server is optional
  (omit it to auto-discover configs), not required as `<server>` implied.
- Fix the misaligned "(no server)" row in the Server formats table by
  padding to the column width (the chalk-wrapped string broke hand-counting).
- Note that without --json the command returns without waiting for every
  connection to finish; --json waits and reports each server's details.
- Regenerate the README auto-help block to match.

Refs #255

https://claude.ai/code/session_014KxRpMiJm8daSQBVrxK1bS
@jancurn jancurn merged commit 86da7e3 into main Jun 2, 2026
6 checks passed
@jancurn jancurn deleted the claude/stoic-pascal-S0RiS branch June 2, 2026 14:48
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.

3 participants