Skip to content

Commit bbf6cac

Browse files
authored
Remove old UI and do lots of cleanup (#340)
* Remove legacy UI and correct priority ordering of menu items * Remove old UI screen Users now have the new UI alone, less confusing and more predictable * Remove unused config files * Remove test for window that doesn't exist * Remove unused code * Remove dangling .meta file * refactor: remove client configuration step from setup wizard * refactor: remove menu item attributes and manual window actions from Python tool sync * feat: update minimum Python version requirement from 3.10 to 3.11 The docs have 3.12. However, feature wise it seems that 3.11 is required * fix: replace emoji warning symbol with unicode character in setup wizard dialogs * docs: reorganize images into docs/images directory and update references * docs: add UI preview image to README * docs: add run_test function and resources section to available tools list The recent changes should close #311 * fix: add SystemRoot env var to Windows config to support Python path resolution Closes #315 * refactor: consolidate package installation and detection into unified lifecycle manager Duplicate code for pretty much no reason, as they both initialized there was a small chance of a race condition as well. Consolidating made sense here * Doc fixes from CodeRabbit * Excellent bug catch from CodeRabbit * fix: preserve existing environment variables when updating codex server config * Update docs so the paths match the original name * style: fix list indentation in README-DEV.md development docs * refactor: simplify env table handling in CodexConfigHelper by removing preservation logic * refactor: simplify configuration logic by removing redundant change detection Always overwrite configs * feat: ensure config directory exists before writing config files * feat: persist server installation errors and show retry UI instead of auto-marking as handled * refactor: consolidate configuration helpers by merging McpConfigFileHelper into McpConfigurationHelper * Small fixes from CodeRabbit * Remove test because we overwrite Codex configs * Remove unused function * feat: improve server cleanup and process handling on Windows - Added DeleteDirectoryWithRetry helper to handle Windows file locking with retries and readonly attribute clearing - Implemented KillWindowsUvProcesses to safely terminate Python processes in virtual environments using WMIC - Extended TryKillUvForPath to work on Windows, preventing file handle locks during server deletion - Improved error messages to be more descriptive about file locking issues - Replaced direct Directory.Delete calls with * fix: improve TCP socket cleanup to prevent CLOSE_WAIT states - Added proper socket shutdown sequence using Socket.Shutdown() before closing connections - Enhanced error handling with specific catches for SocketException vs general exceptions - Added debug logging for socket shutdown errors to help diagnose connection issues - Restructured HandleClientAsync to ensure socket cleanup happens in the correct order - Implemented proper socket teardown in both client handling and connection cleanup paths
1 parent 9796f8e commit bbf6cac

File tree

68 files changed

+2602
-4117
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

68 files changed

+2602
-4117
lines changed

MCPForUnity/Editor/Data/DefaultServerConfig.cs

Lines changed: 0 additions & 17 deletions
This file was deleted.

MCPForUnity/Editor/Dependencies/DependencyManager.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ private static void GenerateRecommendations(DependencyCheckResult result, IPlatf
126126
{
127127
if (dep.Name == "Python")
128128
{
129-
result.RecommendedActions.Add($"Install Python 3.10+ from: {detector.GetPythonInstallUrl()}");
129+
result.RecommendedActions.Add($"Install Python 3.11+ from: {detector.GetPythonInstallUrl()}");
130130
}
131131
else if (dep.Name == "UV Package Manager")
132132
{

MCPForUnity/Editor/Dependencies/PlatformDetectors/LinuxPlatformDetector.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ public override DependencyStatus DetectPython()
6262
}
6363
}
6464

65-
status.ErrorMessage = "Python not found. Please install Python 3.10 or later.";
65+
status.ErrorMessage = "Python not found. Please install Python 3.11 or later.";
6666
status.Details = "Checked common installation paths including system, snap, and user-local locations.";
6767
}
6868
catch (Exception ex)
@@ -144,10 +144,10 @@ private bool TryValidatePython(string pythonPath, out string version, out string
144144
version = output.Substring(7); // Remove "Python " prefix
145145
fullPath = pythonPath;
146146

147-
// Validate minimum version (Python 4+ or Python 3.10+)
147+
// Validate minimum version (Python 4+ or Python 3.11+)
148148
if (TryParseVersion(version, out var major, out var minor))
149149
{
150-
return major > 3 || (major >= 3 && minor >= 10);
150+
return major > 3 || (major >= 3 && minor >= 11);
151151
}
152152
}
153153
}

MCPForUnity/Editor/Dependencies/PlatformDetectors/MacOSPlatformDetector.cs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,7 @@ public override DependencyStatus DetectPython()
3535
"/opt/homebrew/bin/python3",
3636
"/Library/Frameworks/Python.framework/Versions/3.13/bin/python3",
3737
"/Library/Frameworks/Python.framework/Versions/3.12/bin/python3",
38-
"/Library/Frameworks/Python.framework/Versions/3.11/bin/python3",
39-
"/Library/Frameworks/Python.framework/Versions/3.10/bin/python3"
38+
"/Library/Frameworks/Python.framework/Versions/3.11/bin/python3"
4039
};
4140

