VSCode manual config: use resolved uv path; VSCode parse init guards; NVM version parse robustness; help labels [HELP]
parent
eb7b2e952e
commit
a52ce7a219
|
|
@ -101,7 +101,14 @@ namespace UnityMcpBridge.Editor.Helpers
|
||||||
if (string.IsNullOrEmpty(name)) continue;
|
if (string.IsNullOrEmpty(name)) continue;
|
||||||
if (name.StartsWith("v", StringComparison.OrdinalIgnoreCase))
|
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");
|
string candidate = Path.Combine(versionDir, "bin", "claude");
|
||||||
if (File.Exists(candidate))
|
if (File.Exists(candidate))
|
||||||
|
|
|
||||||
|
|
@ -12,8 +12,8 @@ namespace UnityMcpBridge.Editor.Models
|
||||||
[JsonProperty("args")]
|
[JsonProperty("args")]
|
||||||
public string[] 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)]
|
[JsonProperty("type", NullValueHandling = NullValueHandling.Ignore)]
|
||||||
public string type = "stdio";
|
public string type;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -739,7 +739,7 @@ namespace UnityMcpBridge.Editor.Windows
|
||||||
EditorGUILayout.LabelField(installText, installHintStyle, GUILayout.Height(22), GUILayout.Width(textSize.x + 2), GUILayout.ExpandWidth(false));
|
EditorGUILayout.LabelField(installText, installHintStyle, GUILayout.Height(22), GUILayout.Width(textSize.x + 2), GUILayout.ExpandWidth(false));
|
||||||
GUIStyle helpLinkStyle = new GUIStyle(EditorStyles.linkLabel) { fontStyle = FontStyle.Bold };
|
GUIStyle helpLinkStyle = new GUIStyle(EditorStyles.linkLabel) { fontStyle = FontStyle.Bold };
|
||||||
GUILayout.Space(6);
|
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");
|
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));
|
EditorGUILayout.LabelField(installText2, installHintStyle2, GUILayout.Height(22), GUILayout.Width(sz.x + 2), GUILayout.ExpandWidth(false));
|
||||||
GUIStyle helpLinkStyle2 = new GUIStyle(EditorStyles.linkLabel) { fontStyle = FontStyle.Bold };
|
GUIStyle helpLinkStyle2 = new GUIStyle(EditorStyles.linkLabel) { fontStyle = FontStyle.Bold };
|
||||||
GUILayout.Space(6);
|
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");
|
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
|
// Use switch statement to handle different client types
|
||||||
switch (mcpClient.mcpType)
|
switch (mcpClient.mcpType)
|
||||||
{
|
{
|
||||||
case McpTypes.VSCode:
|
case McpTypes.VSCode:
|
||||||
// Create VSCode-specific configuration with proper format
|
// Resolve uv so VSCode launches the correct executable even if not on PATH
|
||||||
var vscodeConfig = new
|
string uvPathManual = FindUvPath();
|
||||||
{
|
if (uvPathManual == null)
|
||||||
servers = new
|
{
|
||||||
{
|
UnityEngine.Debug.LogError("UV package manager not found. Cannot generate manual configuration.");
|
||||||
unityMCP = new
|
return;
|
||||||
{
|
}
|
||||||
command = "uv",
|
// Create VSCode-specific configuration with proper format
|
||||||
args = new[] { "--directory", pythonDir, "run", "server.py" },
|
var vscodeConfig = new
|
||||||
type = "stdio"
|
{
|
||||||
}
|
servers = new
|
||||||
}
|
{
|
||||||
};
|
unityMCP = new
|
||||||
manualConfigJson = JsonConvert.SerializeObject(vscodeConfig, jsonSettings);
|
{
|
||||||
break;
|
command = uvPathManual,
|
||||||
|
args = new[] { "--directory", pythonDir, "run", "server.py" },
|
||||||
|
type = "stdio"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
manualConfigJson = JsonConvert.SerializeObject(vscodeConfig, jsonSettings);
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
// Create standard MCP configuration for other clients
|
// Create standard MCP configuration for other clients
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue