feat(clients): fall back to ~/.claude.json when the claude CLI is absent (#463)#504
Merged
Merged
Conversation
…463) Claude Code installed only as a VS Code/Cursor extension exposes no 'claude' binary on PATH, so the CLI strategy reported it red and Configure failed — even though 'claude mcp add --scope user' just writes an mcpServers entry into ~/.claude.json, which the user can (and did) add by hand. Make claude_code a CLI-preferred client with a JSON fallback: it declares its config location (~/.claude.json, mcpServers, type:http) and, when the binary isn't resolvable, Configure/Remove/status route through the shared JSON read-merge-write strategy instead. The CLI remains the primary path whenever it resolves, so nothing changes for users who have it. The fallback only triggers on a missing binary and preserves all other content in ~/.claude.json. - _base.gd: has_json_fallback() capability; is_installed() honours it. - claude_code.gd: declare path_template / server_key_path / entry_extra_fields. - client_configurator.gd: route cli dispatch to JSON when the binary is absent. - test_clients.gd: cover the fallback dispatch, descriptor, and semantics. Closes #463. https://claude.ai/code/session_01Jq5X4ivngAf1N6r5UX2BVw
Code-review follow-up: a user without the claude binary (VS Code/Cursor extension) who opens 'Run this manually' was shown only the unusable 'claude mcp add' line. For has_json_fallback clients, also surface the config-file edit that auto-configure falls back to writing. https://claude.ai/code/session_01Jq5X4ivngAf1N6r5UX2BVw
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
This was referenced Jun 1, 2026
Open
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.
Summary
Closes #463.
When Claude Code is installed only as a VS Code / Cursor extension, there's no
claudebinary on PATH. Theclaude_codedescriptor is acli-type client, so the CLI strategy couldn't find the binary → the dock showed it red and Configure failed with "Claude Code not found". As the reporter found, the workaround is to hand-edit~/.claude.json:…which is exactly what
claude mcp add --scope user --transport httpwrites anyway.Fix
Make
claude_codea CLI-preferred client with a JSON fallback:~/.claude.json,mcpServers,type: "http").claudebinary resolves, everything behaves exactly as before (CLI path — no change for users who have it)._json_strategy.gd) instead, producing the same entry the CLI would. The dot turns green and Configure works with no manual editing.The JSON strategy parses the full file, mutates only the
godot-aientry, and writes it back atomically — all other content in~/.claude.json(projects, history, other MCP servers) is preserved, and it refuses to overwrite a file it can't safely round-trip.Changes
_base.gd—has_json_fallback()capability flag;is_installed()honours it (a fallback client counts as installed when its config file exists, fixing the "(not detected)" label).claude_code.gd— declarepath_template/server_key_path/entry_extra_fieldsfor the fallback.client_configurator.gd— routeclidispatch (configure/remove/status + the dock's status-probe shortcut) to the JSON strategy when the binary isn't resolvable.test_clients.gd— coverhas_json_fallback()semantics, theclaude_codedescriptor, and a full fallback dispatch round-trip (configure → CONFIGURED → preserves unrelated servers → remove → NOT_CONFIGURED).Generality
has_json_fallback()is generic — any future CLI client whose CLI just writes a known JSON file can opt in by declaringpath_template+server_key_path. Onlyclaude_codedoes today.Testing
script/ci-check-gdscript→ All GDScript files OK.clientssuite headless against a live editor: 92 passed / 0 failed, including the three new tests.https://claude.ai/code/session_01Jq5X4ivngAf1N6r5UX2BVw
Generated by Claude Code