Skip to content

Commit d6ff2bd

Browse files
committed
Address review feedback for Claude uvx
1 parent c3a8dab commit d6ff2bd

File tree

4 files changed

+15
-6
lines changed

4 files changed

+15
-6
lines changed

MCPForUnity/Editor/Clients/Configurators/ClaudeDesktopConfigurator.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,11 @@ namespace MCPForUnity.Editor.Clients.Configurators
99
{
1010
public class ClaudeDesktopConfigurator : JsonFileMcpConfigurator
1111
{
12+
public const string ClientName = "Claude Desktop";
13+
1214
public ClaudeDesktopConfigurator() : base(new McpClient
1315
{
14-
name = "Claude Desktop",
16+
name = ClientName,
1517
windowsConfigPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "Claude", "claude_desktop_config.json"),
1618
macConfigPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), "Library", "Application Support", "Claude", "claude_desktop_config.json"),
1719
linuxConfigPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), ".config", "Claude", "claude_desktop_config.json"),

MCPForUnity/Editor/Helpers/ConfigJsonBuilder.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
using System.IO;
44
using System.Linq;
55
using MCPForUnity.Editor.Constants;
6+
using MCPForUnity.Editor.Clients.Configurators;
67
using MCPForUnity.Editor.Helpers;
78
using MCPForUnity.Editor.Models;
89
using Newtonsoft.Json;
@@ -176,7 +177,7 @@ private static bool ShouldUseWindowsCmdShim(McpClient client)
176177
}
177178

178179
return Application.platform == RuntimePlatform.WindowsEditor &&
179-
string.Equals(client.name, "Claude Desktop", StringComparison.OrdinalIgnoreCase);
180+
string.Equals(client.name, ClaudeDesktopConfigurator.ClientName, StringComparison.OrdinalIgnoreCase);
180181
}
181182

182183
private static string ResolveCmdPath()

MCPForUnity/Editor/Windows/Components/ClientConfig/McpClientConfigSection.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -346,8 +346,13 @@ private void RefreshClaudeCliStatus(IMcpClientConfigurator client, bool forceImm
346346
Task.Run(() =>
347347
{
348348
MCPServiceLocator.Client.CheckClientStatus(client, attemptAutoRewrite: false);
349-
}).ContinueWith(_ =>
349+
}).ContinueWith(t =>
350350
{
351+
if (t.IsFaulted && t.Exception != null)
352+
{
353+
McpLog.Error($"Failed to refresh Claude CLI status: {t.Exception.GetBaseException().Message}");
354+
}
355+
351356
EditorApplication.delayCall += () =>
352357
{
353358
statusRefreshInFlight.Remove(client);

TestProjects/UnityMCPTests/Assets/Tests/EditMode/Helpers/WriteToConfigTests.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
using MCPForUnity.Editor.Helpers;
99
using MCPForUnity.Editor.Models;
1010
using MCPForUnity.Editor.Constants;
11+
using MCPForUnity.Editor.Services;
1112

1213
namespace MCPForUnityTests.Editor.Helpers
1314
{
@@ -175,7 +176,7 @@ public void ClaudeDesktop_UsesAbsoluteUvPath_WhenOverrideProvided()
175176

176177
WithTransportPreference(false, () =>
177178
{
178-
EditorPrefs.SetString(EditorPrefKeys.UvxPathOverride, "/abs/mock/uvx");
179+
MCPServiceLocator.Paths.SetUvxPathOverride(_fakeUvPath);
179180
try
180181
{
181182
var client = new McpClient
@@ -190,13 +191,13 @@ public void ClaudeDesktop_UsesAbsoluteUvPath_WhenOverrideProvided()
190191
var root = JObject.Parse(File.ReadAllText(configPath));
191192
var unity = (JObject)root.SelectToken("mcpServers.unityMCP");
192193
Assert.NotNull(unity, "Expected mcpServers.unityMCP node");
193-
Assert.AreEqual("/abs/mock/uvx", (string)unity["command"], "Claude Desktop should use absolute uvx path");
194+
Assert.AreEqual(_fakeUvPath, (string)unity["command"], "Claude Desktop should use absolute uvx path");
194195
Assert.IsNull(unity["env"], "Claude Desktop config should not include env block when not required");
195196
AssertTransportConfiguration(unity, client);
196197
}
197198
finally
198199
{
199-
EditorPrefs.DeleteKey(EditorPrefKeys.UvxPathOverride);
200+
MCPServiceLocator.Paths.ClearUvxPathOverride();
200201
}
201202
});
202203
}

0 commit comments

Comments
 (0)