Skip to content

fix: correct Trae MCP config path - #1346

Open
8ddieHu0314 wants to merge 1 commit into
CoplayDev:betafrom
8ddieHu0314:fix/trae-config-path-user-folder
Open

fix: correct Trae MCP config path#1346
8ddieHu0314 wants to merge 1 commit into
CoplayDev:betafrom
8ddieHu0314:fix/trae-config-path-user-folder

Conversation

@8ddieHu0314

@8ddieHu0314 8ddieHu0314 commented Aug 25, 2026

Copy link
Copy Markdown

Description

TraeConfigurator writes the Unity MCP entry to .../Trae/mcp.json, but Trae reads its global MCP config from .../Trae/User/mcp.json, one level down, in the profile folder.

This has been wrong since #337. The failure mode is silent and reports success because IsInstalled only stats the parent directory, which exists, so Trae is detected, the write succeeds, and the MCP for Unity window shows Configured while Trae loads nothing.

Trae derives the MCP config location from the profile folder, not the user data root. In Trae.app/Contents/Resources/app/out/main.js:

get appSettingsHome(){ return URI.file(join(this.userDataPath, "User")) }

Trae appends mcp.json to the profile location, which for the default profile is appSettingsHome, resolving to <userData>/User/mcp.json. Nothing in the app's bundles joins userDataPath with mcp.json directly, so the old path is unreachable by Trae, not merely deprioritized.

Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update
  • Refactoring (no functional changes)
  • Test update

Changes Made

MCPForUnity/Editor/Clients/Configurators/TraeConfigurator.cs only,

  • windowsConfigPath: %AppData%\Trae\mcp.json%AppData%\Trae\User\mcp.json
  • macConfigPath: ~/Library/Application Support/Trae/mcp.json~/Library/Application Support/Trae/User/mcp.json
  • linuxConfigPath: ~/.config/Trae/mcp.json~/.config/Trae/User/mcp.json
  • The three matching paths printed by GetInstallationSteps()

Compatibility / Package Source

  • Unity version(s) tested: 6000.5.4f1 (manual in-Editor verification; automated EditMode suite not run locally)

Testing/Screenshots/Recordings

  • Python tests (cd Server && uv run pytest tests/ -v)
  • Unity EditMode tests
  • Unity PlayMode tests
  • Package import/compile check
  • Not applicable (explain why in Additional Notes)

Verified against a running Trae 3.5.87 (macOS arm64) by planting a uniquely named MCP server at the old path:

Files present Result
User/mcp.json (Puppeteer, for testing) + old path (probe) Trae starts Puppeteer; probe ignored
only the old path (probe) MCP subsystem activates, loads zero servers

The probe never appears anywhere in Trae's logs or state. The file is not read and rejected, it is never opened.

End-to-end in Unity 6000.5.4f1 (macOS). Loaded this branch as a local package, opened Window → MCP for Unity → Configure with Trae selected. The unityMCP entry was written to ~/Library/Application Support/Trae/User/mcp.json, merged alongside existing MCP servers, and the old .../Trae/mcp.json path was never created. Trae then showed unityMCP in Settings → MCP.

Documentation Updates

  • I have added/removed/modified tools or resources
  • If yes, I have updated all documentation files using:
    • The LLM prompt at tools/UPDATE_DOCS_PROMPT.md (recommended)
    • Manual review of the generated changes

Related Issues

No issue was filed for this. Found while configuring Trae locally and noticing the UI reported Configured while Trae showed no Unity server.

Additional Notes

Why no test. A Path.Combine assertion against a path literal restates the constant rather than verifying it, and would still pass if Trae relocated the file — so it would not catch the next occurrence of this bug either.

Only macOS is verified against a running Trae. The Windows and Linux paths are inferred from the same VS Code profile layout (%AppData%\Code\User, ~/.config/Code/User) and would benefit from a check by someone on those platforms.

Summary by CodeRabbit

  • Bug Fixes
    • Updated Trae MCP configuration paths across Windows, macOS, and Linux to use the correct User subdirectory.
  • Documentation
    • Updated installation instructions to reflect the revised configuration locations.

Trae is a VS Code fork: its global MCP config is .../Trae/User/mcp.json, not
the user data root. Since we have written one level up, it fails silently,
because IsInstalled only stats the parent directory so the UI still reports "Configured".

Verified on macOS against Trae 1.10; Windows and Linux paths are inferred from
the same VS Code profile layout.
@coderabbitai

coderabbitai Bot commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: f1f03578-227e-4398-af4e-3b405e8e9318

📥 Commits

Reviewing files that changed from the base of the PR and between c21bf49 and 3927863.

📒 Files selected for processing (1)
  • MCPForUnity/Editor/Clients/Configurators/TraeConfigurator.cs

Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review.


📝 Walkthrough

Walkthrough

The Trae configurator now uses platform-specific MCP configuration paths that include the User subdirectory. Installation instructions use the same updated paths.

Changes

Trae configuration paths

Layer / File(s) Summary
Update Trae paths and instructions
MCPForUnity/Editor/Clients/Configurators/TraeConfigurator.cs
Windows, macOS, and Linux configuration paths now include the User subdirectory. Installation instructions match these paths.

Estimated code review effort: 1 (Trivial) | ~5 minutes

Merge Risk: 🟡 Moderate · up to 39278

The PR changes the MCP configuration location on all supported platforms, but that path is disputed in review; merging without resolving which location Trae actually reads could leave Unity MCP unconfigured.

🚥 Pre-merge checks | ✅ 4 | ❌ 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%. Docstring coverage is scoped to functions touched by this diff. Analyzed 2 functions across 1 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly and concisely identifies the main change: correcting the Trae MCP configuration path.
Description check ✅ Passed The description is complete and directly related to the change. It identifies the root cause, lists all platform-specific path updates, records compatibility and testing details, explains documentatio…
Full details: Description check

Explanation

The description is complete and directly related to the change. It identifies the root cause, lists all platform-specific path updates, records compatibility and testing details, explains documentation status, and notes the unverified Windows and Linux paths.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

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