From 527095a38b06f1dd12eb55f8fdebb9bab974181a Mon Sep 17 00:00:00 2001 From: Shutong Wu <51266340+Scriptwonder@users.noreply.github.com> Date: Sun, 11 Jan 2026 02:02:59 -0500 Subject: [PATCH] Refactor ClaudeCodeConfigurator to use JsonFileMcpConfigurator The old CLI file map does not seem to work for the latest CC(V2.1.4), with errors that cannot recognize any symbols after uvx.exe, whether it be --no-cache, --refresh, or --from. I did not find any documentation change of why this cannot use. I temporarily revert the current Claude Code registration to the old JSON way, which still works. Will look for a fix that could retain the CLI command usage. --- .../Configurators/ClaudeCodeConfigurator.cs | 20 ++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/MCPForUnity/Editor/Clients/Configurators/ClaudeCodeConfigurator.cs b/MCPForUnity/Editor/Clients/Configurators/ClaudeCodeConfigurator.cs index 1c8bf734d..06c7f703d 100644 --- a/MCPForUnity/Editor/Clients/Configurators/ClaudeCodeConfigurator.cs +++ b/MCPForUnity/Editor/Clients/Configurators/ClaudeCodeConfigurator.cs @@ -1,24 +1,30 @@ +using System; using System.Collections.Generic; +using System.IO; using MCPForUnity.Editor.Models; namespace MCPForUnity.Editor.Clients.Configurators { - public class ClaudeCodeConfigurator : ClaudeCliMcpConfigurator + public class ClaudeCodeConfigurator : JsonFileMcpConfigurator { public ClaudeCodeConfigurator() : base(new McpClient { name = "Claude Code", - windowsConfigPath = string.Empty, - macConfigPath = string.Empty, - linuxConfigPath = string.Empty, + windowsConfigPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), ".claude.json"), + macConfigPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), ".claude.json"), + linuxConfigPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), ".claude.json"), + SupportsHttpTransport = true, + HttpUrlProperty = "url", // Claude Code uses "url" for HTTP servers + IsVsCodeLayout = false, // Claude Code uses standard mcpServers layout }) { } public override IList GetInstallationSteps() => new List { - "Ensure Claude CLI is installed", - "Use the Register button to register automatically\nOR manually run: claude mcp add UnityMCP", - "Restart Claude Code" + "Open your project in Claude Code", + "Click Configure in MCP for Unity (or manually edit ~/.claude.json)", + "The MCP server will be added to the global mcpServers section", + "Restart Claude Code to apply changes" }; } }