Improve mcpc connect (no-args) config discovery output#255
Merged
Conversation
`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
mcpc connect (no-args) config discovery output
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
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.
Improves the output and behaviour of
mcpc connectrun 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.0 servers, and broken ones (invalid JSON, a project config missingmcpServers/servers, or unreadable) as(invalid)with the reason — instead of the misleadingNo MCP config files found.● live/● connecting/● failed/○ skipped.● liveon a plainconnect; the--stdionote appears only when a stdio server is genuinely unconnected.Library/Application Support/…) are quoted so they can be pasted into a shell; error details never echo raw file content.https://claude.ai/code/session_014KxRpMiJm8daSQBVrxK1bS