Skip to content

Conversation

@dsarno
Copy link
Collaborator

@dsarno dsarno commented Jan 29, 2026

Summary

  • Remove cmd.exe /c wrapper when generating Claude Desktop config on Windows
  • Fix Codex config to use centralized beta server args (--prerelease explicit)
  • Add startup_timeout_sec = 60 to Codex config for slower first-run package downloads

Problems Fixed

Claude Desktop on Windows

The cmd.exe /c wrapper was causing stdio pipe issues, resulting in "Server disconnected" errors immediately after the MCP server started:

The process cannot access the file because it is being used by another process.

Root cause: cmd.exe interferes with stdio piping in a way that breaks MCP protocol communication.

Fix: Call uvx.exe directly instead of wrapping with cmd.exe /c.

Codex CLI

  1. Missing --prerelease explicit flags for beta server mode (was manually adding --from instead of using GetBetaServerFromArgsList())
  2. MCP client timeout on first run due to slow package downloads

Fix:

  • Use centralized GetBetaServerFromArgsList() helper for consistent beta handling
  • Add startup_timeout_sec = 60 to generated config

Testing

  • ✅ Windows + Claude Desktop: works with direct uvx call
  • ✅ Windows + Codex: works with prerelease flags and timeout
  • Mac + Claude Desktop: verify no regression
  • Mac + Codex: verify no regression

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Refactor

    • Simplified config generation by removing platform-specific command shims for consistent cross‑platform behavior.
  • New Features

    • Added a startup_timeout_sec (60s) setting to allow more time for initial package downloads.
  • Behavior Changes

    • Beta/prerelease source arguments are now appended directly to the argument list rather than emitted as separate from-url entries.
    • HTTP vs stdio transport selection remains consistent across paths.

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

The cmd.exe /c wrapper was causing stdio pipe issues on Windows,
resulting in "Server disconnected" errors in Claude Desktop. Testing
confirmed that calling uvx.exe directly works reliably.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@sourcery-ai
Copy link
Contributor

sourcery-ai bot commented Jan 29, 2026

Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

This PR simplifies how Claude Desktop MCP configs are generated on Windows by removing the special cmd.exe wrapper logic and always invoking uvx.exe directly, eliminating a problematic stdio indirection while keeping argument construction unchanged.

Sequence diagram for MCP server launch without cmd.exe wrapper

sequenceDiagram
    actor User
    participant ClaudeDesktop
    participant ConfigJsonBuilder
    participant OSProcess

    User->>ClaudeDesktop: Start MCP server
    ClaudeDesktop->>ConfigJsonBuilder: Generate config for McpClient
    ConfigJsonBuilder->>ConfigJsonBuilder: BuildUvxArgs(fromUrl, packageName)
    ConfigJsonBuilder-->>ClaudeDesktop: command = uvxPath
    ConfigJsonBuilder-->>ClaudeDesktop: args = toolArgs

    ClaudeDesktop->>OSProcess: Launch uvxPath with args via stdio
    OSProcess-->>ClaudeDesktop: MCP protocol over stdio
    ClaudeDesktop-->>User: MCP server connected
Loading

Updated class diagram for ConfigJsonBuilder command resolution

classDiagram
    class ConfigJsonBuilder {
        +PopulateUnityNode(JObject unity, string uvPath, McpClient client) void
        +BuildUvxArgs(string fromUrl, string packageName) IList~string~
    }

    class JObject
    class McpClient

    ConfigJsonBuilder --> JObject : uses
    ConfigJsonBuilder --> McpClient : uses
Loading

File-Level Changes

Change Details Files
Always invoke uvx directly in generated MCP config instead of conditionally wrapping it in cmd.exe on Windows for Claude Desktop.
  • Set the Unity MCP config node "command" field unconditionally to the resolved uvx path.
  • Set the Unity MCP config node "args" field unconditionally to the uvx argument list produced by BuildUvxArgs().
  • Remove the conditional branch that previously chose between cmd.exe and uvx.exe based on platform and client name.
MCPForUnity/Editor/Helpers/ConfigJsonBuilder.cs
Remove obsolete Windows-specific helper methods related to cmd.exe shimming.
  • Delete ShouldUseWindowsCmdShim() which detected Windows + Claude Desktop and opted into the cmd wrapper.
  • Delete ResolveCmdPath() which resolved the cmd.exe path via COMSPEC or System32 fallback.
  • Drop now-unused using directives for IO and ClaudeDesktop configurator references.
MCPForUnity/Editor/Helpers/ConfigJsonBuilder.cs

Possibly linked issues

  • #N/A: PR removes the Windows cmd.exe wrapper that breaks stdio, directly addressing the reported 'Server disconnected' Unity MCP issue.

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

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 29, 2026

📝 Walkthrough

Walkthrough

Removed Windows-specific command-shim logic and platform-detection helpers from Unity config generation; adjusted Codex config builder to use beta/prerelease arg list and added a startup_timeout_sec entry for unityMCP in stdio paths.

Changes

Cohort / File(s) Summary
Config JSON builder
MCPForUnity/Editor/Helpers/ConfigJsonBuilder.cs
Removed Windows cmd-shim branching and helper methods (ShouldUseWindowsCmdShim, ResolveCmdPath); always set command to uvxPath and assign args directly. Removed related unused using directives. Attention: platform-specific handling was deleted.
Codex / Unity MCP config helper
MCPForUnity/Editor/Helpers/CodexConfigHelper.cs
Replaced (uvxPath, fromUrl, packageName) deconstruction with (uvxPath, _, packageName) and now appends beta/prerelease args via GetBetaServerFromArgsList() into args array. Added startup_timeout_sec = 60 under unityMCP for stdio paths. Applied changes across BuildCodexServerBlock and CreateUnityMcpTable. Attention: arg building and startup timeout behavior changed.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested reviewers

  • msanatan
  • Scriptwonder

Poem

Hop, hop — the shims took flight, 🐇
One path now gleams in morning light,
Args aligned in tidy rows,
A sixty-second timeout grows,
The builder hums, all set to go. ✨

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.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
Title check ✅ Passed The title accurately summarizes the main changes: removing Windows cmd.exe wrapper for Claude Desktop and fixing Codex config with beta/timeout settings.
Description check ✅ Passed The pull request description provides clear context, specific changes, root cause analysis, and testing results, covering most required template sections.

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

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Tip

🧪 Unit Test Generation v2 is now available!

We have significantly improved our unit test generation capabilities.

To enable: Add this to your .coderabbit.yaml configuration:

reviews:
  finishing_touches:
    unit_tests:
      enabled: true

Try it out by using the @coderabbitai generate unit tests command on your code files or under ✨ Finishing Touches on the walkthrough!

Have feedback? Share your thoughts on our Discord thread!


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.

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 reviewed your changes and they look great!


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.

- Use GetBetaServerFromArgsList() for consistent --prerelease handling
- Add startup_timeout_sec = 60 to allow time for uvx package downloads

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@dsarno dsarno changed the title fix: Remove cmd.exe wrapper for Claude Desktop on Windows fix: Windows Claude Desktop stdio + Codex beta/timeout config Jan 29, 2026
@dsarno dsarno merged commit 13aca5f into CoplayDev:beta Jan 29, 2026
2 checks passed
@dsarno dsarno deleted the fix/windows-claude-desktop-stdio branch January 30, 2026 17:54
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.

1 participant