Skip to content

Conversation

@dsarno
Copy link
Collaborator

@dsarno dsarno commented Jan 27, 2026

Summary

  • Adds "Use Beta Server" toggle (default: ON on beta branch) to fetch pre-release server versions from PyPI
  • Adds β indicator to version badge when beta mode enabled
  • Adds server version to startup logs and /health endpoint
  • Renames internal pref key from UseTestPyPI to UseBetaServer for clarity

This supersedes PR #639.

Why PyPI pre-releases instead of TestPyPI

TestPyPI is polluted with broken/incompatible packages that cause server startup failures:

  • httpx versions missing TransportError class
  • mcp==0.8.0.dev0 (ancient dev version)
  • fastapi==1.0 (broken package)

Using --prerelease allow with TestPyPI or even regular PyPI pulls these broken dependency pre-releases.

Solution: Publish beta versions directly to PyPI as pre-releases (e.g., 9.3.0b20260127) and use --prerelease explicit with a version specifier (mcpforunityserver>=0.0.0a0). This only allows pre-releases for our package, not dependencies.

Test plan

  • Toggle "Use Beta Server" in Advanced settings
  • Verify badge shows "v9.x.x β" when enabled
  • Start server and verify it launches successfully
  • Check server logs show version on startup
  • Verify /health endpoint returns version field

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features

    • "Use Beta Server" toggle in Advanced settings (persisted, notifies changes, updates version label)
    • Search bar for filtering EditorPrefs with refresh control
    • Version label shows a beta indicator when beta server enabled
    • Server health endpoint now reports the running package version
  • Chores

    • Beta release workflow updated to publish pre-releases directly to PyPI (pre-release)

✏️ Tip: You can customize this high-level summary in your review settings.

msanatan and others added 5 commits January 27, 2026 02:06
- Add UseTestPyPI editor preference key
- Add TestPyPI toggle to Advanced settings UI with tooltip
- Configure uvx to use test.pypi.org when TestPyPI mode enabled
- Skip version pinning in TestPyPI mode to get latest pre-release
- Update ConfigJsonBuilder to handle TestPyPI index URL
TestPyPI has polluted packages (broken httpx, mcp, fastapi) that cause
server startup failures. Switch to publishing beta versions directly to
PyPI as pre-releases (e.g., 9.3.0b20260127).

Key changes:
- beta-release.yml: Publish to PyPI instead of TestPyPI, use beta suffix
- Use --prerelease explicit with version specifier (>=0.0.0a0) to only
  get prereleases of our package, not broken dependency prereleases
- Default "Use Beta Server" toggle to true on beta branch
- Rename UI label from "Use TestPyPI" to "Use Beta Server"
- Add UseTestPyPI to EditorPrefsWindow known prefs
- Add search field and refresh button to EditorPrefsWindow

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
- Show "β" suffix on version badge when beta server mode is enabled
- Badge updates dynamically when toggle changes
- Add server version to startup log: "MCP for Unity Server v9.2.0 starting up"
- Add version field to /health endpoint response

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
- Rename EditorPref key from UseTestPyPI to UseBetaServer for clarity
- Rename all related variables and UXML element names
- Increase bottom margin on EditorPrefs search bar to prevent clipping first entry

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
@sourcery-ai
Copy link
Contributor

sourcery-ai bot commented Jan 27, 2026

Reviewer's Guide

Implements a beta server mode that fetches PyPI pre-release server versions safely, wires it into the Unity editor advanced settings and version badge, updates uv/ConfigJson invocation logic, adds server version reporting in logs and /health, introduces a new UseBetaServer editor pref key, and improves the editor prefs window with a search bar.

Sequence diagram for beta server mode startup and health check

