Skip to content

Conversation

@dsarno
Copy link
Collaborator

@dsarno dsarno commented Jan 23, 2026

UI Improvements:

  • Restructure editor window with cleaner tab-based layout

  • Update header styling with fixed height and improved version badge

  • Improve tab styling with proper borders and active state

  • Optimize spacing: remove bottom padding from panels, add space between sections

  • Rename Connection section to Server for clarity

  • Add flex-shrink: 0 to header to prevent clipping when dropdowns expand

Refactoring:

  • Split monolithic Settings section into Advanced and Validation sections

  • Move path override controls to Advanced section

  • Move script validation to dedicated Validation section

  • Improve component organization and maintainability

Transport Mismatch Detection:

  • Add detection for when MCP client config transport doesn't match Unity transport

  • Display warning banner when mismatch is detected

  • Add transport property to McpStatus and McpClient models

  • Detect transport from client configuration files (HTTP Local vs StdIO)

Summary by Sourcery

Restructure the MCP for Unity editor window into dedicated Clients, Validation, Advanced, and Tools tabs with improved layout and header, while adding detection and UI warnings for mismatched client/server transports and reorganizing advanced settings and health diagnostics.

New Features:

  • Introduce a tabbed editor layout separating Clients, Validation, Advanced, and Tools panels.
  • Add transport mismatch detection between MCP client configurations and the Unity server transport, surfacing warnings in the connection and client configuration UI.
  • Add a dedicated Validation section controlling script validation levels with clearer descriptions.
  • Expose and persist each client's configured transport type for use in tooling and UI state.

Enhancements:

  • Refactor the former combined Settings section into separate Advanced and Validation components to improve organization and maintainability.
  • Move health check controls and indicators from the Connection section into the Advanced settings, wired via callbacks.
  • Improve editor window header with a fixed-height version label and update notification area, and adjust minimum window size and spacing.
  • Enhance tooltips and foldout defaults across connection, client config, advanced, and tools sections for clearer guidance.
  • Relocate project-scoped tools configuration from the Connection section into the Tools panel and simplify HTTP control visibility.
  • Suppress obsolete API warnings for GameObject lookup by instance ID.

Summary by CodeRabbit

  • New Features

    • Client transport detection and tracking (Unknown, Stdio, Http)
    • Transport mismatch warning between client and server
    • Script validation level selector (Basic, Standard, Comprehensive, Strict)
    • Project-scoped tools toggle
  • UI/UX Improvements

    • New multi-panel layout (Clients, Validation, Advanced, Tools) with header/version badge and update notification
    • Advanced panel: server health, test-connection, and deploy controls
    • Updated styles, tooltips, and compact layout adjustments

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

Transport Mismatch Detection:

- Add detection for when MCP client config transport doesn't match Unity transport

- Display warning banner when mismatch is detected

- Add transport property to McpStatus and McpClient models

- Detect transport from client configuration files (HTTP Local vs StdIO)

UI Improvements:

- Restructure editor window with cleaner tab-based layout

- Update header styling with fixed height and improved version badge

- Improve tab styling with proper borders and active state

- Optimize spacing: remove bottom padding from panels, add space between sections

- Rename Connection section to Server for clarity

- Add flex-shrink: 0 to header to prevent clipping when dropdowns expand

Refactoring:

- Split monolithic Settings section into Advanced and Validation sections

- Move path override controls to Advanced section

- Move script validation to dedicated Validation section

- Improve component organization and maintainability
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 23, 2026

Note

Other AI code review bot(s) detected

CodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review.

📝 Walkthrough

Walkthrough

Adds transport-type tracking (ConfiguredTransport enum) to client models and configurator; updates editor UI with separate Clients/Validation/Advanced/Tools panels, health-status callbacks, and transport-mismatch warnings; introduces new Validation and Advanced components and related UI/style changes.

Changes

