Skip to content

Conversation

@Scriptwonder
Copy link
Collaborator

@Scriptwonder Scriptwonder commented Jan 11, 2026

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.

Summary by Sourcery

Refactor Claude Code MCP client configuration to use the JSON file-based configurator instead of the CLI-based configurator, updating platform config paths and installation steps accordingly.

Enhancements:

  • Switch ClaudeCodeConfigurator to use JsonFileMcpConfigurator with a shared ~/.claude.json configuration path across platforms.
  • Enable HTTP transport configuration for Claude Code using the standard mcpServers layout and url property.
  • Update installation instructions to describe configuration via the global ~/.claude.json file rather than CLI registration.

Summary by CodeRabbit

  • Refactor
    • Updated Claude Code configuration to use JSON file-based approach
    • Simplified installation flow with UI-oriented setup guidance through Claude Code instead of command-line steps
    • Added cross-platform support with consistent configuration file location (Windows, macOS, Linux)
    • Enabled HTTP transport for improved connectivity

✏️ Tip: You can customize this high-level summary in your review settings.

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.
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 11, 2026

📝 Walkthrough

Walkthrough

The ClaudeCodeConfigurator class was refactored to inherit from JsonFileMcpConfigurator instead of ClaudeCliMcpConfigurator, enabling HTTP transport support and directing configuration to the ~/.claude.json file. Installation instructions shifted from CLI-oriented guidance to UI-based steps within Claude Code.

Changes

Cohort / File(s) Change Summary
Claude Code Configurator Refactor
MCPForUnity/Editor/Clients/Configurators/ClaudeCodeConfigurator.cs
Changed base class from ClaudeCliMcpConfigurator to JsonFileMcpConfigurator; added System and System.IO usings; configured paths to ~/.claude.json across platforms; enabled HTTP transport with SupportsHttpTransport = true and set HttpUrlProperty; set IsVsCodeLayout = false; rewrote installation steps from CLI commands to UI-driven setup flow (open Claude Code, configure MCP for Unity, restart)

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐰 From CLI commands to Claude's UI door,
Configuration flows where settings pour,
JSON files now guide the way,
HTTP transport sees the light of day,
A rabbit hops through refactored code,
Where inheritance takes a lighter load! 🌟

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title directly and accurately describes the main change: refactoring ClaudeCodeConfigurator to inherit from JsonFileMcpConfigurator instead of ClaudeCliMcpConfigurator, which is the primary alteration in the changeset.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@sourcery-ai
Copy link
Contributor

sourcery-ai bot commented Jan 11, 2026

Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Refactors ClaudeCodeConfigurator to use JSON file-based configuration instead of CLI registration, wiring it into the global ~/.claude.json MCP configuration and updating installation instructions accordingly.

Sequence diagram for configuring Claude Code via JsonFileMcpConfigurator

sequenceDiagram
    actor User
    participant UnityEditor as MCPForUnityEditor
    participant Configurator as ClaudeCodeConfigurator
    participant JsonConfig as JsonFileMcpConfigurator
    participant FileSystem
    participant ClaudeCode

    User->>UnityEditor: Click Configure for Claude_Code
    UnityEditor->>Configurator: Configure()
    Configurator->>JsonConfig: ConfigureMcpServer(client)
    JsonConfig->>FileSystem: Read ~/.claude.json
    FileSystem-->>JsonConfig: Existing_config_or_empty
    JsonConfig->>JsonConfig: Add_or_merge_mcpServers_entry_for_Unity_MCP
    JsonConfig->>FileSystem: Write ~/.claude.json
    User->>ClaudeCode: Restart_Claude_Code
    ClaudeCode->>FileSystem: Read ~/.claude.json
    ClaudeCode-->>User: Unity_MCP_server_available
Loading

Class diagram for refactored ClaudeCodeConfigurator to use JsonFileMcpConfigurator