sequenceDiagram
    actor User
    participant UnityEditorWindow
    participant McpAdvancedSection
    participant EditorPrefs
    participant ServerManagementService
    participant ConfigJsonBuilder
    participant UvCli
    participant McpServer
    participant HealthEndpoint

    User->>McpAdvancedSection: Toggle useBetaServerToggle
    McpAdvancedSection->>EditorPrefs: SetBool(UseBetaServer, value)
    McpAdvancedSection->>UnityEditorWindow: OnBetaModeChanged(value)
    UnityEditorWindow->>UnityEditorWindow: UpdateVersionLabel(useBetaServer)

    User->>UnityEditorWindow: Start server
    UnityEditorWindow->>ServerManagementService: TryGetLocalHttpServerCommandParts

    alt useBetaServer is true
        ServerManagementService->>EditorPrefs: GetBool(UseBetaServer, defaultTrue)
        ServerManagementService->>ServerManagementService: Build fromArgs with --prerelease explicit
    else useBetaServer is false
        ServerManagementService->>EditorPrefs: GetBool(UseBetaServer, defaultTrue)
        ServerManagementService->>ServerManagementService: Build fromArgs from fromUrl or empty
    end

    ServerManagementService->>UvCli: Invoke uvx with arguments

    UvCli->>McpServer: Start MCP for Unity Server
    McpServer->>McpServer: get_package_version
    McpServer->>McpServer: Log startup with version

    User->>HealthEndpoint: HTTP GET /health
    HealthEndpoint->>McpServer: get_package_version
    HealthEndpoint-->>User: JSON { status, timestamp, version, message }
Loading

Updated class diagram for editor beta mode and prefs search

classDiagram
    class EditorPrefKeys {
        <<static>>
        string WebSocketUrlOverride
        string GitUrlOverride
        string DevModeForceServerRefresh
        string UseBetaServer
        string ProjectScopedToolsLocalHttp
        string PackageDeploySourcePath
    }

    class McpAdvancedSection {
        - VisualElement Root
        - Toggle debugLogsToggle
        - Toggle devModeForceRefreshToggle
        - Toggle useBetaServerToggle
        - TextField deploySourcePath
        + event Action OnGitUrlChanged
        + event Action OnHttpServerCommandUpdateRequested
        + event Action OnTestConnectionRequested
        + event Action~bool~ OnBetaModeChanged
        + void CacheUIElements()
        + void InitializeUI()
        + void InitializeValues()
        + void RegisterCallbacks()
        + void UpdatePathOverrides()
    }

    class MCPForUnityEditorWindow {
        - Label versionLabel
        + void CreateGUI()
        - void SetupTabs()
        - void RefreshAllData()
        - void EnsureToolsLoaded()
        - void UpdateVersionLabel(bool useBetaServer)
    }

    class EditorPrefsWindow {
        - ScrollView scrollView
        - VisualElement prefsContainer
        - TextField searchField
        - string searchFilter
        - List~EditorPrefItem~ currentPrefs
        + void CreateGUI()
        - void RefreshPrefs()
        - EditorPrefItem CreateEditorPrefItem(string key)
    }

    class ConfigJsonBuilder {
        + static IList~string~ BuildUvxArgs(string fromUrl, string packageName)
    }

    class ServerManagementService {
        - bool TryGetLocalHttpServerCommandParts(out string fileName, out string arguments)
    }

    McpAdvancedSection --> MCPForUnityEditorWindow : OnBetaModeChanged
    McpAdvancedSection --> EditorPrefKeys : uses UseBetaServer
    MCPForUnityEditorWindow --> EditorPrefKeys : uses UseBetaServer
    EditorPrefsWindow --> EditorPrefKeys : uses UseBetaServer
    ConfigJsonBuilder --> EditorPrefKeys : reads UseBetaServer
    ServerManagementService --> EditorPrefKeys : reads UseBetaServer
Loading

File-Level Changes

Change Details Files
Add a searchable editor prefs window and register the new beta server preference key.
  • Add a TextField-based search bar with refresh button to the editor prefs window, wiring it to filter displayed prefs by key name.
  • Track a searchFilter string and apply it in RefreshPrefs to skip non-matching preferences.
  • Register EditorPrefKeys.UseBetaServer as a boolean pref in the known prefs dictionary.
MCPForUnity/Editor/Windows/EditorPrefs/EditorPrefsWindow.cs
MCPForUnity/Editor/Constants/EditorPrefKeys.cs
Update GitHub workflow to publish beta server versions as PyPI pre-releases with proper PEP 440 beta semantics.
  • Rename the beta-release workflow/job from TestPyPI to PyPI pre-release and update its environment metadata and URLs to target the main PyPI index.
  • Replace dev-version generation with a minor-bumped beta version string (MAJOR.(MINOR+1).0bTIMESTAMP) and write it into Server/pyproject.toml.
  • Remove the TestPyPI repository-url override so the publish step pushes to PyPI.
.github/workflows/beta-release.yml
Enable beta server mode in Unity editor advanced settings, persisting to EditorPrefs and propagating changes to server command construction and version badge.
  • Add a UseBetaServer editor preference key and a corresponding toggle in the advanced section UXML/logic, defaulting to true and wired to EditorPrefs.
  • Expose an OnBetaModeChanged event from McpAdvancedSection and handle it in the main editor window to update the version badge when the toggle changes.
  • Implement UpdateVersionLabel to append a β suffix and tooltip when beta mode is enabled and call it on window initialization and toggle changes.
MCPForUnity/Editor/Constants/EditorPrefKeys.cs
MCPForUnity/Editor/Windows/Components/Advanced/McpAdvancedSection.cs
MCPForUnity/Editor/Windows/Components/Advanced/McpAdvancedSection.uxml
MCPForUnity/Editor/Windows/MCPForUnityEditorWindow.cs
Change uv/uvx server startup arguments to safely allow pre-release server versions from PyPI without pulling pre-release dependencies.
  • In ServerManagementService, derive fromArgs based on UseBetaServer: when enabled, use '--prerelease explicit --from "mcpforunityserver>=0.0.0a0"'; otherwise preserve existing fromUrl behavior.
  • Construct the uvx command line using fromArgs instead of inlining fromUrl, fixing the previous use of '--prerelease allow' that allowed prerelease dependencies.
  • In ConfigJsonBuilder.BuildUvxArgs, mirror the beta mode logic by appending '--prerelease explicit --from mcpforunityserver>=0.0.0a0' when UseBetaServer is true, else fall back to using fromUrl if provided.
MCPForUnity/Editor/Services/ServerManagementService.cs
MCPForUnity/Editor/Helpers/ConfigJsonBuilder.cs
Expose server version information at runtime through logs and the /health endpoint.
  • On server startup, compute the package version once and include it in the startup log message as 'MCP for Unity Server vX.Y.Z starting up'.
  • Return the current package version in the /health HTTP endpoint payload under a 'version' field.
Server/src/main.py

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 27, 2026

Caution

Review failed

The pull request is closed.

📝 Walkthrough

Walkthrough

Adds a prerelease/beta flow: CI now builds and publishes beta pre-releases to PyPI; Unity editor gains a "Use Beta Server" toggle persisted in EditorPrefs; package source argument construction is centralized for prerelease handling; server exposes a cached startup version in health and telemetry.

Changes