4241
foreach (var candidate in candidates)
@@ -65,7 +64,7 @@ public override DependencyStatus DetectPython()
6564
}
6665
}
6766

68-
status.ErrorMessage = "Python not found. Please install Python 3.10 or later.";
67+
status.ErrorMessage = "Python not found. Please install Python 3.11 or later.";
6968
status.Details = "Checked common installation paths including Homebrew, Framework, and system locations.";
7069
}
7170
catch (Exception ex)
@@ -144,10 +143,10 @@ private bool TryValidatePython(string pythonPath, out string version, out string
144143
version = output.Substring(7); // Remove "Python " prefix
145144
fullPath = pythonPath;
146145

147-
// Validate minimum version (Python 4+ or Python 3.10+)
146+
// Validate minimum version (Python 4+ or Python 3.11+)
148147
if (TryParseVersion(version, out var major, out var minor))
149148
{
150-
return major > 3 || (major >= 3 && minor >= 10);
149+
return major > 3 || (major >= 3 && minor >= 11);
151150
}
152151
}
153152
}

MCPForUnity/Editor/Dependencies/PlatformDetectors/WindowsPlatformDetector.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ public override DependencyStatus DetectPython()
6868
}
6969
}
7070

71-
status.ErrorMessage = "Python not found. Please install Python 3.10 or later.";
71+
status.ErrorMessage = "Python not found. Please install Python 3.11 or later.";
7272
status.Details = "Checked common installation paths and PATH environment variable.";
7373
}
7474
catch (Exception ex)
@@ -132,10 +132,10 @@ private bool TryValidatePython(string pythonPath, out string version, out string
132132
version = output.Substring(7); // Remove "Python " prefix
133133
fullPath = pythonPath;
134134

135-
// Validate minimum version (Python 4+ or Python 3.10+)
135+
// Validate minimum version (Python 4+ or Python 3.11+)
136136
if (TryParseVersion(version, out var major, out var minor))
137137
{
138-
return major > 3 || (major >= 3 && minor >= 10);
138+
return major > 3 || (major >= 3 && minor >= 11);
139139
}
140140
}
141141
}

MCPForUnity/Editor/Helpers/CodexConfigHelper.cs

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
using System.IO;
44
using System.Linq;
55
using MCPForUnity.External.Tommy;
6+
using MCPForUnity.Editor.Services;
67

78
namespace MCPForUnity.Editor.Helpers
89
{
@@ -26,10 +27,10 @@ public static bool IsCodexConfigured(string pythonDir)
2627
string toml = File.ReadAllText(configPath);
2728
if (!TryParseCodexServer(toml, out _, out var args)) return false;
2829

29-
string dir = McpConfigFileHelper.ExtractDirectoryArg(args);
30+
string dir = McpConfigurationHelper.ExtractDirectoryArg(args);
3031
if (string.IsNullOrEmpty(dir)) return false;
3132

32-
return McpConfigFileHelper.PathsEqual(dir, pythonDir);
33+
return McpConfigurationHelper.PathsEqual(dir, pythonDir);
3334
}
3435
catch
3536
{
@@ -125,6 +126,8 @@ private static TomlTable TryParseToml(string toml)
125126
/// <summary>
126127
/// Creates a TomlTable for the unityMCP server configuration
127128
/// </summary>
129+
/// <param name="uvPath">Path to uv executable</param>
130+
/// <param name="serverSrc">Path to server source directory</param>
128131
private static TomlTable CreateUnityMcpTable(string uvPath, string serverSrc)
129132
{
130133
var unityMCP = new TomlTable();
@@ -137,6 +140,15 @@ private static TomlTable CreateUnityMcpTable(string uvPath, string serverSrc)
137140
argsArray.Add(new TomlString { Value = "server.py" });
138141
unityMCP["args"] = argsArray;
139142

143+
// Add Windows-specific environment configuration, see: https://github.com/CoplayDev/unity-mcp/issues/315
144+
var platformService = MCPServiceLocator.Platform;
145+
if (platformService.IsWindows())
146+
{
147+
var envTable = new TomlTable { IsInline = true };
148+
envTable["SystemRoot"] = new TomlString { Value = platformService.GetSystemRoot() };
149+
unityMCP["env"] = envTable;
150+
}
151+
140152
return unityMCP;
141153
}
142154

MCPForUnity/Editor/Helpers/McpConfigFileHelper.cs

Lines changed: 0 additions & 186 deletions
This file was deleted.

0 commit comments

Comments
 (0)