Files
dsarno 6f3b869f3d fix: speed up Claude Code config check by reading JSON directly (#682)
* fix: speed up Claude Code config check by reading JSON directly

Instead of running `claude mcp list` (15+ seconds due to health checks),
read the config directly from ~/.claude.json (instant).

Changes:
- Add ReadClaudeCodeConfig() to parse Claude's JSON config file
- Walk up directory tree to find config at parent directories
- Handle duplicate path entries (forward/backslash variants)
- Add beta/stable version mismatch detection with clear messages
- Add IsBetaPackageSource() to detect PyPI beta versions and prerelease ranges
- Change button label from "Register" to "Configure" for consistency

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

* fix: speed up Claude Code config check by reading JSON directly

Instead of running `claude mcp list` (15+ seconds due to health checks),
read the config directly from ~/.claude.json (instant).

Changes:
- Add ReadClaudeCodeConfig() to parse Claude's JSON config file
- Walk up directory tree to find config at parent directories
- Handle duplicate path entries (forward/backslash variants)
- Add beta/stable version mismatch detection with clear messages
- Add IsBetaPackageSource() to detect PyPI beta versions and prerelease ranges
- Change button label from "Register" to "Configure" for consistency
- Refresh client status when switching to Connect tab or toggling beta mode

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

* feat: add VersionMismatch status for Claude Code config detection

- Add McpStatus.VersionMismatch enum value for version mismatch cases
- Show "Version Mismatch" with yellow warning indicator instead of "Error"
- Use VersionMismatch for beta/stable package source mismatches
- Keep Error status for transport mismatches and general errors

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

* feat: add version mismatch warning banner in Server section

- Add version-mismatch-warning banner to McpConnectionSection.uxml
- Add UpdateVersionMismatchWarning method to show/hide the banner
- Fire OnClientConfigMismatch event when VersionMismatch status detected
- Wire up event in main window to update the warning banner
- Store mismatch details in configStatus for both Error and VersionMismatch

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

* fix: simplify version mismatch messages for non-technical users

Before: "Beta/stable mismatch: registered with beta 'mcpforunityserver>=0.0.0a0' but plugin is stable 'mcpforunityserver==9.4.0'."

After: "Configured for beta server, but 'Use Beta Server' is disabled in Advanced settings."

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

* fix: address PR review feedback

- Treat missing ~/.claude.json as "not configured" instead of error
  (distinguishes "no Claude Code installed" from actual read failures)
- Handle --from=VALUE format in ExtractPackageSourceFromConfig
  (in addition to existing --from VALUE format)

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

* feat: add beta/stable version mismatch detection to all JSON-based clients

- Move GetExpectedPackageSourceForValidation() and IsBetaPackageSource()
  to base class so all configurators can use them
- Update JsonFileMcpConfigurator.CheckStatus() to use beta-aware comparison
- Show VersionMismatch status with clear messaging for Claude Desktop,
  Cursor, Windsurf, VS Code, and other JSON-based clients
- Auto-rewrite still attempts to fix mismatches automatically

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

* fix: add beta-aware validation to CodexMcpConfigurator

CodexMcpConfigurator was still using the non-beta-aware package source
comparison. Now uses GetExpectedPackageSourceForValidation() and shows
VersionMismatch status with clear messaging like other configurators.

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

---------

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-03 14:48:44 -08:00

58 lines
3.7 KiB
Plaintext

<ui:UXML xmlns:ui="UnityEngine.UIElements" xmlns:uie="UnityEditor.UIElements" editor-extension-mode="True">
<Style src="../Common.uss" />
<ui:VisualElement name="connection-section" class="section">
<ui:Label text="Server" class="section-title" />
<ui:VisualElement class="section-content">
<ui:VisualElement class="setting-row">
<ui:Label text="Transport:" class="setting-label" />
<uie:EnumField name="transport-dropdown" class="setting-dropdown-inline" />
</ui:VisualElement>
<ui:VisualElement name="transport-mismatch-warning" class="warning-banner">
<ui:Label name="transport-mismatch-text" class="warning-banner-text" />
</ui:VisualElement>
<ui:VisualElement name="version-mismatch-warning" class="warning-banner">
<ui:Label name="version-mismatch-text" class="warning-banner-text" />
</ui:VisualElement>
<ui:VisualElement class="setting-row" name="http-url-row">
<ui:Label text="HTTP URL:" class="setting-label" />
<ui:TextField name="http-url" class="url-field" />
</ui:VisualElement>
<ui:VisualElement name="api-key-row" style="margin-bottom: 4px;">
<ui:VisualElement class="setting-row">
<ui:Label text="API Key:" class="setting-label" />
<ui:TextField name="api-key-field" password="true" class="url-field" />
</ui:VisualElement>
<ui:VisualElement style="flex-direction: row; justify-content: flex-end;">
<ui:Button name="get-api-key-button" text="Get API Key" class="action-button" />
<ui:Button name="clear-api-key-button" text="Clear" class="action-button" />
</ui:VisualElement>
</ui:VisualElement>
<ui:VisualElement class="setting-row" name="http-server-control-row">
<ui:Label text="Local Server:" class="setting-label" />
<ui:Button name="start-http-server-button" text="Start Server" class="action-button start-server-button" />
</ui:VisualElement>
<ui:VisualElement class="setting-row" name="unity-socket-port-row">
<ui:Label text="Unity Socket Port:" class="setting-label" />
<ui:TextField name="unity-port" class="port-field" />
</ui:VisualElement>
<ui:VisualElement class="setting-row">
<ui:VisualElement class="status-container">
<ui:VisualElement name="status-indicator" class="status-dot" />
<ui:Label name="connection-status" text="Disconnected" class="status-text" />
</ui:VisualElement>
<ui:Button name="connection-toggle" text="Start" class="action-button" />
</ui:VisualElement>
<ui:Foldout name="manual-command-foldout" text="Manual Server Launch" value="false" class="manual-config-foldout">
<ui:VisualElement name="http-server-command-section" class="manual-config-content">
<ui:Label text="Use this command to launch the server manually:" class="config-label" />
<ui:VisualElement class="config-json-row">
<ui:TextField name="http-server-command" readonly="true" multiline="true" class="config-json-field" />
<ui:Button name="copy-http-server-command-button" text="Copy" class="icon-button-vertical" />
</ui:VisualElement>
<ui:Label name="http-server-command-hint" class="help-text" />
</ui:VisualElement>
</ui:Foldout>
</ui:VisualElement>
</ui:VisualElement>
</ui:UXML>