From 1cc582636d97cf896a41f0bef876ccb0d0ca3f8b Mon Sep 17 00:00:00 2001 From: Alex Hvesuk Date: Wed, 21 Jan 2026 22:14:13 +0400 Subject: [PATCH] Add localhost setup feedback and remove UI issues (#587) --- MCPForUnity/Editor/Windows/Components/Common.uss | 5 +++++ .../Components/Connection/McpConnectionSection.cs | 14 +++++++++++--- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/MCPForUnity/Editor/Windows/Components/Common.uss b/MCPForUnity/Editor/Windows/Components/Common.uss index e1633e6..5aa6e98 100644 --- a/MCPForUnity/Editor/Windows/Components/Common.uss +++ b/MCPForUnity/Editor/Windows/Components/Common.uss @@ -437,6 +437,11 @@ margin-bottom: 4px; } +.help-text.error { + color: rgba(255, 80, 80, 1); + -unity-font-style: bold; +} + .path-override-controls { flex-direction: row; align-items: center; diff --git a/MCPForUnity/Editor/Windows/Components/Connection/McpConnectionSection.cs b/MCPForUnity/Editor/Windows/Components/Connection/McpConnectionSection.cs index e984721..782ed7b 100644 --- a/MCPForUnity/Editor/Windows/Components/Connection/McpConnectionSection.cs +++ b/MCPForUnity/Editor/Windows/Components/Connection/McpConnectionSection.cs @@ -435,16 +435,24 @@ namespace MCPForUnity.Editor.Windows.Components.Connection if (!isLocalHttpUrl) { - httpServerCommandField.value = string.Empty; - httpServerCommandField.tooltip = string.Empty; + httpServerCommandField.value = ""; + httpServerCommandField.tooltip = "The command cannot be generated because the URL is not a local address."; + httpServerCommandSection.EnableInClassList("invalid-url", true); if (httpServerCommandHint != null) { - httpServerCommandHint.text = "HTTP Local requires a localhost URL (localhost/127.0.0.1/0.0.0.0/::1)."; + httpServerCommandHint.text = "⚠ HTTP Local requires a localhost URL (localhost/127.0.0.1/0.0.0.0/::1)."; + httpServerCommandHint.AddToClassList("error"); } copyHttpServerCommandButton?.SetEnabled(false); return; } + httpServerCommandSection.EnableInClassList("invalid-url", false); + if (httpServerCommandHint != null) + { + httpServerCommandHint.RemoveFromClassList("error"); + } + if (MCPServiceLocator.Server.TryGetLocalHttpServerCommand(out var command, out var error)) { httpServerCommandField.value = command;