fix: Beta mode status validation and EditorPrefs Manager improvements#671
Conversation
Claude Code registration was still using gitUrl directly instead of GetBetaServerFromArgs(), meaning the beta server toggle had no effect on registration. Now uses GetBetaServerFromArgs(quoteFromPath: true) to properly generate --prerelease args for beta users. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Show "Unset. Default: [value]" for EditorPrefs that haven't been explicitly set - Disable value field and save button for unset items (grayed out at 60% opacity) - Fix search filter bug where reloading window showed filtered results with empty search field Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
The version validation was comparing the registered package source (mcpforunityserver>=0.0.0a0 for beta) against the exact package version (mcpforunityserver==9.4.0-beta.1), causing false "Incorrect Path" status. Now both CheckStatus paths (main thread and background thread) use the same logic that considers: - Explicit GitUrlOverride - UseBetaServer setting (with dynamic default for prerelease packages) - Standard pinned version as fallback Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Reviewer's GuideAligns MCP server registration, status validation, and manual snippets with beta mode / override-aware package source resolution, and improves the EditorPrefs Manager UX for unset prefs and search filtering. Sequence diagram for beta-aware Claude CLI registrationsequenceDiagram
actor UnityUser
participant McpClientConfigSection
participant McpClientConfiguratorBase
participant AssetPathUtility
participant EditorPrefs
participant ClaudeCli
UnityUser->>McpClientConfigSection: Click ConfigureClaudeCli
McpClientConfigSection->>AssetPathUtility: GetUvxCommandParts()
AssetPathUtility-->>McpClientConfigSection: uvxPath, _, packageName
McpClientConfigSection->>AssetPathUtility: GetBetaServerFromArgs(quoteFromPath true)
AssetPathUtility-->>McpClientConfigSection: fromArgs
McpClientConfigSection->>EditorPrefs: GetString(ApiKey, "")
EditorPrefs-->>McpClientConfigSection: apiKey
McpClientConfigSection->>McpClientConfiguratorBase: ConfigureWithCapturedValues(projectDir, claudePath, pathPrepend, useHttpTransport, httpUrl, uvxPath, fromArgs, packageName, shouldForceRefresh, apiKey, serverTransport)
McpClientConfiguratorBase->>McpClientConfiguratorBase: RegisterWithCapturedValues(..., uvxPath, fromArgs, packageName, shouldForceRefresh, ...)
McpClientConfiguratorBase->>McpClientConfiguratorBase: Build args
Note over McpClientConfiguratorBase: args = "mcp add --scope local --transport stdio UnityMCP -- \"uvxPath\" devFlags fromArgs packageName"
McpClientConfiguratorBase->>ClaudeCli: RunProcess(claudePath, args)
ClaudeCli-->>McpClientConfiguratorBase: ExitCode, Output
McpClientConfiguratorBase-->>McpClientConfigSection: Result
McpClientConfigSection-->>UnityUser: Show success or error
Sequence diagram for beta-aware MCP status validationsequenceDiagram
participant McpClientConfigSection
participant McpClientConfiguratorBase
participant EditorPrefs
participant AssetPathUtility
participant ClaudeCli
McpClientConfigSection->>McpClientConfiguratorBase: CheckStatus(attemptAutoRewrite)
rect rgb(230,230,255)
McpClientConfiguratorBase->>McpClientConfiguratorBase: GetExpectedPackageSourceForValidation()
McpClientConfiguratorBase->>EditorPrefs: GetString(GitUrlOverride, "")
EditorPrefs-->>McpClientConfiguratorBase: gitUrlOverride
alt gitUrlOverride is not empty
McpClientConfiguratorBase-->>McpClientConfiguratorBase: Use gitUrlOverride
else
McpClientConfiguratorBase->>EditorPrefs: HasKey(UseBetaServer)
EditorPrefs-->>McpClientConfiguratorBase: hasPrefKey
alt hasPrefKey
McpClientConfiguratorBase->>EditorPrefs: GetBool(UseBetaServer, false)
EditorPrefs-->>McpClientConfiguratorBase: useBetaServer
else
McpClientConfiguratorBase->>AssetPathUtility: IsPreReleaseVersion()
AssetPathUtility-->>McpClientConfiguratorBase: useBetaServer
end
alt useBetaServer
McpClientConfiguratorBase-->>McpClientConfiguratorBase: expectedPackageSource = "mcpforunityserver>=0.0.0a0"
else
McpClientConfiguratorBase->>AssetPathUtility: GetMcpServerPackageSource()
AssetPathUtility-->>McpClientConfiguratorBase: expectedPackageSource
end
end
end
McpClientConfiguratorBase->>ClaudeCli: RunStatusCheck(expectedPackageSource)
ClaudeCli-->>McpClientConfiguratorBase: ParsedStatus
McpClientConfiguratorBase-->>McpClientConfigSection: McpStatus
McpClientConfigSection-->>McpClientConfigSection: ApplyStatusToUi()
Class diagram for updated configurator and EditorPrefs item structuresclassDiagram
class McpClientConfiguratorBase {
+CheckStatus(attemptAutoRewrite bool) McpStatus
+Configure()
+ConfigureWithCapturedValues(projectDir string, claudePath string, pathPrepend string, useHttpTransport bool, httpUrl string, uvxPath string, fromArgs string, packageName string, shouldForceRefresh bool, apiKey string, serverTransport ConfiguredTransport) void
-RegisterWithCapturedValues(projectDir string, claudePath string, pathPrepend string, useHttpTransport bool, httpUrl string, uvxPath string, fromArgs string, packageName string, shouldForceRefresh bool, apiKey string, serverTransport ConfiguredTransport) void
-Register() void
+GetManualSnippet() string
-GetExpectedPackageSourceForValidation() string
}
class McpClientConfigSection {
-ConfigureClaudeCliAsync(client IMcpClientConfigurator) void
-RefreshClaudeCliStatus(client IMcpClientConfigurator, forceImmediate bool) void
-ApplyStatusToUi(client IMcpClientConfigurator, showChecking bool) void
-GetExpectedPackageSourceForBetaMode() string
}
class EditorPrefsWindow {
-searchFilter string
+CreateGUI() void
-CreateEditorPrefItem(key string) EditorPrefItem
-CreateItemUI(item EditorPrefItem) VisualElement
}
class EditorPrefItem {
+Key string
+Value string
+Type EditorPrefType
+IsKnown bool
+IsUnset bool
}
class AssetPathUtility {
+GetUvxCommandParts() UvxParts
+GetBetaServerFromArgs(quoteFromPath bool) string
+ShouldForceUvxRefresh() bool
+IsPreReleaseVersion() bool
+GetMcpServerPackageSource() string
}
class EditorPrefs {
+GetString(key string, defaultValue string) string
+GetBool(key string, defaultValue bool) bool
+GetInt(key string, defaultValue int) int
+GetFloat(key string, defaultValue float) float
+HasKey(key string) bool
}
McpClientConfigSection --> McpClientConfiguratorBase : uses
McpClientConfiguratorBase --> AssetPathUtility : uses
McpClientConfigSection --> AssetPathUtility : uses
McpClientConfiguratorBase --> EditorPrefs : reads
McpClientConfigSection --> EditorPrefs : reads
EditorPrefsWindow --> EditorPrefItem : creates
EditorPrefsWindow --> EditorPrefs : reads
EditorPrefItem --> EditorPrefType : uses enum
Flow diagram for beta-aware package source resolution logicflowchart TD
A[Start package source resolution] --> B{GitUrlOverride set in EditorPrefs}
B -->|Yes| C[Return GitUrlOverride]
B -->|No| D{EditorPrefs has key UseBetaServer}
D -->|Yes| E[Read UseBetaServer from EditorPrefs]
D -->|No| F[Compute useBetaServer via AssetPathUtility.IsPreReleaseVersion]
E --> G{useBetaServer}
F --> G
G -->|true| H[Return mcpforunityserver>=0.0.0a0]
G -->|false| I[Return AssetPathUtility.GetMcpServerPackageSource]
C --> J[Expected package source for validation or status]
H --> J
I --> J
J --> K[Use expected package source in
status check, background refresh,
and manual CLI snippet]
K --> L[End]
File-Level Changes
Assessment against linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
📝 WalkthroughWalkthroughThe changes refactor beta-server package source handling in client configuration code by replacing gitUrl usage with beta-aware fromArgs parameters, introducing helper methods that compute expected package sources honoring beta mode and explicit overrides, and adding an IsUnset flag to EditorPrefs items to improve display logic. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~22 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Hey - I've found 1 issue, and left some high level feedback:
- The two helpers
GetExpectedPackageSourceForValidation(inMcpClientConfiguratorBase) andGetExpectedPackageSourceForBetaMode(inMcpClientConfigSection) implement essentially the same beta/override resolution logic; consider extracting a shared utility method (and constant for"mcpforunityserver>=0.0.0a0") to avoid duplication and reduce the chance of these diverging. - In
EditorPrefsWindow, the strings like"Unset. Default: False"are embedded directly into theValuefield, which is also used as the editable value; it may be cleaner to keep the backing value separate and use a label or placeholder for the unset/default description so future changes to editing behavior don’t have to special-case these sentinel strings.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- The two helpers `GetExpectedPackageSourceForValidation` (in `McpClientConfiguratorBase`) and `GetExpectedPackageSourceForBetaMode` (in `McpClientConfigSection`) implement essentially the same beta/override resolution logic; consider extracting a shared utility method (and constant for `"mcpforunityserver>=0.0.0a0"`) to avoid duplication and reduce the chance of these diverging.
- In `EditorPrefsWindow`, the strings like `"Unset. Default: False"` are embedded directly into the `Value` field, which is also used as the editable value; it may be cleaner to keep the backing value separate and use a label or placeholder for the unset/default description so future changes to editing behavior don’t have to special-case these sentinel strings.
## Individual Comments
### Comment 1
<location> `MCPForUnity/Editor/Clients/McpClientConfiguratorBase.cs:919-928` </location>
<code_context>
+ private static string GetExpectedPackageSourceForValidation()
</code_context>
<issue_to_address>
**suggestion:** The beta/override resolution logic and magic string are duplicated and could drift over time.
This helper duplicates the logic and `"mcpforunityserver>=0.0.0a0"` literal from `McpClientConfigSection.GetExpectedPackageSourceForBetaMode` (including `EditorPrefs` checks). Please extract a shared utility (e.g., in `AssetPathUtility` or another helper) that computes the effective package source so both registration and validation use the same implementation and the magic string lives in one place.
</issue_to_address>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
| private static string GetExpectedPackageSourceForValidation() | ||
| { | ||
| // Check for explicit override first | ||
| string gitUrlOverride = EditorPrefs.GetString(EditorPrefKeys.GitUrlOverride, ""); | ||
| if (!string.IsNullOrEmpty(gitUrlOverride)) | ||
| { | ||
| return gitUrlOverride; | ||
| } | ||
|
|
||
| // Check beta mode using the same logic as GetUseBetaServerWithDynamicDefault |
There was a problem hiding this comment.
suggestion: The beta/override resolution logic and magic string are duplicated and could drift over time.
This helper duplicates the logic and "mcpforunityserver>=0.0.0a0" literal from McpClientConfigSection.GetExpectedPackageSourceForBetaMode (including EditorPrefs checks). Please extract a shared utility (e.g., in AssetPathUtility or another helper) that computes the effective package source so both registration and validation use the same implementation and the magic string lives in one place.
- Remove ExclusiveAddressUse=false to prevent duplicate listeners binding to the same port after Domain Reload - Increase port binding retry from 3x75ms to 10x200ms to allow old socket cleanup during Domain Reload Based on beta branch (post-PR CoplayDev#682) which includes: - CheckStatus speed-up (read ~/.claude.json directly) - Thread-safety fixes (PR CoplayDev#667) - Beta mode validation (PR CoplayDev#671) Fixes CoplayDev#664 Related: CoplayDev#643 Co-Authored-By: Claude <noreply@anthropic.com>
- Remove ExclusiveAddressUse=false to prevent duplicate listeners binding to the same port after Domain Reload - Increase port binding retry from 3x75ms to 10x200ms to allow old socket cleanup during Domain Reload Based on beta branch (post-PR CoplayDev#682) which includes: - CheckStatus speed-up (read ~/.claude.json directly) - Thread-safety fixes (PR CoplayDev#667) - Beta mode validation (PR CoplayDev#671) Fixes CoplayDev#664 Related: CoplayDev#643 Co-Authored-By: Claude <noreply@anthropic.com>
- Remove ExclusiveAddressUse=false to prevent duplicate listeners binding to the same port after Domain Reload - Increase port binding retry from 3x75ms to 10x200ms to allow old socket cleanup during Domain Reload Based on beta branch (post-PR CoplayDev#682) which includes: - CheckStatus speed-up (read ~/.claude.json directly) - Thread-safety fixes (PR CoplayDev#667) - Beta mode validation (PR CoplayDev#671) Fixes CoplayDev#664 Related: CoplayDev#643 Co-Authored-By: Claude <noreply@anthropic.com>
- Remove ExclusiveAddressUse=false to prevent duplicate listeners binding to the same port after Domain Reload - Increase port binding retry from 3x75ms to 10x200ms to allow old socket cleanup during Domain Reload Based on beta branch (post-PR CoplayDev#682) which includes: - CheckStatus speed-up (read ~/.claude.json directly) - Thread-safety fixes (PR CoplayDev#667) - Beta mode validation (PR CoplayDev#671) Fixes CoplayDev#664 Related: CoplayDev#643 Co-Authored-By: Claude <noreply@anthropic.com>
Description
Follow-up fixes after #667 merge addressing beta mode status validation and EditorPrefs Manager UX.
Changes
Beta mode status validation fix
mcpforunityserver>=0.0.0a0for beta)CheckStatus) and background-thread (McpClientConfigSection) code pathsClaude Code registration fix
GetBetaServerFromArgs()for Claude Code CLI registration to respect beta mode settingEditorPrefs Manager improvements
Testing
Related Issues
Follow-up to #667 (fixes #664)
Summary by Sourcery
Align Claude CLI MCP server validation and registration with beta mode settings and improve EditorPrefs Manager UX for unset preferences.
Bug Fixes:
Enhancements:
Summary by CodeRabbit
New Features
Improvements