classDiagram
    class ClaudeCliMcpConfigurator
    class JsonFileMcpConfigurator{
        +McpClient client
        +JsonFileMcpConfigurator(McpClient client)
        +Configure()
    }
    class McpClient{
        +string name
        +string windowsConfigPath
        +string macConfigPath
        +string linuxConfigPath
        +bool SupportsHttpTransport
        +string HttpUrlProperty
        +bool IsVsCodeLayout
    }
    class ClaudeCodeConfigurator{
        +ClaudeCodeConfigurator()
        +IList~string~ GetInstallationSteps()
    }

    ClaudeCodeConfigurator --|> JsonFileMcpConfigurator
    ClaudeCodeConfigurator ..|> ClaudeCliMcpConfigurator
    JsonFileMcpConfigurator --> McpClient
    ClaudeCodeConfigurator ..> McpClient : configures
Loading

File-Level Changes

Change Details Files
Switch ClaudeCodeConfigurator from CLI-based configuration to JSON file-based configuration using the global ~/.claude.json MCP config.
  • Change base class from ClaudeCliMcpConfigurator to JsonFileMcpConfigurator to use file-backed configuration instead of CLI commands.
  • Configure McpClient to point windows, mac, and linux config paths to the user’s ~/.claude.json file using Environment.GetFolderPath and Path.Combine.
  • Enable HTTP transport support and specify Claude Code’s HTTP URL property name and layout flags on the McpClient instance.
MCPForUnity/Editor/Clients/Configurators/ClaudeCodeConfigurator.cs
Update installation steps to describe JSON configuration workflow instead of Claude CLI registration.
  • Replace references to Claude CLI and 'claude mcp add' with steps for opening a project in Claude Code and editing ~/.claude.json.
  • Clarify that the MCP server is added to the global mcpServers section and that Claude Code must be restarted to apply changes.
MCPForUnity/Editor/Clients/Configurators/ClaudeCodeConfigurator.cs

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've left some high level feedback:

  • The config path construction for each platform is duplicated and identical; consider extracting the Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), ".claude.json") logic to a helper or constant to avoid repetition and make future changes safer.
  • The installation steps reference ~/.claude.json, which is Unix-specific notation; you might want to either describe the path in an OS-agnostic way or provide platform-specific instructions so Windows users aren't confused.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- The config path construction for each platform is duplicated and identical; consider extracting the `Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), ".claude.json")` logic to a helper or constant to avoid repetition and make future changes safer.
- The installation steps reference `~/.claude.json`, which is Unix-specific notation; you might want to either describe the path in an OS-agnostic way or provide platform-specific instructions so Windows users aren't confused.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In @MCPForUnity/Editor/Clients/Configurators/ClaudeCodeConfigurator.cs:
- Around line 22-28: The installation steps in
ClaudeCodeConfigurator.GetInstallationSteps are ambiguous about which UI hosts
the "Configure" action; update the step strings to explicitly name the
application for each action (e.g., "Open your project in Claude Code", then "In
Unity (MCP for Unity) click 'Configure' or edit ~/.claude.json" or split into
"In Claude Code: open your project" and "In Unity (MCP for Unity): click
'Configure'"), preserving the same list order and return type in
ClaudeCodeConfigurator so users clearly know which app to interact with for each
step.
🧹 Nitpick comments (1)
MCPForUnity/Editor/Clients/Configurators/ClaudeCodeConfigurator.cs (1)

13-15: Deduplicate the repeated config-path construction.
Keeps the initializer easier to scan and reduces future drift if the path changes again.

Proposed diff
 public class ClaudeCodeConfigurator : JsonFileMcpConfigurator
 {
     public ClaudeCodeConfigurator() : base(new McpClient
     {
         name = "Claude Code",
-        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"),
+        windowsConfigPath = GetClaudeJsonPath(),
+        macConfigPath = GetClaudeJsonPath(),
+        linuxConfigPath = GetClaudeJsonPath(),
         SupportsHttpTransport = true,
         HttpUrlProperty = "url", // Claude Code uses "url" for HTTP servers
         IsVsCodeLayout = false,  // Claude Code uses standard mcpServers layout
     })
     { }
+
+    private static string GetClaudeJsonPath() =>
+        Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), ".claude.json");
📜 Review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between f2d56cf and 527095a.

📒 Files selected for processing (1)
  • MCPForUnity/Editor/Clients/Configurators/ClaudeCodeConfigurator.cs
🧰 Additional context used
🧠 Learnings (2)
📚 Learning: 2025-11-27T21:09:35.011Z
Learnt from: msanatan
Repo: CoplayDev/unity-mcp PR: 401
File: MCPForUnity/Editor/Clients/Configurators/VSCodeConfigurator.cs:10-18
Timestamp: 2025-11-27T21:09:35.011Z
Learning: VS Code GitHub Copilot MCP configuration supports mcp.json files placed directly in the Code/User directory: %APPDATA%\Code\User\mcp.json on Windows, ~/Library/Application Support/Code/User/mcp.json on macOS, and ~/.config/Code/User/mcp.json on Linux. This is in addition to workspace-scoped .vscode/mcp.json files.

Applied to files:

  • MCPForUnity/Editor/Clients/Configurators/ClaudeCodeConfigurator.cs
📚 Learning: 2025-12-29T15:23:11.613Z
Learnt from: msanatan
Repo: CoplayDev/unity-mcp PR: 491
File: MCPForUnity/Editor/Windows/EditorPrefs/EditorPrefsWindow.cs:78-115
Timestamp: 2025-12-29T15:23:11.613Z
Learning: In MCPForUnity, prefer relying on the established testing process to catch UI initialization issues instead of adding defensive null checks for UI elements in editor windows. This means during reviews, verify that tests cover UI initialization paths and that code avoids repetitive null-check boilerplate in Editor Windows. If a UI element can be null, ensure there is a well-tested fallback or that its initialization is guaranteed by design, rather than sprinkling null checks throughout editor code.

Applied to files:

  • MCPForUnity/Editor/Clients/Configurators/ClaudeCodeConfigurator.cs
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: Sourcery review
  • GitHub Check: Test in editmode
🔇 Additional comments (1)
MCPForUnity/Editor/Clients/Configurators/ClaudeCodeConfigurator.cs (1)

8-19: All configuration properties and paths are correct per Claude Code v2.1.4 MCP schema. The JSON write implementation safely merges changes into the existing ~/.claude.json file, preserving all unrelated server configurations and settings. The concern about clobbering is unfounded—McpConfigurationHelper.WriteMcpConfiguration explicitly reads the existing config first, modifies only the unityMCP block within mcpServers, and uses atomic file operations.

Likely an incorrect or invalid review comment.

Comment on lines 22 to 28
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"
};
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Installation steps: clarify whether “Configure” happens in Unity vs Claude Code (ordering reads ambiguous).
As written, “Open your project in Claude Code” followed by “Click Configure in MCP for Unity” could confuse users about where that button exists. Consider making Unity vs Claude Code explicit.

Proposed diff
 public override IList<string> GetInstallationSteps() => new List<string>
 {
-    "Open your project in Claude Code",
-    "Click Configure in MCP for Unity (or manually edit ~/.claude.json)",
+    "In Unity: open MCP for Unity and click Configure (or manually edit ~/.claude.json)",
+    "In Claude Code: open your project",
     "The MCP server will be added to the global mcpServers section",
     "Restart Claude Code to apply changes"
 };
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
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"
};
public override IList<string> GetInstallationSteps() => new List<string>
{
"In Unity: open MCP for Unity and click Configure (or manually edit ~/.claude.json)",
"In Claude Code: open your project",
"The MCP server will be added to the global mcpServers section",
"Restart Claude Code to apply changes"
};
🤖 Prompt for AI Agents
In @MCPForUnity/Editor/Clients/Configurators/ClaudeCodeConfigurator.cs around
lines 22 - 28, The installation steps in
ClaudeCodeConfigurator.GetInstallationSteps are ambiguous about which UI hosts
the "Configure" action; update the step strings to explicitly name the
application for each action (e.g., "Open your project in Claude Code", then "In
Unity (MCP for Unity) click 'Configure' or edit ~/.claude.json" or split into
"In Claude Code: open your project" and "In Unity (MCP for Unity): click
'Configure'"), preserving the same list order and return type in
ClaudeCodeConfigurator so users clearly know which app to interact with for each
step.

@Scriptwonder Scriptwonder merged commit 53c0ed2 into main Jan 11, 2026
3 checks passed
@Scriptwonder Scriptwonder deleted the Scriptwonder-patch-1 branch January 11, 2026 07:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants