Skip to content

Update/main window#1

Open
ayushjrathod-dd wants to merge 8 commits intomainfrom
update/main-window
Open

Update/main window#1
ayushjrathod-dd wants to merge 8 commits intomainfrom
update/main-window

Conversation

@ayushjrathod-dd
Copy link
Copy Markdown

@ayushjrathod-dd ayushjrathod-dd commented Mar 19, 2026

CodeAnt-AI Description

Unify connection/option controls, hardcode Cloud URL, and improve token privacy and copy behavior

What Changed

  • Two-option toggle pairs in the editor UI (connection mode, transport, authorization) are replaced with a segmented control that shows "Custom/Cloud", "stdio/http", and "none/required" options; selecting segments updates mode and triggers the same connect/disconnect and server start/stop behavior as before.
  • Cloud server URL is no longer editable in the UI or config; the plugin and CLI now use a single hardcoded cloud URL (https://ai-game.dev[/mcp as used by CLI]) for Cloud mode and the runtime exposes that value.
  • Cloud and local authorization token fields are hidden by default (password/masked) in the editor and support Ctrl/Cmd+C to copy the token to the clipboard without revealing it on screen.
  • AI agent configurator shows the configuration file path in the UI; the per-agent "Configure" button now toggles between configuring and removing configuration.
  • Form and control visuals updated: new segmented control component and accompanying styles, plus consistent styled text/dropdown fields applied across various windows and templates.
  • CLI and tests updated to resolve Cloud-mode connections to the hardcoded cloud URL and to reflect removed cloudServerUrl config property.

Impact

✅ Clearer connection mode selection in the editor
✅ Fewer accidental token exposures in the UI
✅ Consistent Cloud URL used by CLI and editor

💡 Usage Guide

Checking Your Pull Request

Every time you make a pull request, our system automatically looks through it. We check for security issues, mistakes in how you're setting up your infrastructure, and common code problems. We do this to make sure your changes are solid and won't cause any trouble later.

Talking to CodeAnt AI

Got a question or need a hand with something in your pull request? You can easily get in touch with CodeAnt AI right here. Just type the following in a comment on your pull request, and replace "Your question here" with whatever you want to ask:

@codeant-ai ask: Your question here

This lets you have a chat with CodeAnt AI about your pull request, making it easier to understand and improve your code.

Example

@codeant-ai ask: Can you suggest a safer alternative to storing this secret?

Preserve Org Learnings with CodeAnt

You can record team preferences so CodeAnt AI applies them in future reviews. Reply directly to the specific CodeAnt AI suggestion (in the same thread) and replace "Your feedback here" with your input:

@codeant-ai: Your feedback here

This helps CodeAnt AI learn and adapt to your team's coding style and standards.

Example

@codeant-ai: Do not flag unused imports.

Retrigger review

Ask CodeAnt AI to review the PR again, by typing:

@codeant-ai: review

Check Your Repository Health

To analyze the health of your code repository, visit our dashboard at https://app.codeant.ai. This tool helps you identify potential issues and areas for improvement in your codebase, ensuring your repository maintains high standards of code health.

Summary by CodeRabbit

Release Notes

New Features

  • Added segmented control UI components replacing toggle controls for cleaner connection mode, transport, and authorization selection
  • Password masking for sensitive token input fields

Improvements

  • Enhanced tooltips throughout the editor UI for better guidance
  • Streamlined cloud server configuration
  • Improved form element styling and layout consistency
  • Better visual presentation of configuration status with organized header and content structure
  • Refined filter controls in tool windows for improved usability

Remove editable Cloud server URL and make the plugin use a single hardcoded cloud URL. Added CloudServerBaseUrl/CloudServerUrl constants to UnityMcpPlugin.Config and changed Host to use the constant (no extra /mcp suffix). Removed the cloud URL TextField and its focus/connection callbacks from the editor UI and adjusted authorisation flow to use UnityConnectionConfig.CloudServerBaseUrl. Updated UnityMcpPluginEditor.Static to expose the cloud URL via the runtime config. CLI changes: dropped cloudServerUrl from the config shape, added a CLOUD_SERVER_URL constant and make resolveConnectionFromConfig return that value for Cloud mode. Updated tests and run-tool behavior to reflect the hardcoded cloud URL and removed references to a configurable cloudServerUrl.
Set password masking for cloud and local authorization token TextFields in the UXML and enable a Ctrl/Cmd+C shortcut to copy their values in the editor scripts. Changes:
- MainWindow.uxml: add password="true" to inputCloudToken and inputAuthorizationToken to hide token contents.
- MainWindowEditor.Connection.cs & MainWindowEditor.McpServer.cs: set isPasswordField = true and register KeyDownEvent handlers to copy the field value to GUIUtility.systemCopyBuffer on Ctrl/Cmd+C (and stop propagation/prevent default). Also add missing UnityEngine using in Connection script.

Purpose: improve token privacy in the UI while providing a convenient copy-to-clipboard shortcut.
Introduce a new SegmentedControl UI element (with USS styles) and migrate several two-toggle UI patterns to this segmented control. Adds SegmentedControl.cs and its stylesheet (_segmented-control.uss) plus meta files, and updates MainWindow UXML and editor logic to use the control (Connection, McpFeatures, McpServer). Removed the old mutually-exclusive toggle logic and toggle-style CSS, wiring selection via ChangeEvent<int> and preserving tooltips and behavior (no functional changes beyond UI consolidation). Key files: SegmentedControl.cs, _segmented-control.uss, MainWindow.uxml, MainWindow.uss, and MainWindowEditor.* (Connection/CreateGUI/McpFeatures/McpServer).
Update form USS to improve disabled/enabled text-field visuals: replace previous border/margin rules with transparent border, adjust background and text colors to muted tones, and add 200ms transition-duration to inputs and labels. New rules also apply muted color to .unity-label for disabled fields to ensure consistent appearance and smoother state changes.
Add a .styled-dropdown stylesheet to _forms.uss to customize Unity popup fields (background, border, radius, padding, hover state, text size/color, arrow tint and transitions). Apply the styled-dropdown class to the aiAgentDropdown DropdownField in MainWindow.uxml so the AI agent selector uses the new visual styling.
Extend styled-dropdown rules to target EnumField inputs and their hover state, add top padding for the dropdown label, and remove the old arrow tint rule. Also add the styled-dropdown class to the Log Level EnumField in MainWindow.uxml so the updated styles apply to the UI.
Introduce new USS styles for styled-text-field, styled-integer-field and refined dropdown/field states (hover/active/disabled), add consistent paddings and transitions, and tweak label spacing. Apply the new classes across several UXML views (MainWindow, McpPromptsWindow, McpResourcesWindow, McpToolsWindow, TemplateTextFieldReadOnly) to standardize appearance and replace some inline alignment. Also update header labels and tooltips in the resource/prompt/tool windows for clearer, shorter titles and helpful descriptions.
Update agent configuration UI and interaction to improve clarity and usability.

- Show full skills/config paths as tooltips and add ellipsis/truncation in UXML to avoid overflow (TemplateSkillsSection, TemplateConfigureStatus, AiAgentConfigurator, ConfigurationElements).
- Restructure configure status element: remove circular status indicator, add header + inline path label, compact status row and button styling (TemplateConfigureStatus.uxml).
- Change configure button behavior to toggle configure/unconfigure: when configured the button now removes the config (text "Remove") and uses alert styling; previously it always attempted to configure (ConfigurationElements.cs).
- Minor layout tweaks: add top margin to transport containers in AiAgentTemplateConfig.uxml and set skills path tooltip in AiAgentConfigurator.cs.

These changes make paths visible via tooltip, prevent layout overflow, and provide a clearer configure/remove workflow.
@codeant-ai
Copy link
Copy Markdown

codeant-ai bot commented Mar 19, 2026

CodeAnt AI is reviewing your PR.


Thanks for using CodeAnt! 🎉

We're free for open-source projects. if you're enjoying it, help us grow by sharing.

Share on X ·
Reddit ·
LinkedIn

@gemini-code-assist
Copy link
Copy Markdown

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly refines the user experience and simplifies configuration within the Unity MCP Plugin. It modernizes several UI sections by replacing traditional toggles with a new SegmentedControl component, making interactions more fluid. The cloud connection setup is streamlined by hardcoding the cloud server URL, removing a potential point of error. Additionally, security and usability for handling authorization tokens have been improved, and various UI elements have been updated for better clarity and functionality across the editor windows.

Highlights

  • UI/UX Improvements: Replaced multiple toggle elements with a new SegmentedControl component for connection mode, transport method, and authorization options, providing a more modern and intuitive user interface.
  • Cloud Configuration Simplification: Removed the editable CloudServerUrl from the UI and configuration, hardcoding it to https://ai-game.dev/mcp to streamline the cloud connection process and reduce potential misconfigurations.
  • Enhanced Token Security & Usability: Implemented password field behavior for authorization tokens in both local and cloud configurations, and added functionality to copy the token value using Ctrl+C (or Cmd+C on Mac) for improved security and convenience.
  • Refactored Configuration Elements: Updated the ConfigurationElements class to remove the StatusCircle visual element, display the configuration path, and modify the 'Configure' button's behavior to toggle between configure and unconfigure actions with dynamic text and styling.
  • New UI Component Introduction: Introduced a new SegmentedControl UI component, along with its associated UXML and USS files, to provide a reusable and visually appealing way to select mutually exclusive options.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@codeant-ai codeant-ai bot added the size:XL This PR changes 500-999 lines, ignoring generated files label Mar 19, 2026
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Mar 19, 2026

📝 Walkthrough

Walkthrough

This pull request replaces toggle-based binary UI controls with a new SegmentedControl component for connection mode, transport method, and authorization settings. The cloud server URL is hardcoded to a constant rather than user-configurable, and sensitive credential fields are masked as password inputs. Supporting styles, UXML markup, and C# configuration code are updated accordingly.

Changes

Cohort / File(s) Summary
New SegmentedControl Component
SegmentedControl.cs, SegmentedControl.cs.meta, Controls.meta, _segmented-control.uss, _segmented-control.uss.meta
New reusable UI control implementing INotifyValueChanged<int> with click-based segment selection, smooth highlight transitions, UXML support, and per-segment tooltip assignment. Includes stylesheet defining layout, sliding highlight animation, and segment styling.
Main Window Connection/Transport/Server UI
MainWindowEditor.Connection.cs, MainWindowEditor.McpServer.cs, MainWindowEditor.McpFeatures.cs
Replaced paired Toggle elements with SegmentedControl for connection mode (custom/cloud), transport (stdio/http), and authorization (none/required). Updated event handling to use ChangeEvent<int>, simplified button logic (Configure/Remove text), and integrated password masking for token fields with clipboard copy-to-clipboard on Ctrl/Cmd+C.
Main Window UI Structure
MainWindowEditor.CreateGUI.cs, MainWindow.uxml
Removed SetupMutuallyExclusiveToggles helper method. Replaced six toggle elements with three empty segmented control containers (segmentConnectionMode, segmentTransport, segmentAuthorization). Removed cloud URL input field, added password masking to sensitive inputs, and applied styled-dropdown/styled-text-field CSS classes to existing controls.
Agent Configuration UI
AiAgentConfigurator.cs, ConfigurationElements.cs, TemplateConfigureStatus.uxml, TemplateSkillsSection.uxml, AiAgentTemplateConfig.uxml
Updated configuration status element with new header layout, replaced status circle with labels (removed StatusCircle export), changed button styling (btn-secondarybtn-alert), and added config path label display. Updated skills path tooltip exposure and applied margin/truncation styling adjustments.
Styling & Forms
MainWindow.uss, _forms.uss
Removed .toggle-text-button styling block (66 lines). Reworked form input styling with explicit enabled/disabled states, added consistent background/border/transition rules for text-field, dropdown, and integer-field controls, and updated label padding/color handling.
Window Headers & Styling
McpPromptsWindow.uxml, McpResourcesWindow.uxml, McpToolsWindow.uxml, TemplateTextFieldReadOnly.uxml
Replaced static description labels with tooltips on title labels ("MCP Tools""Tools", etc.), applied styled-text-field and styled-dropdown classes to filter controls, and added styled-text-field class to read-only template field.
Cloud Configuration Hardcoding
UnityMcpPlugin.Config.cs, UnityMcpPluginEditor.Static.cs
Introduced CloudServerBaseUrl and CloudServerUrl constants; removed instance property CloudServerUrl from config. Made editor's CloudServerUrl read-only, returning hardcoded value instead of instance property. Updated Host property (cloud mode) to use new constant.
CLI Configuration Alignment
config.ts, run-tool.ts, config.test.ts, run-tool.test.ts
Removed optional cloudServerUrl field from UnityConnectionConfig and its resolver logic. Added exported constant CLOUD_SERVER_URL = 'https://ai-game.dev/mcp'. Updated cloud-mode URL resolution to always use hardcoded constant; updated test fixtures and assertions accordingly.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Poem

🐰 Toggles transformed to segments so sleek,
Cloud URLs hardcoded, no changes to seek,
Tokens now masked, security's unique,
New control flows through the UI technique,
Updates cascade—a polished boutique! ✨

🚥 Pre-merge checks | ✅ 1 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 26.09% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Title check ❓ Inconclusive The title 'Update/main window' is vague and generic, using non-descriptive phrasing that doesn't convey meaningful information about the changeset's primary purpose. Replace with a more specific title that describes the main change, such as 'Replace toggle controls with segmented controls in main window' or 'Refactor UI controls from toggles to segmented controls'.
✅ Passed checks (1 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

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

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch update/main-window
📝 Coding Plan
  • Generate coding plan for human review 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.

❤️ Share

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

@codeant-ai
Copy link
Copy Markdown

codeant-ai bot commented Mar 19, 2026

Sequence Diagram

This PR consolidates mode selection into segmented controls and routes Cloud mode through a fixed endpoint. It also updates cloud authorization so a new token is saved and immediately used to reconnect in Cloud mode.

sequenceDiagram
    participant User
    participant MainWindow
    participant PluginConfig
    participant LocalServer
    participant CloudAuth
    participant MCPConnection

    User->>MainWindow: Select mode in segmented control
    MainWindow->>PluginConfig: Save connection mode

    alt Custom mode selected
        MainWindow->>LocalServer: Start local server if needed
        MainWindow->>MCPConnection: Reconnect using local host
    else Cloud mode selected
        MainWindow->>LocalServer: Stop local server
        MainWindow->>MCPConnection: Reconnect using fixed cloud endpoint
    end

    User->>MainWindow: Click Authorize
    MainWindow->>CloudAuth: Start device authorization with fixed cloud base
    CloudAuth-->>MainWindow: Return cloud token
    MainWindow->>PluginConfig: Save token and reconnect in Cloud mode
Loading

Generated by CodeAnt AI

@codeant-ai
Copy link
Copy Markdown

codeant-ai bot commented Mar 19, 2026

Nitpicks 🔍

🔒 No security issues identified
⚡ Recommended areas for review

  • Clipboard Exposure
    The new keyboard copy handler writes the authorization token to the OS clipboard (GUIUtility.systemCopyBuffer). This exposes sensitive tokens to other applications and persists beyond the editor session unless cleared. Consider mitigating clipboard persistence or prompting the user before copying.

  • Clipboard copy behavior
    The new KeyDown handler copies the TextField value to the system clipboard. When the field contains the placeholder text this will copy the placeholder rather than the actual token, and copying the token to the global clipboard exposes the token to other applications. Consider copying the stored token value only when present and provide a clear guard to avoid copying the placeholder.

  • GUID Collision
    The .meta contains a hardcoded guid. If this GUID already exists elsewhere in the repo (or in other branches), it can cause asset identity conflicts and broken references when switching branches or merging. Verify the GUID is unique and intentionally set for this asset.

  • Script reference
    The script mapping contains a GUID of all zeros which usually indicates a missing or placeholder ScriptedImporter reference. This can break importer behavior or cause the asset to not be handled by the intended importer on other machines/CI.

  • Orphan .meta
    The PR adds only the .meta file for SegmentedControl (MonoImporter metadata) but no corresponding C# file in this diff. An orphaned .meta (no matching .cs asset) can cause confusion and invalid references in Unity. Confirm the actual script exists in the branch and that this .meta was intended to be committed by itself.

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request refactors the Unity Editor UI by replacing multiple Toggle elements with a new custom SegmentedControl component for selecting connection mode, transport method, and authorization options. This involved adding the SegmentedControl component and its USS styling, removing the old toggle-related USS, and updating UXML files to use the new component and new styling classes for various input fields. The CloudServerUrl is now a hardcoded constant across the Unity plugin and CLI, removing a configurable property. Additionally, the ConfigurationElements UI for AI agents was redesigned, removing a status circle and adding a path label. Review comments suggest refactoring duplicated password field copy-paste logic into a shared utility and simplifying a callback's conditional logic for better maintainability and readability.

Comment on lines +196 to +204
inputCloudToken.RegisterCallback<KeyDownEvent>(evt =>
{
if (evt.keyCode == KeyCode.C && (evt.ctrlKey || evt.commandKey))
{
GUIUtility.systemCopyBuffer = inputCloudToken.value;
evt.StopPropagation();
evt.PreventDefault();
}
});
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

This logic to enable copying from a password field is also used in MainWindowEditor.McpServer.cs. To improve maintainability and reduce code duplication, consider extracting this into a static helper method in a shared utility class. For example:

public static class UIUtils
{
    public static void EnableCopyFromPasswordField(TextField passwordField)
    {
        passwordField.RegisterCallback<KeyDownEvent>(evt =>
        {
            if (evt.keyCode == KeyCode.C && (evt.ctrlKey || evt.commandKey))
            {
                GUIUtility.systemCopyBuffer = passwordField.value;
                evt.StopPropagation();
                evt.PreventDefault();
            }
        });
    }
}

Then you could call UIUtils.EnableCopyFromPasswordField(inputCloudToken); here and in the other location.

Comment on lines +69 to +77
inputAuthorizationToken.RegisterCallback<KeyDownEvent>(evt =>
{
if (evt.keyCode == KeyCode.C && (evt.ctrlKey || evt.commandKey))
{
GUIUtility.systemCopyBuffer = inputAuthorizationToken.value;
evt.StopPropagation();
evt.PreventDefault();
}
});
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

This logic is duplicated from MainWindowEditor.Connection.cs. As mentioned in my other comment, this could be extracted to a shared utility method to avoid code repetition.

Comment on lines +88 to +106
{
if (evt.newValue == 0)
{
ApplyServerSettingAndRestart(() =>
{
UnityMcpPluginEditor.AuthOption = AuthOption.none;
});
SetTokenFieldsVisible(inputAuthorizationToken, tokenSection, false);
InvalidateAndReloadAgentUI();
},
onBSelected: () =>
}
else
{
ApplyServerSettingAndRestart(() =>
{
UnityMcpPluginEditor.AuthOption = AuthOption.required;
});
SetTokenFieldsVisible(inputAuthorizationToken, tokenSection, true);
InvalidateAndReloadAgentUI();
});
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

This callback contains duplicated logic in its branches. It can be refactored to be more concise and easier to read.

            {
                var isRequired = evt.newValue == 1;
                var newAuthOption = isRequired ? AuthOption.required : AuthOption.none;

                ApplyServerSettingAndRestart(() =>
                {
                    UnityMcpPluginEditor.AuthOption = newAuthOption;
                });
                SetTokenFieldsVisible(inputAuthorizationToken, tokenSection, isRequired);
                InvalidateAndReloadAgentUI();
            }

Comment on lines +57 to +58
UpdateStatus(false);
onConfigured.OnNext(false);
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Suggestion: The remove branch assumes unconfiguration always succeeds and force-updates the UI/event state to "not configured". Since Unconfigure() can return false (e.g., file missing or write failure), this can desynchronize UI state from actual config state and emit incorrect status to subscribers. Re-read the actual configured state after attempting removal and publish that. [logic error]

Severity Level: Major ⚠️
- ⚠️ Agent configurator status can show false removal success.
- ⚠️ Remove/Configure button state can mismatch real file state.
- ⚠️ Debugging config failures becomes harder in editor UI.
Suggested change
UpdateStatus(false);
onConfigured.OnNext(false);
var isConfiguredAfter = _config.IsConfigured();
UpdateStatus(isConfiguredAfter);
onConfigured.OnNext(isConfiguredAfter);
Steps of Reproduction ✅
1. Open the Unity editor window through `MainWindowEditor.ShowWindow()`
(`Unity-MCP-Plugin/Assets/root/Editor/Scripts/UI/Window/MainWindowEditor.cs:31-38`), which
builds agent UI in `OnGUICreated()` and calls `ConfigureAgents(root)`
(`.../MainWindowEditor.CreateGUI.cs:184-197`).

2. `ConfigureAgents()` loads one agent panel with `LoadAgentUI()`
(`.../MainWindowEditor.AiAgents.cs:74,130-147`), which calls
`configurator.CreateUI(container)` (`.../MainWindowEditor.AiAgents.cs:143`) and constructs
`ConfigurationElements` with the remove/configure button
(`.../AiAgentConfigurators/ConfigurationElements.cs:33-40`).

3. Make the agent config file configured but non-writable (read-only/locked). This is a
real failure path: both config implementations perform `File.WriteAllText(...)` inside
`Unconfigure()` (`.../JsonAiAgentConfig.cs:257`, `.../TomlAiAgentConfig.cs:235`) and
return `false` on exception (`.../JsonAiAgentConfig.cs:260-264`,
`.../TomlAiAgentConfig.cs:238-242`).

4. Click **Remove**. In `ConfigurationElements` callback, code executes
`_config.Unconfigure(); UpdateStatus(false); onConfigured.OnNext(false);`
(`.../ConfigurationElements.cs:53-58`) without checking outcome. Result: UI flips to "Not
Configured" even though unconfigure failed and file stayed configured.

5. This mismatch is technically observable in current flow because `Unconfigure()` is
explicitly designed to fail in realistic conditions and return false (also validated by
tests expecting false: `.../Tests/Editor/UI/JsonAiAgentConfigTests.cs:1312-1331`,
`.../Tests/Editor/UI/TomlAiAgentConfigTests.cs:1141-1152`).
Prompt for AI Agent 🤖
This is a comment left during a code review.

**Path:** Unity-MCP-Plugin/Assets/root/Editor/Scripts/UI/AiAgentConfigurators/ConfigurationElements.cs
**Line:** 57:58
**Comment:**
	*Logic Error: The remove branch assumes unconfiguration always succeeds and force-updates the UI/event state to "not configured". Since `Unconfigure()` can return `false` (e.g., file missing or write failure), this can desynchronize UI state from actual config state and emit incorrect status to subscribers. Re-read the actual configured state after attempting removal and publish that.

Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.
👍 | 👎

{
if (evt.keyCode == KeyCode.C && (evt.ctrlKey || evt.commandKey))
{
GUIUtility.systemCopyBuffer = inputCloudToken.value;
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Suggestion: The copy shortcut currently copies the UI field text, which is set to the placeholder string when no token exists. That causes users to copy and paste an invalid credential ("Token — press Authorize") into agent configs. Copy the persisted cloud token value instead, and only copy when it is non-empty. [logic error]

Severity Level: Major ⚠️
- ⚠️ Cloud setup copies placeholder, not usable token.
- ⚠️ Agent authorization fails after pasted invalid credential.
- ⚠️ Onboarding instructions become misleading for first-time users.
Suggested change
GUIUtility.systemCopyBuffer = inputCloudToken.value;
var tokenToCopy = UnityMcpPluginEditor.CloudToken;
if (!string.IsNullOrEmpty(tokenToCopy))
GUIUtility.systemCopyBuffer = tokenToCopy;
Steps of Reproduction ✅
1. Open the editor window so `OnGUICreated()` runs in
`Unity-MCP-Plugin/Assets/root/Editor/Scripts/UI/Window/MainWindowEditor.CreateGUI.cs:191`,
which always calls `SetupCloudAuthSection(root)`.

2. In `SetupCloudAuthSection()` (`.../MainWindowEditor.Connection.cs:206-214`), when
`UnityMcpPluginEditor.CloudToken` is empty/null, `SetTokenValue()` sets
`inputCloudToken.value` to placeholder text `"Token — press Authorize"`.

3. Press Ctrl/Cmd+C while the token field is focused; the key handler at
`.../MainWindowEditor.Connection.cs:196-203` copies `inputCloudToken.value` directly into
`GUIUtility.systemCopyBuffer`.

4. Clipboard now contains placeholder text, not a credential; this conflicts with user
flow text in `.../MainWindowEditor.CreateGUI.cs:170-172` instructing users to copy this
field into agent authorization.

5. If user pastes that value into agent/server auth config, authentication fails because
the runtime expects actual token (`Token` getter uses `CloudToken` in
`Unity-MCP-Plugin/Assets/root/Runtime/UnityMcpPlugin.Config.cs:66-73`).
Prompt for AI Agent 🤖
This is a comment left during a code review.

**Path:** Unity-MCP-Plugin/Assets/root/Editor/Scripts/UI/Window/MainWindowEditor.Connection.cs
**Line:** 200:200
**Comment:**
	*Logic Error: The copy shortcut currently copies the UI field text, which is set to the placeholder string when no token exists. That causes users to copy and paste an invalid credential (`"Token — press Authorize"`) into agent configs. Copy the persisted cloud token value instead, and only copy when it is non-empty.

Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.
👍 | 👎

<ui:VisualElement name="segmentConnectionMode" style="flex-direction: row; flex-grow: 1; justify-content: flex-end; margin-right: 0;" />
</ui:VisualElement>
<ui:TextField picking-mode="Ignore" label="Server URL" value="http://localhost:8080" name="InputServerURL" class="content-item" />
<ui:TextField picking-mode="Ignore" label="Server URL" value="http://localhost:8080" name="InputServerURL" class="content-item styled-text-field" />
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Suggestion: The Server URL field is set with picking-mode="Ignore", which prevents user interaction. This breaks custom-mode host editing because the FocusOutEvent save logic in SetupConnectionSection only runs after user edits. Make this field interactive so users can change and persist the server URL. [logic error]

Severity Level: Major ⚠️
- ❌ Main window custom host cannot be changed or saved.
- ⚠️ Custom-mode remote MCP connections stay stuck on old URL.
Suggested change
<ui:TextField picking-mode="Ignore" label="Server URL" value="http://localhost:8080" name="InputServerURL" class="content-item styled-text-field" />
<ui:TextField label="Server URL" value="http://localhost:8080" name="InputServerURL" class="content-item styled-text-field" />
Steps of Reproduction ✅
1. Open the editor window via menu item `Window/AI Game Developer — MCP` in
`Unity-MCP-Plugin/Assets/root/Editor/Scripts/UI/MenuItems.cs:24-25`, which calls
`MainWindowEditor.ShowWindow()`.

2. Window initialization calls `OnGUICreated()` in
`Unity-MCP-Plugin/Assets/root/Editor/Scripts/UI/Window/MainWindowEditor.CreateGUI.cs:35-43`,
then `SetupConnectionSection()` and binds `InputServerURL`.

3. In `SetupConnectionSection()` (`.../MainWindowEditor.Connection.cs:26-50`), host
persistence only happens in `inputFieldHost.RegisterCallback<FocusOutEvent>` at line 38
after user edits.

4. In final UXML (`.../MainWindow.uxml:21`), `InputServerURL` has `picking-mode="Ignore"`,
so pointer focus/edit is blocked; no edit means no `FocusOutEvent`-driven save/reconnect
at `MainWindowEditor.Connection.cs:44-49`.
Prompt for AI Agent 🤖
This is a comment left during a code review.

**Path:** Unity-MCP-Plugin/Assets/root/Editor/UI/uxml/MainWindow.uxml
**Line:** 21:21
**Comment:**
	*Logic Error: The `Server URL` field is set with `picking-mode="Ignore"`, which prevents user interaction. This breaks custom-mode host editing because the `FocusOutEvent` save logic in `SetupConnectionSection` only runs after user edits. Make this field interactive so users can change and persist the server URL.

Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.
👍 | 👎

<ui:VisualElement name="tokenSection" style="flex-direction: column; margin-top: 2px; margin-bottom: 2px;">
<ui:VisualElement style="flex-direction: row;">
<ui:TextField name="inputAuthorizationToken" label="" placeholder-text="Token" readonly="true" class="token-input" />
<ui:TextField name="inputAuthorizationToken" label="" placeholder-text="Token" readonly="true" password="true" class="token-input" />
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Suggestion: Marking the local authorization token field as readonly prevents manual token entry, but the window logic still expects user-edit changes via FocusOutEvent to persist UnityMcpPluginEditor.Token. This causes a functional regression where users cannot set a known token for required-auth setups. [logic error]

Severity Level: Major ⚠️
- ❌ Required-auth token cannot be manually set in editor.
- ⚠️ Existing client tokens cannot be reused, forcing rotation.
Suggested change
<ui:TextField name="inputAuthorizationToken" label="" placeholder-text="Token" readonly="true" password="true" class="token-input" />
<ui:TextField name="inputAuthorizationToken" label="" placeholder-text="Token" password="true" class="token-input" />
Steps of Reproduction ✅
1. Open the same main window from `MenuItems.ShowWindow()`
(`Unity-MCP-Plugin/Assets/root/Editor/Scripts/UI/MenuItems.cs:24-25`), then UI setup runs
through `OnGUICreated()` (`.../MainWindowEditor.CreateGUI.cs:35-43`).

2. `SetupMcpServerSection()`
(`Unity-MCP-Plugin/Assets/root/Editor/Scripts/UI/Window/MainWindowEditor.McpServer.cs:29-133`)
queries `inputAuthorizationToken` at line 49 and wires token persistence on
`FocusOutEvent` at lines 109-119 (`UnityMcpPluginEditor.Token = newToken`).

3. Final UXML declares `inputAuthorizationToken` as `readonly="true"` at
`Unity-MCP-Plugin/Assets/root/Editor/UI/uxml/MainWindow.uxml:69`, preventing user text
edits in the field.

4. Because manual edits cannot occur, the `FocusOutEvent` save path at
`MainWindowEditor.McpServer.cs:109-119` is effectively unreachable for user-entered token
changes, so known pre-shared tokens cannot be entered from UI.
Prompt for AI Agent 🤖
This is a comment left during a code review.

**Path:** Unity-MCP-Plugin/Assets/root/Editor/UI/uxml/MainWindow.uxml
**Line:** 69:69
**Comment:**
	*Logic Error: Marking the local authorization token field as `readonly` prevents manual token entry, but the window logic still expects user-edit changes via `FocusOutEvent` to persist `UnityMcpPluginEditor.Token`. This causes a functional regression where users cannot set a known token for required-auth setups.

Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.
👍 | 👎

@codeant-ai
Copy link
Copy Markdown

codeant-ai bot commented Mar 19, 2026

CodeAnt AI finished reviewing your PR.

Copy link
Copy Markdown

@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: 3

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
Unity-MCP-Plugin/Assets/root/Editor/UI/uss/common/_forms.uss (1)

38-45: ⚠️ Potential issue | 🟡 Minor

Invalid negative padding value.

Line 44 sets padding-left: -10px. Negative padding values are not supported in USS (Unity Style Sheets) or CSS. This will either be ignored or cause unexpected behavior. If you need to shift the label leftward, consider using a negative margin-left instead, or adjust the parent container's layout.

🛠️ Proposed fix
 .content-item .unity-label {
     width: 85px;
     min-width: 65px;
     max-width: 85px;
     overflow: hidden;
     text-overflow: ellipsis;
-    padding-left: -10px;
+    margin-left: -10px;
 }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@Unity-MCP-Plugin/Assets/root/Editor/UI/uss/common/_forms.uss` around lines 38
- 45, The rule for .content-item .unity-label uses an invalid negative padding
(padding-left: -10px); locate the .content-item .unity-label selector in
_forms.uss and remove the negative padding-left value and replace it with a
valid adjustment such as margin-left: -10px (or adjust width/parent layout) so
the label shifts left without using illegal padding; ensure you only change the
padding-left declaration and keep the other width/overflow properties intact.
🧹 Nitpick comments (2)
Unity-MCP-Plugin/Assets/root/Editor/UI/uxml/agents/AiAgentTemplateConfig.uxml (1)

24-27: Consistent spacing applied to transport containers.

The identical margin-top: 4px; styling provides uniform spacing for both HTTP and STDIO transport mode containers, which improves visual consistency.

Optional: Consider using a shared CSS class.

For maintainability, you could define a shared CSS class (e.g., .transport-container) instead of inline styles, especially if this spacing might be adjusted in the future or applied to additional containers.

♻️ Optional refactor to use a CSS class

In your USS/CSS file, add:

.transport-container {
    margin-top: 4px;
}

Then update the UXML:

-        <ui:VisualElement name="containerHttp" style="margin-top: 4px;" />
+        <ui:VisualElement name="containerHttp" class="transport-container" />

-        <ui:VisualElement name="containerStdio" style="margin-top: 4px;" />
+        <ui:VisualElement name="containerStdio" class="transport-container" />
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@Unity-MCP-Plugin/Assets/root/Editor/UI/uxml/agents/AiAgentTemplateConfig.uxml`
around lines 24 - 27, Replace the duplicate inline style "margin-top: 4px;" on
the UXML VisualElements named containerHttp and containerStdio by applying a
shared USS class (e.g., "transport-container"); then add a corresponding rule
for .transport-container { margin-top: 4px; } to your USS stylesheet so spacing
is maintained centrally and easier to update. Ensure you update the UXML
elements to include the class attribute referencing "transport-container" and
remove the inline style attributes from the VisualElement tags.
cli/tests/run-tool.test.ts (1)

234-248: Use the CLOUD_SERVER_URL constant for consistency.

The integration test hardcodes the URL string directly, while the unit tests (lines 52, 80, 126) use the imported CLOUD_SERVER_URL constant. Using the constant here would ensure this test stays in sync if the URL ever changes.

♻️ Suggested fix
-    expect(stdout).toContain('https://ai-game.dev/mcp');
+    expect(stdout).toContain(CLOUD_SERVER_URL);
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@cli/tests/run-tool.test.ts` around lines 234 - 248, The test currently
asserts against a hardcoded URL string; replace that literal with the shared
constant CLOUD_SERVER_URL to keep tests consistent. Import CLOUD_SERVER_URL at
the top of the test file (where other tests reference it) and change the
assertion expect(stdout).toContain('https://ai-game.dev/mcp') to
expect(stdout).toContain(CLOUD_SERVER_URL); ensure the import matches the module
used by the other tests (the same symbol referenced on lines 52, 80, 126).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@cli/src/utils/config.ts`:
- Around line 170-171: CLOUD_SERVER_URL is hardcoded to
'https://ai-game.dev/mcp' which may not be a reachable public endpoint and lacks
an override; verify that the endpoint is actually deployed and publicly
accessible, and modify config handling to allow an environment override (e.g.,
add a CLOUD_MCP_HOST or reuse UNITY_MCP_HOST) so CLOUD_SERVER_URL becomes
configurable at runtime with a sensible default fallback; update the code that
reads CLOUD_SERVER_URL in config.ts and anywhere it's used to prefer the env var
when present.

In
`@Unity-MCP-Plugin/Assets/root/Editor/Scripts/UI/AiAgentConfigurators/ConfigurationElements.cs`:
- Around line 53-65: When unconfiguring, check the boolean return from
_config.Unconfigure() instead of ignoring it: call var success =
_config.Unconfigure(); then call UpdateStatus(!success ? _config.IsConfigured()
: false) or simply UpdateStatus(!success) based on desired semantics and emit
onConfigured.OnNext(success) so the UI reflects the actual result; update the
block that currently calls _config.Unconfigure() to use the returned bool and
propagate it to UpdateStatus(...) and onConfigured.OnNext(...).

In `@Unity-MCP-Plugin/Assets/root/Editor/Scripts/UnityMcpPluginEditor.Static.cs`:
- Line 184: UnityMcpPluginEditor.CloudServerUrl was changed to a get-only
property causing a breaking API change; restore a setter that provides a
migration path by reintroducing a public set accessor on
UnityMcpPluginEditor.CloudServerUrl which either forwards assignments to
UnityMcpPlugin.UnityConnectionConfig.CloudServerUrl or safely no-ops while
emitting a clear Obsolete attribute and a runtime warning (log) so downstream
consumers get a compile-time deprecation message and a runtime hint; mark the
setter with [Obsolete("...migration guidance...", false)] and ensure the getter
continues to return UnityMcpPlugin.UnityConnectionConfig.CloudServerUrl.

---

Outside diff comments:
In `@Unity-MCP-Plugin/Assets/root/Editor/UI/uss/common/_forms.uss`:
- Around line 38-45: The rule for .content-item .unity-label uses an invalid
negative padding (padding-left: -10px); locate the .content-item .unity-label
selector in _forms.uss and remove the negative padding-left value and replace it
with a valid adjustment such as margin-left: -10px (or adjust width/parent
layout) so the label shifts left without using illegal padding; ensure you only
change the padding-left declaration and keep the other width/overflow properties
intact.

---

Nitpick comments:
In `@cli/tests/run-tool.test.ts`:
- Around line 234-248: The test currently asserts against a hardcoded URL
string; replace that literal with the shared constant CLOUD_SERVER_URL to keep
tests consistent. Import CLOUD_SERVER_URL at the top of the test file (where
other tests reference it) and change the assertion
expect(stdout).toContain('https://ai-game.dev/mcp') to
expect(stdout).toContain(CLOUD_SERVER_URL); ensure the import matches the module
used by the other tests (the same symbol referenced on lines 52, 80, 126).

In
`@Unity-MCP-Plugin/Assets/root/Editor/UI/uxml/agents/AiAgentTemplateConfig.uxml`:
- Around line 24-27: Replace the duplicate inline style "margin-top: 4px;" on
the UXML VisualElements named containerHttp and containerStdio by applying a
shared USS class (e.g., "transport-container"); then add a corresponding rule
for .transport-container { margin-top: 4px; } to your USS stylesheet so spacing
is maintained centrally and easier to update. Ensure you update the UXML
elements to include the class attribute referencing "transport-container" and
remove the inline style attributes from the VisualElement tags.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 46b95332-5710-4d63-8352-9ab278daf345

📥 Commits

Reviewing files that changed from the base of the PR and between 54d7c1b and 6e4b7aa.

📒 Files selected for processing (27)
  • Unity-MCP-Plugin/Assets/root/Editor/Scripts/UI/AiAgentConfigurators/AiAgentConfigurator.cs
  • Unity-MCP-Plugin/Assets/root/Editor/Scripts/UI/AiAgentConfigurators/ConfigurationElements.cs
  • Unity-MCP-Plugin/Assets/root/Editor/Scripts/UI/Controls.meta
  • Unity-MCP-Plugin/Assets/root/Editor/Scripts/UI/Controls/SegmentedControl.cs
  • Unity-MCP-Plugin/Assets/root/Editor/Scripts/UI/Controls/SegmentedControl.cs.meta
  • Unity-MCP-Plugin/Assets/root/Editor/Scripts/UI/Window/MainWindowEditor.Connection.cs
  • Unity-MCP-Plugin/Assets/root/Editor/Scripts/UI/Window/MainWindowEditor.CreateGUI.cs
  • Unity-MCP-Plugin/Assets/root/Editor/Scripts/UI/Window/MainWindowEditor.McpFeatures.cs
  • Unity-MCP-Plugin/Assets/root/Editor/Scripts/UI/Window/MainWindowEditor.McpServer.cs
  • Unity-MCP-Plugin/Assets/root/Editor/Scripts/UnityMcpPluginEditor.Static.cs
  • Unity-MCP-Plugin/Assets/root/Editor/UI/uss/MainWindow.uss
  • Unity-MCP-Plugin/Assets/root/Editor/UI/uss/common/_forms.uss
  • Unity-MCP-Plugin/Assets/root/Editor/UI/uss/common/_segmented-control.uss
  • Unity-MCP-Plugin/Assets/root/Editor/UI/uss/common/_segmented-control.uss.meta
  • Unity-MCP-Plugin/Assets/root/Editor/UI/uxml/MainWindow.uxml
  • Unity-MCP-Plugin/Assets/root/Editor/UI/uxml/McpPromptsWindow.uxml
  • Unity-MCP-Plugin/Assets/root/Editor/UI/uxml/McpResourcesWindow.uxml
  • Unity-MCP-Plugin/Assets/root/Editor/UI/uxml/McpToolsWindow.uxml
  • Unity-MCP-Plugin/Assets/root/Editor/UI/uxml/agents/AiAgentTemplateConfig.uxml
  • Unity-MCP-Plugin/Assets/root/Editor/UI/uxml/agents/elements/TemplateConfigureStatus.uxml
  • Unity-MCP-Plugin/Assets/root/Editor/UI/uxml/agents/elements/TemplateSkillsSection.uxml
  • Unity-MCP-Plugin/Assets/root/Editor/UI/uxml/agents/elements/TemplateTextFieldReadOnly.uxml
  • Unity-MCP-Plugin/Assets/root/Runtime/UnityMcpPlugin.Config.cs
  • cli/src/commands/run-tool.ts
  • cli/src/utils/config.ts
  • cli/tests/config.test.ts
  • cli/tests/run-tool.test.ts
💤 Files with no reviewable changes (3)
  • cli/tests/config.test.ts
  • Unity-MCP-Plugin/Assets/root/Editor/Scripts/UI/Window/MainWindowEditor.CreateGUI.cs
  • Unity-MCP-Plugin/Assets/root/Editor/UI/uss/MainWindow.uss

Comment on lines +170 to +171
export const CLOUD_SERVER_URL = 'https://ai-game.dev/mcp';

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

🌐 Web query:

ai-game.dev MCP server endpoint

💡 Result:

The MCP server associated with ai-game.dev is the Unity-MCP server from the GitHub repository https://github.com/IvanMurzak/Unity-MCP, which lists "Homepage: https://ai-game.dev". This is an AI-powered game development assistant for Unity Editor and Runtime, connecting tools like Claude, Cursor, and Windsurf via MCP. It supports flexible deployment (local stdio or remote HTTP) and custom MCP tools. The primary MCP server endpoint is http://localhost:8080 (default port, configurable). To run via Docker (streamableHttp transport): docker run -p 8080:8080 ivanmurzakdev/unity-mcp-server MCP client config example: { "mcpServers": { "ai-game-developer": { "url": "http://localhost:8080" } } } For stdio transport with Docker: docker run -t -e MCP_PLUGIN_CLIENT_TRANSPORT=stdio -p 8080:8080 ivanmurzakdev/unity-mcp-server Custom port example (e.g., 123): docker run -e MCP_PLUGIN_PORT=123 -p 123:123 ivanmurzakdev/unity-mcp-server Then use "url": "http://localhost:123" in config. No hosted/remote endpoint at https://ai-game.dev/mcp or similar was found; it appears to be a local/development server. The site ai-game.dev may be the project homepage, but searches did not return an active company page or official docs there.

Citations:


🏁 Script executed:

# Find all references to CLOUD_SERVER_URL and cloud-related configuration
rg -i "CLOUD_SERVER_URL|ai-game\.dev|cloudServerUrl" --type ts --type js -B 2 -A 2

Repository: coderabbit-test/Unity-MCP

Length of output: 2044


🏁 Script executed:

# Check the config.ts file for context around the URL and any related comments
cat -n cli/src/utils/config.ts | sed -n '160,200p'

Repository: coderabbit-test/Unity-MCP

Length of output: 1274


🏁 Script executed:

# Look for environment variables or alternative URL configuration patterns
rg -i "SERVER_URL|MCP_.*URL|process\.env" --type ts --type js cli/src/ -B 1 -A 1

Repository: coderabbit-test/Unity-MCP

Length of output: 1949


Verify the hardcoded cloud server URL is operational and publicly accessible.

The cloud URL is hardcoded by design (line 170), which is intentional. However, web searches indicate no public endpoint exists at https://ai-game.dev/mcp—the project uses local deployments at http://localhost:8080 by default. Confirm this endpoint is actually deployed and accessible in production. Additionally, unlike custom mode (which allows override via UNITY_MCP_HOST), there's no environment variable to override the cloud URL, making it impossible to test against staging or different cloud instances without code changes.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@cli/src/utils/config.ts` around lines 170 - 171, CLOUD_SERVER_URL is
hardcoded to 'https://ai-game.dev/mcp' which may not be a reachable public
endpoint and lacks an override; verify that the endpoint is actually deployed
and publicly accessible, and modify config handling to allow an environment
override (e.g., add a CLOUD_MCP_HOST or reuse UNITY_MCP_HOST) so
CLOUD_SERVER_URL becomes configurable at runtime with a sensible default
fallback; update the code that reads CLOUD_SERVER_URL in config.ts and anywhere
it's used to prefer the env var when present.

Comment on lines +53 to +65
var isCurrentlyConfigured = _config.IsConfigured();
if (isCurrentlyConfigured)
{
_config.Unconfigure();
UpdateStatus(false);
onConfigured.OnNext(false);
}
else
{
var result = _config.Configure();
UpdateStatus(result);
onConfigured.OnNext(result);
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Check Unconfigure() return value to avoid UI state mismatch.

The Unconfigure() method returns bool to indicate success/failure (see TomlAiAgentConfig.Unconfigure() in the codebase), but the return value is ignored here. If unconfiguration fails, the UI will incorrectly show "Not Configured" even though the configuration may still exist.

🛠️ Suggested fix
 if (isCurrentlyConfigured)
 {
-    _config.Unconfigure();
-    UpdateStatus(false);
-    onConfigured.OnNext(false);
+    var unconfigured = _config.Unconfigure();
+    if (unconfigured)
+    {
+        UpdateStatus(false);
+        onConfigured.OnNext(false);
+    }
+    // Optionally: else show error feedback
 }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@Unity-MCP-Plugin/Assets/root/Editor/Scripts/UI/AiAgentConfigurators/ConfigurationElements.cs`
around lines 53 - 65, When unconfiguring, check the boolean return from
_config.Unconfigure() instead of ignoring it: call var success =
_config.Unconfigure(); then call UpdateStatus(!success ? _config.IsConfigured()
: false) or simply UpdateStatus(!success) based on desired semantics and emit
onConfigured.OnNext(success) so the UI reflects the actual result; update the
block that currently calls _config.Unconfigure() to use the returned bool and
propagate it to UpdateStatus(...) and onConfigured.OnNext(...).

NotifyChanged(Instance.unityConnectionConfig);
}
}
public static string CloudServerUrl => UnityMcpPlugin.UnityConnectionConfig.CloudServerUrl;
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Keep a migration path for CloudServerUrl instead of hard-removing the override.

Turning UnityMcpPluginEditor.CloudServerUrl into a get-only property is a source-breaking public API change, and it also removes any visible way for downstream code to keep using staging/self-hosted cloud endpoints. If the URL must now be fixed, keep a deprecated no-op setter for at least one release so consumers get a controlled migration instead of an immediate compile break.

🧭 Compatibility-friendly transition
-public static string CloudServerUrl => UnityMcpPlugin.UnityConnectionConfig.CloudServerUrl;
+public static string CloudServerUrl
+{
+    get => UnityMcpPlugin.UnityConnectionConfig.CloudServerUrl;
+    [Obsolete("Cloud server URL is fixed and can no longer be changed.", false)]
+    set => _logger.LogWarning("Ignoring deprecated CloudServerUrl setter. The cloud URL is now fixed.");
+}
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
public static string CloudServerUrl => UnityMcpPlugin.UnityConnectionConfig.CloudServerUrl;
public static string CloudServerUrl
{
get => UnityMcpPlugin.UnityConnectionConfig.CloudServerUrl;
[Obsolete("Cloud server URL is fixed and can no longer be changed.", false)]
set => _logger.LogWarning("Ignoring deprecated CloudServerUrl setter. The cloud URL is now fixed.");
}
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@Unity-MCP-Plugin/Assets/root/Editor/Scripts/UnityMcpPluginEditor.Static.cs`
at line 184, UnityMcpPluginEditor.CloudServerUrl was changed to a get-only
property causing a breaking API change; restore a setter that provides a
migration path by reintroducing a public set accessor on
UnityMcpPluginEditor.CloudServerUrl which either forwards assignments to
UnityMcpPlugin.UnityConnectionConfig.CloudServerUrl or safely no-ops while
emitting a clear Obsolete attribute and a runtime warning (log) so downstream
consumers get a compile-time deprecation message and a runtime hint; mark the
setter with [Obsolete("...migration guidance...", false)] and ensure the getter
continues to return UnityMcpPlugin.UnityConnectionConfig.CloudServerUrl.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:XL This PR changes 500-999 lines, ignoring generated files

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants