6682c8bd29
* Add Unity MCP skill sync installer Add an EditorWindow (McpForUnitySkillInstaller) that syncs the unity-mcp skill from a GitHub repository without cloning. The tool reads the repo tree via the GitHub API, computes git blob SHA-1s to build an incremental sync plan (added/updated/deleted), downloads raw files for changed items, validates hashes, and writes a last-synced commit to EditorPrefs. UI supports branch and CLI (codex/claude) selection, configurable install path, logging, and safety checks (aborts on truncated trees). Also add the corresponding .meta file. * fix namespace * fix: harden skill installer sync safety (由codex生成) - Resolve branch head commit SHA via GitHub branches API and use it for snapshot/raw download refs - Reject unsafe remote relative paths and enforce install-root containment for all file IO - Handle case-only renames on case-insensitive filesystems during sync planning - Add managed install-root marker guard to avoid destructive deletes in unmanaged directories * meta update * fix: freeze sync inputs and validate install path (由codex生成) - Snapshot repo/branch/installDir before starting background sync task - Disable config inputs while sync is running to avoid mid-run mutations - Validate install directory explicitly with clear errors before filesystem operations - Scope last-synced-commit key derivation to captured repo/branch values * Update to incorporate the skill installation into current config 1. Incorporate the Config into a simple one-click in Client Configuration. 2. Simplify the logs to only 1 entry, convenient for LLM checking. --------- Co-authored-by: Shutong Wu <51266340+Scriptwonder@users.noreply.github.com>
38 lines
1.2 KiB
C#
38 lines
1.2 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.IO;
|
|
using MCPForUnity.Editor.Models;
|
|
|
|
namespace MCPForUnity.Editor.Clients.Configurators
|
|
{
|
|
/// <summary>
|
|
/// Claude Code configurator using the CLI-based registration (claude mcp add/remove).
|
|
/// This integrates with Claude Code's native MCP management.
|
|
/// </summary>
|
|
public class ClaudeCodeConfigurator : ClaudeCliMcpConfigurator
|
|
{
|
|
public ClaudeCodeConfigurator() : base(new McpClient
|
|
{
|
|
name = "Claude Code",
|
|
SupportsHttpTransport = true,
|
|
})
|
|
{ }
|
|
|
|
public override bool SupportsSkills => true;
|
|
|
|
public override string GetSkillInstallPath()
|
|
{
|
|
var userHome = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile);
|
|
return Path.Combine(userHome, ".claude", "skills", "unity-mcp-skill");
|
|
}
|
|
|
|
public override IList<string> GetInstallationSteps() => new List<string>
|
|
{
|
|
"Ensure Claude CLI is installed (comes with Claude Code)",
|
|
"Click Configure to add UnityMCP via 'claude mcp add'",
|
|
"The server will be automatically available in Claude Code",
|
|
"Use Unregister to remove via 'claude mcp remove'"
|
|
};
|
|
}
|
|
}
|