updated server to start on localhost

main
Justin Barnett 2025-03-18 13:10:06 -04:00
parent 20aa6839fe
commit a3493a49d9
1 changed files with 8 additions and 1 deletions

View File

@ -51,7 +51,7 @@ public class MCPConfigServer
public class ServerConfig public class ServerConfig
{ {
[JsonProperty("unity_host")] [JsonProperty("unity_host")]
public string unityHost; public string unityHost = "localhost";
[JsonProperty("unity_port")] [JsonProperty("unity_port")]
public int unityPort; public int unityPort;
@ -147,6 +147,13 @@ public class MCPEditorWindow : EditorWindow
LoadServerConfig(); // Reload config if not loaded 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 try
{ {
using (var client = new TcpClient()) using (var client = new TcpClient())