Cohort / File(s) Summary
CI/CD Workflow
\.github/workflows/beta-release.yml
Renamed job/output to publish_pypi_prerelease; workflow display names updated; environment switched from TestPyPI→PyPI; version generation changed from .devTIMESTAMP to bumped minor .0bTIMESTAMP beta; publish step targets PyPI.
EditorPrefs Key
MCPForUnity/Editor/Constants/EditorPrefKeys.cs
Added UseBetaServer EditorPrefs constant ("MCPForUnity.UseBetaServer").
Asset path helpers
MCPForUnity/Editor/Helpers/AssetPathUtility.cs
Added GetBetaServerFromArgs(bool) and GetBetaServerFromArgsList() to centralize --prerelease / --from argument construction and override precedence.
Config & Service callers
MCPForUnity/Editor/Helpers/ConfigJsonBuilder.cs, MCPForUnity/Editor/Services/ServerManagementService.cs
Replaced ad-hoc --from handling with calls to AssetPathUtility prerelease arg helpers; prefer prerelease args when provided.
Advanced UI
MCPForUnity/Editor/Windows/Components/Advanced/McpAdvancedSection.cs, .../McpAdvancedSection.uxml
Added Use Beta Server toggle, persisted via EditorPrefs, and OnBetaModeChanged event; toggle wired into update flows and UI.
Editor windows
MCPForUnity/Editor/Windows/EditorPrefs/EditorPrefsWindow.cs, MCPForUnity/Editor/Windows/MCPForUnityEditorWindow.cs
EditorPrefsWindow: added search/filter UI and included UseBetaServer mapping; main window: added UpdateVersionLabel(bool useBetaServer) and wired beta-mode updates.
Unity metadata
MCPForUnity/Editor/Clients/Configurators/OpenCodeConfigurator.cs.meta
Reformatted guid entry and added MonoImporter section with default importer properties.
Server runtime
Server/src/main.py
Added module-level _server_version cached at startup; telemetry and health endpoint use cached value.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant UI as Advanced UI
    participant Prefs as EditorPrefs
    participant AssetUtil as AssetPathUtility
    participant Builder as Config/ServerManagement
    participant PkgMgr as uvx / Package Manager
    participant Server as Server (startup / health)

    User->>UI: Toggle "Use Beta Server"
    UI->>Prefs: Set UseBetaServer
    Prefs-->>UI: Persisted
    UI->>UI: Fire OnBetaModeChanged

    Builder->>Prefs: Read UseBetaServer
    alt UseBetaServer = true
        Builder->>AssetUtil: GetBetaServerFromArgsList()
        AssetUtil-->>Builder: ["--prerelease","explicit","--from","mcpforunityserver>=0.0.0a0"]
    else UseBetaServer = false
        Builder->>AssetUtil: GetBetaServerFromArgsList()
        AssetUtil-->>Builder: ["--from","https://..."] or []
    end

    Builder->>PkgMgr: Invoke uvx with constructed args
    PkgMgr-->>Builder: Package resolved / installed

    Note over Server: At startup
    Server->>Server: compute and cache _server_version
    Server-->>Builder: health/version uses _server_version
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~30 minutes

Possibly related PRs

Suggested reviewers

  • msanatan
  • Scriptwonder

Poem

🐰 I hopped in code with eager cheer,
A beta toggle planted here—
Args now point to prerelease streams,
Versions cached and CI beams,
Hoppity-hop, a prerelease cheer! 🎉

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 22.22% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title 'feat: Add beta server mode with PyPI pre-release support' clearly and specifically summarizes the main feature being added—beta server mode with PyPI pre-release support.
Description check ✅ Passed The description covers the key sections: it explains what was added, why (TestPyPI issues), the solution approach, and provides a clear test plan.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've left some high level feedback:

  • The beta server flag handling is duplicated in both ServerManagementService.TryGetLocalHttpServerCommandParts and ConfigJsonBuilder.BuildUvxArgs; consider centralizing construction of the uvx argument list so the prerelease logic stays consistent in one place.
  • The health endpoint now calls get_package_version() on every request; if this is non-trivial I/O, you could cache the version during startup (e.g., in server_lifespan) and reuse it in /health responses and logs.
  • The beta version generation in beta-release.yml assumes a simple MAJOR.MINOR.PATCH numeric version in pyproject.toml; if a pre-release or non-standard version string is ever used, the read -r MAJOR MINOR PATCH split may fail—adding a safety check or guard would make this more robust.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- The beta server flag handling is duplicated in both `ServerManagementService.TryGetLocalHttpServerCommandParts` and `ConfigJsonBuilder.BuildUvxArgs`; consider centralizing construction of the `uvx` argument list so the prerelease logic stays consistent in one place.
- The health endpoint now calls `get_package_version()` on every request; if this is non-trivial I/O, you could cache the version during startup (e.g., in `server_lifespan`) and reuse it in `/health` responses and logs.
- The beta version generation in `beta-release.yml` assumes a simple `MAJOR.MINOR.PATCH` numeric `version` in `pyproject.toml`; if a pre-release or non-standard version string is ever used, the `read -r MAJOR MINOR PATCH` split may fail—adding a safety check or guard would make this more robust.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

- Centralize beta server uvx args in AssetPathUtility.GetBetaServerFromArgs()
  to avoid duplication between HTTP and stdio transports
