diff --git a/UnityMcpBridge/Editor/Helpers/ExecPath.cs b/UnityMcpBridge/Editor/Helpers/ExecPath.cs index 4403b69..ab55fd6 100644 --- a/UnityMcpBridge/Editor/Helpers/ExecPath.cs +++ b/UnityMcpBridge/Editor/Helpers/ExecPath.cs @@ -101,7 +101,14 @@ namespace UnityMcpBridge.Editor.Helpers if (string.IsNullOrEmpty(name)) continue; if (name.StartsWith("v", StringComparison.OrdinalIgnoreCase)) { - if (Version.TryParse(name.Substring(1), out Version parsed)) + // Extract numeric portion: e.g., v18.19.0-nightly -> 18.19.0 + string versionStr = name.Substring(1); + int dashIndex = versionStr.IndexOf('-'); + if (dashIndex > 0) + { + versionStr = versionStr.Substring(0, dashIndex); + } + if (Version.TryParse(versionStr, out Version parsed)) { string candidate = Path.Combine(versionDir, "bin", "claude"); if (File.Exists(candidate)) diff --git a/UnityMcpBridge/Editor/Models/MCPConfigServer.cs b/UnityMcpBridge/Editor/Models/MCPConfigServer.cs index edc0de2..2c2596f 100644 --- a/UnityMcpBridge/Editor/Models/MCPConfigServer.cs +++ b/UnityMcpBridge/Editor/Models/MCPConfigServer.cs @@ -12,8 +12,8 @@ namespace UnityMcpBridge.Editor.Models [JsonProperty("args")] public string[] args; - // VSCode expects a transport type; default to stdio for compatibility + // VSCode expects a transport type; include only when explicitly set [JsonProperty("type", NullValueHandling = NullValueHandling.Ignore)] - public string type = "stdio"; + public string type; } } diff --git a/UnityMcpBridge/Editor/Windows/UnityMcpEditorWindow.cs b/UnityMcpBridge/Editor/Windows/UnityMcpEditorWindow.cs index 5b16e25..587eb54 100644 --- a/UnityMcpBridge/Editor/Windows/UnityMcpEditorWindow.cs +++ b/UnityMcpBridge/Editor/Windows/UnityMcpEditorWindow.cs @@ -739,7 +739,7 @@ namespace UnityMcpBridge.Editor.Windows EditorGUILayout.LabelField(installText, installHintStyle, GUILayout.Height(22), GUILayout.Width(textSize.x + 2), GUILayout.ExpandWidth(false)); GUIStyle helpLinkStyle = new GUIStyle(EditorStyles.linkLabel) { fontStyle = FontStyle.Bold }; GUILayout.Space(6); - if (GUILayout.Button("[CLICK]", helpLinkStyle, GUILayout.Height(22), GUILayout.ExpandWidth(false))) + if (GUILayout.Button("[HELP]", helpLinkStyle, GUILayout.Height(22), GUILayout.ExpandWidth(false))) { Application.OpenURL("https://github.com/CoplayDev/unity-mcp/wiki/Troubleshooting-Unity-MCP-and-Claude-Code"); } @@ -764,7 +764,7 @@ namespace UnityMcpBridge.Editor.Windows EditorGUILayout.LabelField(installText2, installHintStyle2, GUILayout.Height(22), GUILayout.Width(sz.x + 2), GUILayout.ExpandWidth(false)); GUIStyle helpLinkStyle2 = new GUIStyle(EditorStyles.linkLabel) { fontStyle = FontStyle.Bold }; GUILayout.Space(6); - if (GUILayout.Button("[CLICK]", helpLinkStyle2, GUILayout.Height(22), GUILayout.ExpandWidth(false))) + if (GUILayout.Button("[HELP]", helpLinkStyle2, GUILayout.Height(22), GUILayout.ExpandWidth(false))) { Application.OpenURL("https://github.com/CoplayDev/unity-mcp/wiki/Troubleshooting-Unity-MCP-and-Cursor,-VSCode-&-Windsurf"); } @@ -1050,22 +1050,29 @@ namespace UnityMcpBridge.Editor.Windows // Use switch statement to handle different client types switch (mcpClient.mcpType) { - case McpTypes.VSCode: - // Create VSCode-specific configuration with proper format - var vscodeConfig = new - { - servers = new - { - unityMCP = new - { - command = "uv", - args = new[] { "--directory", pythonDir, "run", "server.py" }, - type = "stdio" - } - } - }; - manualConfigJson = JsonConvert.SerializeObject(vscodeConfig, jsonSettings); - break; + case McpTypes.VSCode: + // Resolve uv so VSCode launches the correct executable even if not on PATH + string uvPathManual = FindUvPath(); + if (uvPathManual == null) + { + UnityEngine.Debug.LogError("UV package manager not found. Cannot generate manual configuration."); + return; + } + // Create VSCode-specific configuration with proper format + var vscodeConfig = new + { + servers = new + { + unityMCP = new + { + command = uvPathManual, + args = new[] { "--directory", pythonDir, "run", "server.py" }, + type = "stdio" + } + } + }; + manualConfigJson = JsonConvert.SerializeObject(vscodeConfig, jsonSettings); + break; default: // Create standard MCP configuration for other clients