Refactor ClaudeCodeConfigurator to use JsonFileMcpConfigurator (#545)

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.
main
Shutong Wu 2026-01-11 02:07:47 -05:00 committed by GitHub
parent f2d56cfb22
commit 53c0ed26ef
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 13 additions and 7 deletions

View File

@ -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<string> GetInstallationSteps() => new List<string>
{
"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"
};
}
}