- Cache server version at startup instead of calling get_package_version()
  on every /health request
- Add robustness to beta version parsing in workflow: strip existing
  pre-release suffix and validate X.Y.Z format before parsing

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In `@MCPForUnity/Editor/Helpers/ConfigJsonBuilder.cs`:
- Around line 174-187: The current logic in ConfigJsonBuilder.cs uses
usePreRelease (EditorPrefKeys.UseBetaServer) to unconditionally add the
prerelease "--from mcpforunityserver>=0.0.0a0" source and thus ignores an
explicit fromUrl override; change the branch so an explicit fromUrl wins: first
check if fromUrl is non-empty and, if so, add args.Add("--from") followed by
that fromUrl (and still add any other flags you want), otherwise if fromUrl is
empty then --prerelease and the mcpforunityserver source are applied; update the
conditional around usePreRelease/fromUrl (references: usePreRelease, fromUrl,
args.Add("--prerelease"), args.Add("--from"), EditorPrefKeys.UseBetaServer)
accordingly.
🧹 Nitpick comments (1)
MCPForUnity/Editor/Windows/EditorPrefs/EditorPrefsWindow.cs (1)

169-205: Use IndexOf(..., OrdinalIgnoreCase) to avoid per-item allocations.

The current filter lowercases both strings inside the loop. You can pre-trim the filter and use IndexOf with StringComparison.OrdinalIgnoreCase for clarity and fewer allocations.

