Skip to content

Conversation

@hvesuk
Copy link

@hvesuk hvesuk commented Jan 19, 2026

Summary

  • Fixed command field shrinking to zero height
  • Added red error text and hints when an invalid URL is used in "HTTP Local" mode

Test plan

  1. Select HTTP Local transport
  2. Enter a non-localhost URL
  3. Verify that the command field stays visible and a red error message appears

Before

Unity_fGyoGaYp33

After

Unity_6C2dO0r7WJ

Summary by Sourcery

Improve HTTP Local connection UI handling for invalid localhost URLs and maintain visibility of the command field.

Bug Fixes:

  • Prevent the HTTP server command field from collapsing when the configured HTTP Local URL is invalid or non-localhost.

Enhancements:

  • Show an explicit invalid localhost URL placeholder, tooltip, and styled warning hint when the HTTP Local URL is not a local address.

Summary by CodeRabbit

Release Notes

  • Bug Fixes

    • Enhanced HTTP connection validation to provide clear visual feedback for invalid localhost URLs, including descriptive error messages and warning symbols.
    • Copy button is automatically disabled when an invalid URL is detected.
    • Improved state management to properly clear validation errors when switching back to valid URLs.
  • Style

    • Added enhanced error styling for help text elements to improve visibility and distinguish error states.

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

@sourcery-ai
Copy link
Contributor

sourcery-ai bot commented Jan 19, 2026

Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Adjusts the HTTP Local connection command UI to stay visible and provide clearer feedback when the URL is invalid, by changing the command field content, enabling/disabling styles and buttons, and adding error styling for hints and section layout.

Class diagram for updated McpConnectionSection HTTP Local behavior

classDiagram
    class McpConnectionSection {
        - httpServerCommandField
        - httpServerCommandSection
        - httpServerCommandHint
        - copyHttpServerCommandButton
        + UpdateHttpServerCommandDisplay()
    }

    class HttpServerCommandField {
        + string value
        + string tooltip
    }

    class HttpServerCommandSection {
        + EnableInClassList(className bool)
    }

    class HttpServerCommandHint {
        + string text
        + AddToClassList(className)
        + RemoveFromClassList(className)
    }

    class CopyHttpServerCommandButton {
        + SetEnabled(isEnabled)
    }

    McpConnectionSection --> HttpServerCommandField : uses
    McpConnectionSection --> HttpServerCommandSection : uses
    McpConnectionSection --> HttpServerCommandHint : uses
    McpConnectionSection --> CopyHttpServerCommandButton : uses
Loading

Flow diagram for HTTP Local command UI update on URL validation

flowchart TD
    A_start[Start UpdateHttpServerCommandDisplay] --> B_checkUrl[Check isLocalHttpUrl]
    B_checkUrl -->|false| C_invalid[Set command field to <Invalid Localhost URL>]
    C_invalid --> D_setTooltip[Set tooltip to explain non local address]
    D_setTooltip --> E_markSectionInvalid[Enable invalid-url class on command section]
    E_markSectionInvalid --> F_hintExists{httpServerCommandHint != null}
    F_hintExists -->|yes| G_setHintText[Set hint text with warning and localhost requirement]
    G_setHintText --> H_markHintError[Add error class to hint]
    H_markHintError --> I_disableCopy[Disable copy command button]
    F_hintExists -->|no| I_disableCopy
    I_disableCopy --> J_return[Return]

    B_checkUrl -->|true| K_clearInvalid[Disable invalid-url class on command section]
    K_clearInvalid --> L_hintExists2{httpServerCommandHint != null}
    L_hintExists2 -->|yes| M_clearHintError[Remove error class from hint]
    L_hintExists2 -->|no| N_continue[Continue]
    M_clearHintError --> N_continue
    N_continue --> O_tryGetCommand[Try MCPServiceLocator.Server.TryGetLocalHttpServerCommand]
    O_tryGetCommand --> P_updateField[Update command field or show server error]
    P_updateField --> Q_end[End UpdateHttpServerCommandDisplay]
Loading

File-Level Changes

Change Details Files
Improve invalid URL handling for HTTP Local command generation, including field placeholder text, tooltip, section styling, and error hint styling.
  • When the HTTP Local URL is not local, populate the command field with a placeholder indicating an invalid localhost URL instead of clearing it
  • Set a descriptive tooltip explaining why the command cannot be generated for non-local URLs
  • Toggle an invalid-url class on the HTTP server command section based on URL validity
  • Add an error prefix and apply an error USS class to the HTTP server command hint when the URL is invalid, and remove the error class when it becomes valid again
  • Keep the copy command button disabled when the URL is invalid
MCPForUnity/Editor/Windows/Components/Connection/McpConnectionSection.cs
Adjust USS styles for the connection section to prevent the HTTP command field from collapsing and to visually indicate invalid URL state.
  • Update layout and sizing rules so the HTTP server command field maintains a visible height even when the command cannot be generated
  • Add styling for the invalid-url state on the HTTP server command section to support the new error display
  • Define or adjust styling for the error class used by the HTTP server command hint text, including red error text
MCPForUnity/Editor/Windows/Components/Common.uss

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 19, 2026

📝 Walkthrough

Walkthrough

CSS styling for error states is added to support visual error feedback. HTTP Local URL validation now checks if the URL is valid and displays error indicators (warning symbol, disabled field, error styling) when an invalid localhost URL is detected.

Changes

Cohort / File(s) Summary
UI Error Styling
MCPForUnity/Editor/Windows/Components/Common.uss
Introduces new .help-text.error CSS class with red color and bold font styling for visual error indication
HTTP Local Validation
MCPForUnity/Editor/Windows/Components/Connection/McpConnectionSection.cs
Adds validation logic to detect invalid localhost URLs; displays error state with placeholder text, warning symbol, disabled copy button, and error class on hint; clears error state when valid local URL is restored

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐰 A rabbit's delight in error display,
With red-hued hints to show the way!
"Invalid localhost?" the warning does cry,
With ⚠ and bold text reaching up high!
Validation's a breeze when the state's set just right! ✨

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% 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
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main changes: fixing connection field sizing and adding URL error hints, which aligns with the CSS styling additions and error state handling in the code changes.

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

@hvesuk
Copy link
Author

hvesuk commented Jan 19, 2026

Hi @dsarno! Another small UI correction

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:

  • Using the literal value "" in the command field may confuse users or be mistaken for an actual command; consider keeping the field empty/disabled and surfacing the error only via the hint/label and styling instead.
  • The warning symbol ("⚠") added to the hint is a user-facing glyph; if you already have an icon system or standard warning style in the UI, consider reusing that instead of embedding a Unicode character in the text.
  • The new CSS classes ("invalid-url" and "error") are quite generic; if they’re only used for this HTTP Local URL case, consider renaming them to something more specific (e.g., "http-local-invalid-url") to avoid style collisions and clarify intent.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- Using the literal value "<Invalid Localhost URL>" in the command field may confuse users or be mistaken for an actual command; consider keeping the field empty/disabled and surfacing the error only via the hint/label and styling instead.
- The warning symbol ("⚠") added to the hint is a user-facing glyph; if you already have an icon system or standard warning style in the UI, consider reusing that instead of embedding a Unicode character in the text.
- The new CSS classes ("invalid-url" and "error") are quite generic; if they’re only used for this HTTP Local URL case, consider renaming them to something more specific (e.g., "http-local-invalid-url") to avoid style collisions and clarify intent.

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.

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