Skip to content

Commit d4214ce

Browse files
authored
Update to support Trae (#337)
1 parent 558f923 commit d4214ce

File tree

8 files changed

+95
-0
lines changed

8 files changed

+95
-0
lines changed

MCPForUnity/Editor/Data/McpClients.cs

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,34 @@ public class McpClients
133133
mcpType = McpTypes.VSCode,
134134
configStatus = "Not Configured",
135135
},
136+
// Trae IDE
137+
new()
138+
{
139+
name = "Trae",
140+
// Windows: %AppData%\Trae\mcp.json
141+
windowsConfigPath = Path.Combine(
142+
Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData),
143+
"Trae",
144+
"mcp.json"
145+
),
146+
// macOS: ~/Library/Application Support/Trae/mcp.json
147+
macConfigPath = Path.Combine(
148+
Environment.GetFolderPath(Environment.SpecialFolder.UserProfile),
149+
"Library",
150+
"Application Support",
151+
"Trae",
152+
"mcp.json"
153+
),
154+
// Linux: ~/.config/Trae/mcp.json
155+
linuxConfigPath = Path.Combine(
156+
Environment.GetFolderPath(Environment.SpecialFolder.UserProfile),
157+
".config",
158+
"Trae",
159+
"mcp.json"
160+
),
161+
mcpType = McpTypes.Trae,
162+
configStatus = "Not Configured",
163+
},
136164
// 3) Kiro
137165
new()
138166
{

MCPForUnity/Editor/Models/McpTypes.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,6 @@ public enum McpTypes
99
Kiro,
1010
VSCode,
1111
Windsurf,
12+
Trae,
1213
}
1314
}

MCPForUnity/Editor/Services/ClientConfigurationService.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -459,6 +459,16 @@ public string GetInstallationSteps(McpClient client)
459459
" OR manually run: claude mcp add UnityMCP\n" +
460460
"3. Restart Claude Code",
461461

462+
McpTypes.Trae =>
463+
"1. Open Trae and go to Settings > MCP\n" +
464+
"2. Select Add Server > Add Manually\n" +
465+
"3. Paste the JSON or point to the mcp.json file\n" +
466+
" Windows: %AppData%\\Trae\\mcp.json\n" +
467+
" macOS: ~/Library/Application Support/Trae/mcp.json\n" +
468+
" Linux: ~/.config/Trae/mcp.json\n" +
469+
"4. For local servers, Node.js (npx) or uvx must be installed\n" +
470+
"5. Save and restart Trae",
471+
462472
_ => "Configuration steps not available for this client."
463473
};
464474

MCPForUnity/Editor/Windows/ManualConfigEditorWindow.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,13 @@ protected virtual void OnGUI()
108108
instructionStyle
109109
);
110110
}
111+
else if (mcpClient?.mcpType == McpTypes.Trae)
112+
{
113+
EditorGUILayout.LabelField(
114+
" a) Going to Settings > MCP > Add Server > Add Manually",
115+
instructionStyle
116+
);
117+
}
111118
EditorGUILayout.LabelField(" OR", instructionStyle);
112119
EditorGUILayout.LabelField(
113120
" b) Opening the configuration file at:",

TestProjects/UnityMCPTests/Assets/Tests/EditMode/Helpers/WriteToConfigTests.cs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,22 @@ public void DoesNotAddEnvOrDisabled_ForVSCode()
128128
Assert.AreEqual("stdio", (string)unity["type"], "VSCode entry should include type=stdio");
129129
}
130130

131+
[Test]
132+
public void DoesNotAddEnvOrDisabled_ForTrae()
133+
{
134+
var configPath = Path.Combine(_tempRoot, "trae.json");
135+
WriteInitialConfig(configPath, isVSCode: false, command: _fakeUvPath, directory: "/old/path");
136+
137+
var client = new McpClient { name = "Trae", mcpType = McpTypes.Trae };
138+
InvokeWriteToConfig(configPath, client);
139+
140+
var root = JObject.Parse(File.ReadAllText(configPath));
141+
var unity = (JObject)root.SelectToken("mcpServers.unityMCP");
142+
Assert.NotNull(unity, "Expected mcpServers.unityMCP node");
143+
Assert.IsNull(unity["env"], "env should not be added for Trae client");
144+
Assert.IsNull(unity["disabled"], "disabled should not be added for Trae client");
145+
}
146+
131147
[Test]
132148
public void PreservesExistingEnvAndDisabled()
133149
{

UnityMcpBridge/Editor/Data/McpClients.cs

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,31 @@ public class McpClients
134134
mcpType = McpTypes.VSCode,
135135
configStatus = "Not Configured",
136136
},
137+
// Trae IDE
138+
new()
139+
{
140+
name = "Trae",
141+
windowsConfigPath = Path.Combine(
142+
Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData),
143+
"Trae",
144+
"mcp.json"
145+
),
146+
macConfigPath = Path.Combine(
147+
Environment.GetFolderPath(Environment.SpecialFolder.UserProfile),
148+
"Library",
149+
"Application Support",
150+
"Trae",
151+
"mcp.json"
152+
),
153+
linuxConfigPath = Path.Combine(
154+
Environment.GetFolderPath(Environment.SpecialFolder.UserProfile),
155+
".config",
156+
"Trae",
157+
"mcp.json"
158+
),
159+
mcpType = McpTypes.Trae,
160+
configStatus = "Not Configured",
161+
},
137162
// 3) Kiro
138163
new()
139164
{

UnityMcpBridge/Editor/Models/McpTypes.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,6 @@ public enum McpTypes
99
Kiro,
1010
VSCode,
1111
Windsurf,
12+
Trae,
1213
}
1314
}

UnityMcpBridge/Editor/Windows/ManualConfigEditorWindow.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,13 @@ protected virtual void OnGUI()
108108
instructionStyle
109109
);
110110
}
111+
else if (mcpClient?.mcpType == McpTypes.Trae)
112+
{
113+
EditorGUILayout.LabelField(
114+
" a) Going to Settings > MCP > Add Server > Add Manually",
115+
instructionStyle
116+
);
117+
}
111118
EditorGUILayout.LabelField(" OR", instructionStyle);
112119
EditorGUILayout.LabelField(
113120
" b) Opening the configuration file at:",

0 commit comments

Comments
 (0)