Cohort / File(s) Summary
Transport Model & Config
MCPForUnity/Editor/Models/McpStatus.cs, MCPForUnity/Editor/Models/McpClient.cs, MCPForUnity/Editor/Models/MCPConfigServer.cs
Add ConfiguredTransport enum (Unknown, Stdio, Http); add configuredTransport field to McpClient; add optional url field to McpConfigServer.
Configurator API & Implementation
MCPForUnity/Editor/Clients/IMcpClientConfigurator.cs, MCPForUnity/Editor/Clients/McpClientConfiguratorBase.cs
Expose ConfiguredTransport ConfiguredTransport { get; } on configurator interface and base; detect/update transport (JSON, TOML, CLI flows) and persist refresh after operations.
Connection UI & Logic
MCPForUnity/Editor/Windows/Components/Connection/*
Add health-status callback, transport-mismatch banner methods (UpdateTransportMismatchWarning, ClearTransportMismatchWarning), manual-command foldout UI tweaks, and rename section title to "Server".
Client Config UI
MCPForUnity/Editor/Windows/Components/ClientConfig/*
Emit OnClientTransportDetected event; collapse manual-config foldout by default; render transport-mismatch status when client/server transports differ.
Advanced Section UI/Logic
MCPForUnity/Editor/Windows/Components/Advanced/*
Rename McpSettingsSectionMcpAdvancedSection; replace prior validation UI with health indicator, test button, OnTestConnectionRequested event, and UpdateHealthStatus() method; UXML added.
Validation Section
MCPForUnity/Editor/Windows/Components/Validation/*
New McpValidationSection component with ValidationLevel enum, UI (uxml), persistence via EditorPrefs, and descriptive text.
Editor Window & Panels
MCPForUnity/Editor/Windows/MCPForUnityEditorWindow.*
Replace single Settings panel with multi-panel layout (Clients, Validation, Advanced, Tools); add header/version bar; add HasAnyOpenWindow() and CloseAllOpenWindows() helpers; wire cross-section events.
Tools Section
MCPForUnity/Editor/Windows/Components/Tools/*
Add project-scoped-tools-toggle UI and EditorPrefs binding.
Styles & Layout
MCPForUnity/Editor/Windows/Components/Common.uss, MCPForUnity/Editor/Windows/MCPForUnityEditorWindow.uss
New warning-banner and manual-foldout styles; header/tab styling updates; spacing and typography adjustments for light/dark themes.
Obsolete API Suppression
MCPForUnity/Editor/Helpers/GameObjectLookup.cs
Wrap EditorUtility.InstanceIDToObject calls with CS0618 pragma to suppress deprecation warnings.
Deleted Assets
MCPForUnity/Editor/Windows/Components/Settings/McpSettingsSection.uxml
Remove legacy Settings UXML (migrated/replaced by new panels).
Misc Unity Meta Files
MCPForUnity/Editor/Windows/Components/Advanced/*.meta, .../Validation/*.meta, .../McpAdvancedSection.uxml.meta, Constants/HealthStatus.cs.meta
Updated/added Unity .meta GUIDs for new/changed assets.
Health Constants
MCPForUnity/Editor/Constants/HealthStatus.cs
Add HealthStatus constants: Unknown, Healthy, Ping Failed, Unhealthy.

Sequence Diagram(s)

sequenceDiagram
    participant Configurator as McpClientConfigurator
    participant Model as McpClient (model)
    participant Editor as MCPForUnityEditorWindow / UI
    participant Server as Server (HTTP/CLI)

    rect rgba(200,200,255,0.5)
    Configurator->>Model: detect transport (json/toml/CLI)
    Model-->>Configurator: store configuredTransport
    end

    rect rgba(200,255,200,0.5)
    Configurator->>Editor: emit transport-detected event
    Editor->>Editor: update ClientConfigSection UI (status, warnings)
    Editor->>Configurator: request reconfirmation (on actions)
    end

    rect rgba(255,200,200,0.5)
    Editor->>Server: perform health check / start/stop / test connection
    Server-->>Editor: health response (Healthy / Unhealthy / NoResponse)
    Editor->>Editor: propagate via health callback to Advanced section
    end
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

Suggested reviewers

  • msanatan

Poem

🐰 I hopped through configs, sniffed the stream,

Stdio, HTTP—now tracked in the scheme.
Panels split, health pings take flight,
Warnings glow yellow, the UI feels right.
A rabbit cheers: the transport’s in sight! 🎉

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 13.21% 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 clearly and concisely summarizes the main changes: UI improvements (restructured editor window with tabs) and transport mismatch warning feature, which are the primary focuses of this PR.
Description check ✅ Passed The PR description comprehensively covers all major changes (UI restructuring, refactoring, transport detection) with clear sections, but misses the related issues section. However, all critical required information is present and well-organized.

✏️ 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.

@dsarno
Copy link
Collaborator Author

dsarno commented Jan 23, 2026

Some screenshots

image image image

@sourcery-ai
Copy link
Contributor

sourcery-ai bot commented Jan 23, 2026

Reviewer's Guide

Refactors the MCP for Unity editor window into a multi-tab layout (Clients, Validation, Advanced, Tools), moves advanced/server settings and health into a dedicated Advanced section, introduces a separate Validation section for script validation levels, and adds end-to-end transport type detection on MCP clients with a banner warning when client and server transports mismatch, along with assorted UI polish and tooling preferences tweaks.

Sequence diagram for client transport mismatch detection and warning banner

sequenceDiagram
    actor User
    participant MCPForUnityEditorWindow
    participant McpClientConfigSection
    participant IMcpClientConfigurator
    participant McpClient
    participant McpConnectionSection
    participant EditorPrefs

    User->>MCPForUnityEditorWindow: Open Clients tab
    MCPForUnityEditorWindow->>McpClientConfigSection: UpdateClientStatus()
    McpClientConfigSection->>IMcpClientConfigurator: CheckStatus(attemptAutoRewrite)
    IMcpClientConfigurator->>McpClient: Inspect config files
    IMcpClientConfigurator->>McpClient: Set status (McpStatus)
    IMcpClientConfigurator->>McpClient: Set configuredTransport(Http|Stdio|Unknown)
    IMcpClientConfigurator-->>McpClientConfigSection: McpStatus

    McpClientConfigSection->>McpClientConfigSection: ApplyStatusToUi(client)
    McpClientConfigSection->>EditorPrefs: Read UseHttpTransport
    McpClientConfigSection->>McpClientConfigSection: Compare client.ConfiguredTransport with server transport
    alt Transport mismatch
        McpClientConfigSection->>McpClientConfigSection: Set clientStatusLabel Transport Mismatch
        McpClientConfigSection->>McpClientConfigSection: Add warning class to clientStatusIndicator
    else No mismatch
        McpClientConfigSection->>McpClientConfigSection: Show normal status
    end

    McpClientConfigSection-->>McpConnectionSection: OnClientTransportDetected(clientName, ConfiguredTransport)
    McpConnectionSection->>EditorPrefs: Read UseHttpTransport
    McpConnectionSection->>McpConnectionSection: Determine server ConfiguredTransport
    alt Mismatch
        McpConnectionSection->>McpConnectionSection: UpdateTransportMismatchWarning()
        McpConnectionSection->>McpConnectionSection: Show banner and message
    else No mismatch or Unknown
        McpConnectionSection->>McpConnectionSection: ClearTransportMismatchWarning()
    end
Loading

Sequence diagram for health status testing via Advanced section

sequenceDiagram
    actor User
    participant MCPForUnityEditorWindow
    participant McpAdvancedSection
    participant McpConnectionSection
    participant BridgeService

    User->>McpAdvancedSection: Click Test Connection button
    McpAdvancedSection-->>MCPForUnityEditorWindow: OnTestConnectionRequested event
    MCPForUnityEditorWindow->>McpConnectionSection: VerifyBridgeConnectionAsync()
    McpConnectionSection->>McpConnectionSection: VerifyBridgeConnectionInternalAsync()

    alt Bridge not running
        McpConnectionSection-->>McpAdvancedSection: onHealthStatusUpdate(false, Unknown)
    else Bridge running
        McpConnectionSection->>BridgeService: VerifyAsync()
        BridgeService-->>McpConnectionSection: result (Success, PingSucceeded, HandshakeValid)
        McpConnectionSection->>McpConnectionSection: Determine statusText and isHealthy
        McpConnectionSection-->>McpAdvancedSection: onHealthStatusUpdate(isHealthy, statusText)
    end

    McpAdvancedSection->>McpAdvancedSection: UpdateHealthStatus(isHealthy, statusText)
    McpAdvancedSection->>McpAdvancedSection: Update healthIndicator classes and label
Loading

Class diagram for MCPForUnityEditorWindow tab layout and sections

classDiagram
    class MCPForUnityEditorWindow {
        -McpConnectionSection connectionSection
        -McpClientConfigSection clientConfigSection
        -McpValidationSection validationSection
        -McpAdvancedSection advancedSection
        -McpToolsSection toolsSection
        -Label versionLabel
        -VisualElement updateNotification
        -Label updateNotificationText
        -ToolbarToggle clientsTabToggle
        -ToolbarToggle validationTabToggle
        -ToolbarToggle advancedTabToggle
        -ToolbarToggle toolsTabToggle
        -VisualElement clientsPanel
        -VisualElement validationPanel
        -VisualElement advancedPanel
        -VisualElement toolsPanel
        -enum ActivePanel
        +void CreateGUI()
        +void RefreshAllData()
        -void SetupTabs()
        -void SwitchPanel(ActivePanel panel)
    }

    class ActivePanel {
        <<enumeration>>
        Clients
        Validation
        Advanced
        Tools
    }

    class McpConnectionSection {
        +VisualElement Root
        -EnumField transportDropdown
        -VisualElement transportMismatchWarning
        -Label transportMismatchText
        -VisualElement httpUrlRow
        -VisualElement httpServerControlRow
        -Foldout manualCommandFoldout
        -VisualElement unitySocketPortRow
        -TextField unityPortField
        -VisualElement statusIndicator
        -Label connectionStatusLabel
        -Button connectionToggleButton
        -Action onHealthStatusUpdate
        +void SetHealthStatusUpdateCallback(Action callback)
        +void UpdateConnectionStatus()
        +Task VerifyBridgeConnectionAsync()
        +void UpdateHttpServerCommandDisplay()
        +void UpdateTransportMismatchWarning(string clientName, ConfiguredTransport clientTransport)
        +void ClearTransportMismatchWarning()
    }

    class McpClientConfigSection {
        +VisualElement Root
        -PopupField~string~ clientDropdown
        -Foldout manualConfigFoldout
        -Label clientStatusLabel
        -VisualElement clientStatusIndicator
        -Button configureButton
        -List~IMcpClientConfigurator~ configurators
        -int selectedClientIndex
        +event Action string ConfiguredTransport OnClientTransportDetected
        +void UpdateManualConfiguration()
        +void RefreshSelectedClient()
        -void ApplyStatusToUi(IMcpClientConfigurator client, bool showChecking)
    }

    class McpAdvancedSection {
        +VisualElement Root
        -TextField uvxPathOverride
        -Button browseUvxButton
        -Button clearUvxButton
        -Toggle debugLogsToggle
        -TextField gitUrlOverride
        -Toggle devModeForceRefreshToggle
        -TextField deploySourcePath
        -Button browseDeploySourceButton
        -Button clearDeploySourceButton
        -Button deployButton
        -Button deployRestoreButton
        -Label deployTargetLabel
        -Label deployBackupLabel
        -Label deployStatusLabel
        -VisualElement healthIndicator
        -Label healthStatus
        -Button testConnectionButton
        +event Action OnGitUrlChanged
        +event Action OnHttpServerCommandUpdateRequested
        +event Action OnTestConnectionRequested
        +void UpdatePathOverrides()
        +void UpdateHealthStatus(bool isHealthy, string statusText)
    }

    class McpValidationSection {
        +VisualElement Root
        -EnumField validationLevelField
        -Label validationDescription
        -ValidationLevel currentValidationLevel
        +enum ValidationLevel
        +McpValidationSection(VisualElement root)
    }

    class McpToolsSection {
        +VisualElement Root
        -Dictionary~string,Toggle~ toolToggleMap
        -Toggle projectScopedToolsToggle
        -Label summaryLabel
        -Label noteLabel
        -Button enableAllButton
        -Button disableAllButton
    }

    MCPForUnityEditorWindow --> McpConnectionSection : owns
    MCPForUnityEditorWindow --> McpClientConfigSection : owns
    MCPForUnityEditorWindow --> McpValidationSection : owns
    MCPForUnityEditorWindow --> McpAdvancedSection : owns
    MCPForUnityEditorWindow --> McpToolsSection : owns
    MCPForUnityEditorWindow --> ActivePanel : uses

    McpConnectionSection --> McpAdvancedSection : healthStatusUpdateCallback
    McpAdvancedSection --> McpConnectionSection : testConnectionRequested
    McpClientConfigSection --> McpConnectionSection : transportMismatchWarning
Loading

Class diagram for MCP client transport detection and status

classDiagram
    class IMcpClientConfigurator {
        <<interface>>
        +string Id
        +string DisplayName
        +McpStatus Status
        +ConfiguredTransport ConfiguredTransport
        +bool SupportsAutoConfigure
        +string GetConfigureActionLabel()
        +McpStatus CheckStatus(bool attemptAutoRewrite)
        +void Configure()
        +string GetManualSnippet()
    }

    class McpClientConfiguratorBase {
        -McpClient client
        +McpClientConfiguratorBase(McpClient client)
        +string Id
        +string DisplayName
        +McpStatus Status
        +ConfiguredTransport ConfiguredTransport
        +virtual bool SupportsAutoConfigure
        +virtual string GetConfigureActionLabel()
        +virtual McpStatus CheckStatus(bool attemptAutoRewrite)
        +virtual void Configure()
        +virtual string GetManualSnippet()
        -McpStatus CheckStatusWithProjectDir(string projectDir, bool useHttpTransport)
        -void RegisterWithCapturedValues(string projectDir, string claudePath, bool useHttpTransport)
        -void UnregisterWithCapturedValues(string projectDir, string claudePath, bool useHttpTransport)
    }

    class McpClient {
        +string name
        +string windowsConfigPath
        +string macConfigPath
        +string linuxConfigPath
        +string configStatus
        +McpStatus status
        +ConfiguredTransport configuredTransport
        +bool IsVsCodeLayout
        +bool RequiresArgsSection
    }

    class McpStatus {
        <<enumeration>>
        NotConfigured
        Configured
        Running
        Connected
        IncorrectPath
        MissingConfig
        CommunicationError
        NoResponse
        UnsupportedOS
        Error
    }

    class ConfiguredTransport {
        <<enumeration>>
        Unknown
        Stdio
        Http
    }

    class McpConfigServer {
        +string command
        +string args
        +string type
        +string url
    }

    IMcpClientConfigurator <|.. McpClientConfiguratorBase
    McpClientConfiguratorBase --> McpClient : wraps
    McpClient --> McpStatus : uses
    McpClient --> ConfiguredTransport : uses
    McpClientConfiguratorBase --> ConfiguredTransport : sets
    McpClientConfiguratorBase --> McpConfigServer : reads/writes
Loading

File-Level Changes

Change Details Files
Restructured the main editor window into a multi-tab layout with distinct Clients, Validation, Advanced, and Tools panels and updated initialization logic.
  • Replaced the single Settings tab/panel with Clients, Validation, Advanced, and Tools tabs and updated the ActivePanel enum and tab switching logic.
  • Updated CreateGUI to cache new header and panel elements (version label, notification, clients/validation/advanced panels) and load corresponding UXML containers.
  • Adjusted min window size and panel visibility handling, and persisted the selected panel via EditorPrefs using the new panel names.
MCPForUnity/Editor/Windows/MCPForUnityEditorWindow.cs
MCPForUnity/Editor/Windows/MCPForUnityEditorWindow.uxml
MCPForUnity/Editor/Windows/MCPForUnityEditorWindow.uss
Split the monolithic Settings section into dedicated Advanced and Validation sections, with Advanced handling path overrides, deployment, debug/dev controls, and health, and Validation handling script validation level.
  • Renamed and refactored McpSettingsSection into McpAdvancedSection, removing validation responsibilities and focusing on uvx/git overrides, dev-mode flags, deployment, debug logging, and bridge health display and test button.
  • Introduced McpValidationSection controller and UXML to manage validation level selection, persistence via EditorPrefs, and descriptive copy for each level.
  • Updated editor window wiring so Advanced and Validation sections load from their own UXML files and events (git URL changed, HTTP command update, test connection) are routed appropriately.
MCPForUnity/Editor/Windows/Components/Advanced/McpAdvancedSection.cs
MCPForUnity/Editor/Windows/Components/Advanced/McpAdvancedSection.uxml
MCPForUnity/Editor/Windows/Components/Validation/McpValidationSection.cs
MCPForUnity/Editor/Windows/Components/Validation/McpValidationSection.uxml
MCPForUnity/Editor/Windows/Components/Advanced.meta
MCPForUnity/Editor/Windows/Components/Advanced/McpAdvancedSection.cs.meta
MCPForUnity/Editor/Windows/Components/Advanced/McpAdvancedSection.uxml.meta
MCPForUnity/Editor/Windows/Components/Validation.meta
MCPForUnity/Editor/Windows/Components/Validation/McpValidationSection.cs.meta
MCPForUnity/Editor/Windows/Components/Validation/McpValidationSection.uxml.meta
Improved connection section UI, moved health indicators into Advanced, and added a transport mismatch banner API.
  • Cached new UI references in McpConnectionSection (transport mismatch banner, HTTP control row, manual command foldout) and initialized tooltips and foldout defaults.
  • Removed project-scoped tools toggle and health indicator UI from the connection section, delegating health updates via a callback into the Advanced section.
  • Implemented UpdateTransportMismatchWarning and ClearTransportMismatchWarning methods to show/hide a banner when a client transport type conflicts with the current server transport setting.
MCPForUnity/Editor/Windows/Components/Connection/McpConnectionSection.cs
MCPForUnity/Editor/Windows/Components/Connection/McpConnectionSection.uxml
MCPForUnity/Editor/Windows/Components/Common.uss
Added transport type tracking to MCP clients and configurators and wired it into the client config UI for mismatch detection.
  • Extended McpStatus model with a ConfiguredTransport enum and added configuredTransport field to McpClient plus interface/property plumbing through IMcpClientConfigurator and McpClientConfiguratorBase.
  • In each configurator path, inferred the configured transport (HTTP vs stdio) from config files, URLs/args, or external tool output and kept configuredTransport in sync when auto-configuring, registering, unregistering, or on error.
  • Updated McpClientConfigSection to surface transport mismatch as a warning status in the client status pill and raise an OnClientTransportDetected event consumed by the connection section to update its mismatch banner.
MCPForUnity/Editor/Models/McpStatus.cs
MCPForUnity/Editor/Models/McpClient.cs
MCPForUnity/Editor/Clients/IMcpClientConfigurator.cs
MCPForUnity/Editor/Clients/McpClientConfiguratorBase.cs
MCPForUnity/Editor/Windows/Components/ClientConfig/McpClientConfigSection.cs
Rehomed project-scoped tools configuration from the Connection section into the Tools section and enriched the tools UI.
  • Moved the project-scoped tools toggle from the connection UI into McpToolsSection, where it now reads/writes EditorPrefs and exposes a descriptive tooltip.
  • Ensured tool toggles are still discovered and wired as before, while keeping tools-related preferences localized to the tools tab.
MCPForUnity/Editor/Windows/Components/Connection/McpConnectionSection.cs
MCPForUnity/Editor/Windows/Components/Tools/McpToolsSection.cs
MCPForUnity/Editor/Windows/Components/Tools/McpToolsSection.uxml
Polished shared UI styling, header, and layout behavior for the editor window and sections.
  • Updated header to include a version label bound from the editor window and added space for update notifications.
  • Adjusted panel padding, borders, foldout defaults, and tab styles in UXML/USS to create a cleaner, more compact layout consistent across Clients, Validation, Advanced, and Tools.
  • Set flex/shrink behavior and tooltips across various controls to prevent clipping and improve usability, and reduced the minimum window height to make the window more compact.
MCPForUnity/Editor/Windows/MCPForUnityEditorWindow.uxml
MCPForUnity/Editor/Windows/MCPForUnityEditorWindow.uss
MCPForUnity/Editor/Windows/Components/Common.uss
MCPForUnity/Editor/Windows/Components/ClientConfig/McpClientConfigSection.uxml
MCPForUnity/Editor/Windows/Components/Tools/McpToolsSection.uxml
Miscellaneous cleanups and minor fixes.
  • Wrapped uses of obsolete EditorUtility.InstanceIDToObject in warning suppression pragmas in GameObjectLookup.
  • Added a url field to MCP config server model to capture HTTP endpoint in serialized configs.
MCPForUnity/Editor/Helpers/GameObjectLookup.cs
MCPForUnity/Editor/Models/MCPConfigServer.cs

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

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 found 1 issue, and left some high level feedback:

  • In MCPForUnityEditorWindow.CreateGUI, the OnTestConnectionRequested handler uses await connectionSection?.VerifyBridgeConnectionAsync(); – if connectionSection is null this will await a null Task and throw; consider guarding with a null check before awaiting or using a non-nullable local reference.
  • In McpConnectionSection.VerifyBridgeConnectionInternalAsync and McpAdvancedSection.UpdateHealthStatus, the health state is coordinated via the literal string "Unknown"; it would be more robust to share a constant or an enum for health state to avoid subtle bugs from string mismatches.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- In `MCPForUnityEditorWindow.CreateGUI`, the `OnTestConnectionRequested` handler uses `await connectionSection?.VerifyBridgeConnectionAsync();` – if `connectionSection` is null this will await a null `Task` and throw; consider guarding with a null check before awaiting or using a non-nullable local reference.
- In `McpConnectionSection.VerifyBridgeConnectionInternalAsync` and `McpAdvancedSection.UpdateHealthStatus`, the health state is coordinated via the literal string "Unknown"; it would be more robust to share a constant or an enum for health state to avoid subtle bugs from string mismatches.

## Individual Comments

### Comment 1
<location> `MCPForUnity/Editor/Windows/MCPForUnityEditorWindow.cs:250-251` </location>
<code_context>
+                    clientConfigSection?.UpdateManualConfiguration();
+                advancedSection.OnHttpServerCommandUpdateRequested += () =>
+                    connectionSection?.UpdateHttpServerCommandDisplay();
+                advancedSection.OnTestConnectionRequested += async () =>
+                    await connectionSection?.VerifyBridgeConnectionAsync();
+
+                // Wire up health status updates from Connection to Advanced
</code_context>

<issue_to_address>
**issue (bug_risk):** Avoid awaiting a potentially null Task from a null-conditional invocation.

Due to the null-conditional, `connectionSection?.VerifyBridgeConnectionAsync()` can evaluate to `null` when `connectionSection` is uninitialized, and `await null` will throw at runtime. Capture `connectionSection` into a local and guard before awaiting, for example:

```csharp
advancedSection.OnTestConnectionRequested += async () =>
{
    var connection = connectionSection;
    if (connection != null)
    {
        await connection.VerifyBridgeConnectionAsync();
    }
};
```
</issue_to_address>

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.

- Fixed null Task await in MCPForUnityEditorWindow.CreateGUI (line 251)
  - Added proper null check before awaiting connectionSection?.VerifyBridgeConnectionAsync()
  - Prevents NullReferenceException when connectionSection is null

- Replaced magic string health status values with shared constants
  - Created new HealthStatus class with constants: Unknown, Healthy, PingFailed, Unhealthy
  - Updated McpConnectionSection to use shared constants instead of private ones
  - Updated McpAdvancedSection to use HealthStatus.Unknown constant
  - More robust coordination between Connection and Advanced sections

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
@dsarno dsarno merged commit cb1a7dd into CoplayDev:beta Jan 23, 2026
2 checks passed
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.

1 participant