Skip to content

Commit 1cc5826

Browse files
authored
Add localhost setup feedback and remove UI issues (#587)
1 parent abd596f commit 1cc5826

2 files changed

Lines changed: 16 additions & 3 deletions

File tree

MCPForUnity/Editor/Windows/Components/Common.uss

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -437,6 +437,11 @@
437437
margin-bottom: 4px;
438438
}
439439

440+
.help-text.error {
441+
color: rgba(255, 80, 80, 1);
442+
-unity-font-style: bold;
443+
}
444+
440445
.path-override-controls {
441446
flex-direction: row;
442447
align-items: center;

MCPForUnity/Editor/Windows/Components/Connection/McpConnectionSection.cs

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -435,16 +435,24 @@ public void UpdateHttpServerCommandDisplay()
435435

436436
if (!isLocalHttpUrl)
437437
{
438-
httpServerCommandField.value = string.Empty;
439-
httpServerCommandField.tooltip = string.Empty;
438+
httpServerCommandField.value = "<Invalid Localhost URL>";
439+
httpServerCommandField.tooltip = "The command cannot be generated because the URL is not a local address.";
440+
httpServerCommandSection.EnableInClassList("invalid-url", true);
440441
if (httpServerCommandHint != null)
441442
{
442-
httpServerCommandHint.text = "HTTP Local requires a localhost URL (localhost/127.0.0.1/0.0.0.0/::1).";
443+
httpServerCommandHint.text = "⚠ HTTP Local requires a localhost URL (localhost/127.0.0.1/0.0.0.0/::1).";
444+
httpServerCommandHint.AddToClassList("error");
443445
}
444446
copyHttpServerCommandButton?.SetEnabled(false);
445447
return;
446448
}
447449

450+
httpServerCommandSection.EnableInClassList("invalid-url", false);
451+
if (httpServerCommandHint != null)
452+
{
453+
httpServerCommandHint.RemoveFromClassList("error");
454+
}
455+
448456
if (MCPServiceLocator.Server.TryGetLocalHttpServerCommand(out var command, out var error))
449457
{
450458
httpServerCommandField.value = command;

0 commit comments

Comments
 (0)