From a3493a49d9a911ea5cbf0bf116fcc40a5b474174 Mon Sep 17 00:00:00 2001 From: Justin Barnett Date: Tue, 18 Mar 2025 13:10:06 -0400 Subject: [PATCH] updated server to start on localhost --- Editor/MCPEditorWindow.cs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/Editor/MCPEditorWindow.cs b/Editor/MCPEditorWindow.cs index 07a1c0c..a338829 100644 --- a/Editor/MCPEditorWindow.cs +++ b/Editor/MCPEditorWindow.cs @@ -51,7 +51,7 @@ public class MCPConfigServer public class ServerConfig { [JsonProperty("unity_host")] - public string unityHost; + public string unityHost = "localhost"; [JsonProperty("unity_port")] public int unityPort; @@ -147,6 +147,13 @@ public class MCPEditorWindow : EditorWindow LoadServerConfig(); // Reload config if not loaded } + // Validate host is not null + if (string.IsNullOrEmpty(serverConfig.unityHost)) + { + serverConfig.unityHost = "localhost"; // Fallback to localhost if null + UnityEngine.Debug.LogWarning("Unity host was null, defaulting to localhost"); + } + try { using (var client = new TcpClient())