♻️ Suggested refactor
-            // Create items for existing prefs
+            var filter = searchFilter?.Trim();
+            // Create items for existing prefs
             foreach (var key in allKeys)
             {
                 // Skip Customer UUID but show everything else that's defined
                 if (key != EditorPrefKeys.CustomerUuid)
                 {
                     // Apply search filter
-                    if (!string.IsNullOrEmpty(searchFilter) &&
-                        !key.ToLowerInvariant().Contains(searchFilter.ToLowerInvariant()))
+                    if (!string.IsNullOrEmpty(filter) &&
+                        key.IndexOf(filter, StringComparison.OrdinalIgnoreCase) < 0)
                     {
                         continue;
                     }

Comment on lines 174 to 187
// Beta server mode: allow beta versions from PyPI
// Beta server versions are published to PyPI as beta versions (e.g., 9.3.0b20260127)
// Defaults to true on beta branch to ensure server schema matches C# client.
// Use --prerelease explicit with version specifier to only get prereleases of our package,
// not of dependencies (which can be broken on PyPI).
bool usePreRelease = EditorPrefs.GetBool(EditorPrefKeys.UseBetaServer, true);
if (usePreRelease)
{
args.Add("--prerelease");
args.Add("explicit");
args.Add("--from");
args.Add("mcpforunityserver>=0.0.0a0");
}
else if (!string.IsNullOrEmpty(fromUrl))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Preserve explicit fromUrl overrides when beta mode is on.

With UseBetaServer=true, fromUrl is ignored, so local/server overrides (e.g., GitUrlOverride or local dev paths) won’t work on the beta branch where the toggle defaults to ON. This is a behavior regression for dev workflows. Consider letting an explicit fromUrl win and only using the prerelease path when no override is provided.

🐛 Proposed fix
-            bool usePreRelease = EditorPrefs.GetBool(EditorPrefKeys.UseBetaServer, true);
-            if (usePreRelease)
+            bool usePreRelease = EditorPrefs.GetBool(EditorPrefKeys.UseBetaServer, true);
+            if (!string.IsNullOrEmpty(fromUrl))
             {
-                args.Add("--prerelease");
-                args.Add("explicit");
-                args.Add("--from");
-                args.Add("mcpforunityserver>=0.0.0a0");
+                args.Add("--from");
+                args.Add(fromUrl);
             }
-            else if (!string.IsNullOrEmpty(fromUrl))
+            else if (usePreRelease)
             {
                 args.Add("--from");
-                args.Add(fromUrl);
+                args.Add("mcpforunityserver>=0.0.0a0");
+                args.Add("--prerelease");
+                args.Add("explicit");
             }
🤖 Prompt for AI Agents
In `@MCPForUnity/Editor/Helpers/ConfigJsonBuilder.cs` around lines 174 - 187, The
current logic in ConfigJsonBuilder.cs uses usePreRelease
(EditorPrefKeys.UseBetaServer) to unconditionally add the prerelease "--from
mcpforunityserver>=0.0.0a0" source and thus ignores an explicit fromUrl
override; change the branch so an explicit fromUrl wins: first check if fromUrl
is non-empty and, if so, add args.Add("--from") followed by that fromUrl (and
still add any other flags you want), otherwise if fromUrl is empty then
--prerelease and the mcpforunityserver source are applied; update the
conditional around usePreRelease/fromUrl (references: usePreRelease, fromUrl,
args.Add("--prerelease"), args.Add("--from"), EditorPrefKeys.UseBetaServer)
accordingly.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Fix all issues with AI agents
In `@MCPForUnity/Editor/Helpers/AssetPathUtility.cs`:
- Around line 253-271: GetBetaServerFromArgs currently returns the prerelease
"--from mcpforunityserver>=0.0.0a0" whenever EditorPrefKeys.UseBetaServer is
true, which bypasses any explicit override from GetMcpServerPackageSource;
change the logic in GetBetaServerFromArgs to first call
GetMcpServerPackageSource() and, if it returns a non-empty string (an explicit
override like GitUrlOverride/local path), return $"--from {fromUrl}"
immediately, otherwise fall back to the existing beta behavior that returns the
prerelease "--prerelease explicit --from mcpforunityserver>=0.0.0a0"; keep
references to EditorPrefKeys.UseBetaServer and the existing quoteFromPath
handling intact.
- Around line 277-300: GetBetaServerFromArgsList currently checks the
UseBetaServer preference before considering any GitUrlOverride; change its logic
to check GitUrlOverride first (same as GetBetaServerFromArgs) by calling the
override accessor (GitUrlOverride or the existing GetGitUrlOverride()) at the
top of GetBetaServerFromArgsList, and if that override is non-empty add "--from"
and the override to args and return immediately; otherwise proceed to the
existing UseBetaServer branch and fallback to GetMcpServerPackageSource() when
UseBetaServer is false. Ensure you reference GetBetaServerFromArgsList,
GitUrlOverride/GetGitUrlOverride, EditorPrefKeys.UseBetaServer, and
GetMcpServerPackageSource when making the change.
🧹 Nitpick comments (2)
Server/src/main.py (1)

136-139: Rename unused server arg to _server to silence lint

Ruff flags the unused parameter; renaming makes intent explicit and keeps the signature compatible.

♻️ Suggested tweak
-async def server_lifespan(server: FastMCP) -> AsyncIterator[dict[str, Any]]:
+async def server_lifespan(_server: FastMCP) -> AsyncIterator[dict[str, Any]]:
MCPForUnity/Editor/Helpers/ConfigJsonBuilder.cs (1)

159-185: Remove unused fromUrl parameter.

The fromUrl parameter is now unused since the centralized helper GetBetaServerFromArgsList() handles the source resolution internally. This dead parameter should be removed to avoid confusion.

♻️ Proposed refactor

Update the method signature and call site:

-private static IList<string> BuildUvxArgs(string fromUrl, string packageName)
+private static IList<string> BuildUvxArgs(string packageName)

And at line 91:

-var toolArgs = BuildUvxArgs(fromUrl, packageName);
+var toolArgs = BuildUvxArgs(packageName);

- GetBetaServerFromArgs/GetBetaServerFromArgsList now check for explicit
  GitUrlOverride before applying beta server mode, ensuring local dev
  paths and custom URLs are honored
- EditorPrefsWindow search filter uses IndexOf with OrdinalIgnoreCase
  instead of ToLowerInvariant().Contains() for fewer allocations

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
@dsarno dsarno merged commit 17c6a36 into CoplayDev:beta Jan 27, 2026
1 of 2 checks passed
@dsarno dsarno mentioned this pull request Jan 28, 2026
4 tasks
@dsarno dsarno deleted the fix/testpypi-default-true branch January 29, 2026 19:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants