Add Cline configurator and auto-select server channel#739
Add Cline configurator and auto-select server channel#739dsarno merged 2 commits intoCoplayDev:betafrom
Conversation
…itespace noise - Remove deprecated `useBetaServer` parameter from GetBetaServerFromArgs/List thread-safe overloads - Strip whitespace-only reformatting from MCPForUnityEditorWindow.cs, keeping only real changes - Remove stale EditorPrefKeys.UseBetaServer references from CodexConfigHelperTests Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Reviewer's GuideAuto-selects the MCP server prerelease channel based on the package version instead of a user-facing beta toggle, adds a dedicated Cline MCP configurator with streamableHttp support, and cleans up all UseBetaServer-related configuration, UI, and tests while wiring Cline into the existing JSON config generation pipeline. Sequence diagram for auto-selecting MCP server prerelease channel from package versionsequenceDiagram
participant UnityEditor
participant AssetPathUtility
participant EditorPrefs
participant UvxInvoker as UvxInvokerOrConfigurator
UnityEditor->>AssetPathUtility: GetMcpServerPackageSource()
activate AssetPathUtility
AssetPathUtility->>AssetPathUtility: GetPackageVersion()
AssetPathUtility-->>UnityEditor: version string
alt version is semver prerelease
AssetPathUtility->>AssetPathUtility: IsSemVerPreRelease(version)
AssetPathUtility-->>UnityEditor: true
AssetPathUtility-->>UnityEditor: "mcpforunityserver>=0.0.0a0"
else version is stable
AssetPathUtility->>AssetPathUtility: IsSemVerPreRelease(version)
AssetPathUtility-->>UnityEditor: false
AssetPathUtility-->>UnityEditor: "mcpforunityserver==<version>"
end
deactivate AssetPathUtility
UnityEditor->>AssetPathUtility: GetBetaServerFromArgs(quoteFromPath)
activate AssetPathUtility
AssetPathUtility->>EditorPrefs: GetString(GitUrlOverride)
EditorPrefs-->>AssetPathUtility: gitUrlOverride
AssetPathUtility->>AssetPathUtility: GetMcpServerPackageSource()
AssetPathUtility-->>AssetPathUtility: packageSource
AssetPathUtility->>AssetPathUtility: GetBetaServerFromArgs(gitUrlOverride, packageSource, quoteFromPath)
alt gitUrlOverride is nonempty
AssetPathUtility-->>UnityEditor: "--from <gitUrlOverride>"
else packageSource == "mcpforunityserver>=0.0.0a0"
AssetPathUtility-->>UnityEditor: "--prerelease explicit --from mcpforunityserver>=0.0.0a0"
else stable package pin
AssetPathUtility-->>UnityEditor: "--from mcpforunityserver==<version>"
end
deactivate AssetPathUtility
UnityEditor->>UvxInvoker: Invoke uvx with fromArgs
Sequence diagram for generating Cline MCP config with streamableHttp transportsequenceDiagram
participant UnityEditor
participant ConfigJsonBuilder
participant EditorConfigurationCache
participant McpClient as ClineMcpClient
participant JObject as UnityJsonNode
UnityEditor->>ClineMcpClient: construct via ClineConfigurator
activate ClineMcpClient
ClineMcpClient-->>UnityEditor: McpClient(name=Cline, paths, DefaultUnityFields)
deactivate ClineMcpClient
UnityEditor->>ConfigJsonBuilder: PopulateUnityNode(unity, uvPath, client=Cline)
activate ConfigJsonBuilder
ConfigJsonBuilder->>EditorConfigurationCache: UseHttpTransport
EditorConfigurationCache-->>ConfigJsonBuilder: prefValue
ConfigJsonBuilder->>ConfigJsonBuilder: clientSupportsHttp = client.SupportsHttpTransport != false
ConfigJsonBuilder->>ConfigJsonBuilder: isCline = client.name == Cline
ConfigJsonBuilder->>ConfigJsonBuilder: useHttpTransport = clientSupportsHttp && prefValue
alt useHttpTransport == true
ConfigJsonBuilder->>UnityJsonNode: set httpProperty URL
alt client is VSCode
ConfigJsonBuilder->>UnityJsonNode: set type = http
else client is Cline
ConfigJsonBuilder->>UnityJsonNode: set type = streamableHttp
else other client
ConfigJsonBuilder->>UnityJsonNode: set type = http
end
else useHttpTransport == false
ConfigJsonBuilder->>UnityJsonNode: set stdio properties
alt client is VSCode
ConfigJsonBuilder->>UnityJsonNode: set type = stdio
else client is Cline
ConfigJsonBuilder->>UnityJsonNode: set type = stdio
end
end
ConfigJsonBuilder->>ConfigJsonBuilder: if !isVSCode && client.name != Claude Code && !isCline
ConfigJsonBuilder->>UnityJsonNode: remove type
ConfigJsonBuilder-->>UnityEditor: updated unity node
Class diagram for new ClineConfigurator and related MCP client typesclassDiagram
class McpClient {
string name
string windowsConfigPath
string macConfigPath
string linuxConfigPath
Dictionary~string, object~ DefaultUnityFields
}
class JsonFileMcpConfigurator {
+JsonFileMcpConfigurator(mcpClient McpClient)
+IList~string~ GetInstallationSteps()
}
class ClineConfigurator {
+ClineConfigurator()
+IList~string~ GetInstallationSteps()
}
class ConfigJsonBuilder {
+PopulateUnityNode(unity JObject, uvPath string, client McpClient)
}
JsonFileMcpConfigurator <|-- ClineConfigurator
JsonFileMcpConfigurator o-- McpClient
ConfigJsonBuilder ..> McpClient : uses
%% ClineConfigurator configuration details
class ClineConfiguratorDetails {
<<value_object>>
name = Cline
windowsConfigPath = %APPDATA%/Code/User/globalStorage/saoudrizwan.claude-dev/settings/cline_mcp_settings.json
macConfigPath = ~/Library/Application Support/Code/User/globalStorage/saoudrizwan.claude-dev/settings/cline_mcp_settings.json
linuxConfigPath = ~/.config/Code/User/globalStorage/saoudrizwan.claude-dev/settings/cline_mcp_settings.json
DefaultUnityFields: disabled=false, autoApprove=[]
}
ClineConfiguratorDetails .. ClineConfigurator : constructs with
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
📝 WalkthroughWalkthroughThe PR introduces a new Cline MCP client configurator and removes the beta-server mode system. It eliminates the UseBetaServer editor preference throughout the codebase, replaces beta-mode-based validation with SemVer prerelease detection, updates configuration generation with Cline-specific transport types, and simplifies version validation logic. Changes
Estimated code review effort🎯 4 (Complex) | ⏱️ ~65 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
⚔️ Resolve merge conflicts (beta)
No actionable comments were generated in the recent review. 🎉 🧹 Recent nitpick comments
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 2 issues, and left some high level feedback:
- The prerelease detection in
GetBetaServerFromArgs/GetBetaServerFromArgsListrelies on a hard-coded comparison to"mcpforunityserver>=0.0.0a0"; consider derivingusePrereleaseRangefromIsPreReleaseVersion()or a more structured check (e.g., parsing the spec) so this logic doesn’t silently break ifGetMcpServerPackageSourceis adjusted in the future. - Cline-specific behavior in
ConfigJsonBuilderis keyed offclient?.name == "Cline"; it would be more robust to add an explicit capability flag onMcpClient(e.g.,RequiresExplicitTypeorUseStreamableHttp) and branch on that instead of the display name string.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- The prerelease detection in `GetBetaServerFromArgs`/`GetBetaServerFromArgsList` relies on a hard-coded comparison to `"mcpforunityserver>=0.0.0a0"`; consider deriving `usePrereleaseRange` from `IsPreReleaseVersion()` or a more structured check (e.g., parsing the spec) so this logic doesn’t silently break if `GetMcpServerPackageSource` is adjusted in the future.
- Cline-specific behavior in `ConfigJsonBuilder` is keyed off `client?.name == "Cline"`; it would be more robust to add an explicit capability flag on `McpClient` (e.g., `RequiresExplicitType` or `UseStreamableHttp`) and branch on that instead of the display name string.
## Individual Comments
### Comment 1
<location> `MCPForUnity/Editor/Clients/McpClientConfiguratorBase.cs:89-90` </location>
<code_context>
- }
-
- // Standard mode uses exact version from package.json
+ // Includes explicit override, stable pin, or prerelease range depending on package version.
return AssetPathUtility.GetMcpServerPackageSource();
}
</code_context>
<issue_to_address>
**issue (bug_risk):** Expected package source for validation no longer honors Git URL override, contrary to the comment.
This used to return `EditorPrefKeys.GitUrlOverride` directly, so validation matched configs using a local path or git URL. Now it always uses `GetMcpServerPackageSource()`, which appears version‑only and unaware of the git override, so projects intentionally using an override will be reported as mismatched. If validation should still honor overrides, either reintroduce the override check here or have `GetMcpServerPackageSource()` handle it. The new comment also claims explicit overrides are included, which doesn’t match the current behavior.
</issue_to_address>
### Comment 2
<location> `MCPForUnity/Editor/Windows/MCPForUnityEditorWindow.cs:335-340` </location>
<code_context>
- updateNotification.RemoveFromClassList("visible");
- }
- }
+ versionLabel.tooltip = AssetPathUtility.IsPreReleaseVersion()
+ ? $"MCP For Unity v{version} (pre-release package, using prerelease server channel)"
+ : $"MCP For Unity v{version}";
+ }
+
</code_context>
<issue_to_address>
**suggestion:** Version tooltip may imply prerelease server usage even when a Git URL override is configured.
Because the tooltip keying only off `IsPreReleaseVersion()` ignores `GitUrlOverride`, it can claim "using prerelease server channel" even when a custom URL is configured. If you want the tooltip to describe the actual server behavior, please also consider whether an override is set (or whether the resolved package source is the prerelease range) before mentioning the prerelease channel.
Suggested implementation:
```csharp
var isPreRelease = AssetPathUtility.IsPreReleaseVersion();
var hasGitUrlOverride = AssetPathUtility.HasGitUrlOverride();
if (isPreRelease && !hasGitUrlOverride)
{
versionLabel.tooltip = $"MCP For Unity v{version} (pre-release package, using prerelease server channel)";
}
else if (isPreRelease)
{
// Pre-release package, but server channel may be overridden, so don't imply prerelease server usage
versionLabel.tooltip = $"MCP For Unity v{version} (pre-release package)";
}
else
{
versionLabel.tooltip = $"MCP For Unity v{version}";
}
```
If `AssetPathUtility.HasGitUrlOverride()` does not already exist, you will need to implement it (or adjust the call to match the existing API that reports whether a Git URL override is configured). The method should return `true` when a custom package source (Git URL) is in effect so that the tooltip does not mention the prerelease server channel in that case.
</issue_to_address>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
| // Includes explicit override, stable pin, or prerelease range depending on package version. | ||
| return AssetPathUtility.GetMcpServerPackageSource(); |
There was a problem hiding this comment.
issue (bug_risk): Expected package source for validation no longer honors Git URL override, contrary to the comment.
This used to return EditorPrefKeys.GitUrlOverride directly, so validation matched configs using a local path or git URL. Now it always uses GetMcpServerPackageSource(), which appears version‑only and unaware of the git override, so projects intentionally using an override will be reported as mismatched. If validation should still honor overrides, either reintroduce the override check here or have GetMcpServerPackageSource() handle it. The new comment also claims explicit overrides are included, which doesn’t match the current behavior.
| versionLabel.tooltip = AssetPathUtility.IsPreReleaseVersion() | ||
| ? $"MCP For Unity v{version} (pre-release package, using prerelease server channel)" | ||
| : $"MCP For Unity v{version}"; | ||
| } | ||
| private void QueueUpdateCheck() |
There was a problem hiding this comment.
suggestion: Version tooltip may imply prerelease server usage even when a Git URL override is configured.
Because the tooltip keying only off IsPreReleaseVersion() ignores GitUrlOverride, it can claim "using prerelease server channel" even when a custom URL is configured. If you want the tooltip to describe the actual server behavior, please also consider whether an override is set (or whether the resolved package source is the prerelease range) before mentioning the prerelease channel.
Suggested implementation:
var isPreRelease = AssetPathUtility.IsPreReleaseVersion();
var hasGitUrlOverride = AssetPathUtility.HasGitUrlOverride();
if (isPreRelease && !hasGitUrlOverride)
{
versionLabel.tooltip = $"MCP For Unity v{version} (pre-release package, using prerelease server channel)";
}
else if (isPreRelease)
{
// Pre-release package, but server channel may be overridden, so don't imply prerelease server usage
versionLabel.tooltip = $"MCP For Unity v{version} (pre-release package)";
}
else
{
versionLabel.tooltip = $"MCP For Unity v{version}";
}If AssetPathUtility.HasGitUrlOverride() does not already exist, you will need to implement it (or adjust the call to match the existing API that reports whether a Git URL override is configured). The method should return true when a custom package source (Git URL) is in effect so that the tooltip does not mention the prerelease server channel in that case.
Summary
streamableHttptransport supportUseBetaServerEditorPref, UI toggle, and related wiringuseBetaServerparameter fromGetBetaServerFromArgs/GetBetaServerFromArgsListthread-safe overloadsTest plan
🤖 Generated with Claude Code
Summary by Sourcery
Auto-select MCP server prerelease channel based on the Unity package version and add first-class configuration support for the Cline client.
New Features:
Enhancements:
Tests:
Chores:
Summary by CodeRabbit
Release Notes
New Features
Changes