Update to support Trae (#337)

main
Bilal ARIKAN 2025-10-23 00:38:20 +03:00 committed by GitHub
parent 558f9232d3
commit d4214cefa7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
8 changed files with 95 additions and 0 deletions

View File

@ -133,6 +133,34 @@ namespace MCPForUnity.Editor.Data
mcpType = McpTypes.VSCode, mcpType = McpTypes.VSCode,
configStatus = "Not Configured", configStatus = "Not Configured",
}, },
// Trae IDE
new()
{
name = "Trae",
// Windows: %AppData%\Trae\mcp.json
windowsConfigPath = Path.Combine(
Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData),
"Trae",
"mcp.json"
),
// macOS: ~/Library/Application Support/Trae/mcp.json
macConfigPath = Path.Combine(
Environment.GetFolderPath(Environment.SpecialFolder.UserProfile),
"Library",
"Application Support",
"Trae",
"mcp.json"
),
// Linux: ~/.config/Trae/mcp.json
linuxConfigPath = Path.Combine(
Environment.GetFolderPath(Environment.SpecialFolder.UserProfile),
".config",
"Trae",
"mcp.json"
),
mcpType = McpTypes.Trae,
configStatus = "Not Configured",
},
// 3) Kiro // 3) Kiro
new() new()
{ {

View File

@ -9,5 +9,6 @@ namespace MCPForUnity.Editor.Models
Kiro, Kiro,
VSCode, VSCode,
Windsurf, Windsurf,
Trae,
} }
} }

View File

@ -459,6 +459,16 @@ namespace MCPForUnity.Editor.Services
" OR manually run: claude mcp add UnityMCP\n" + " OR manually run: claude mcp add UnityMCP\n" +
"3. Restart Claude Code", "3. Restart Claude Code",
McpTypes.Trae =>
"1. Open Trae and go to Settings > MCP\n" +
"2. Select Add Server > Add Manually\n" +
"3. Paste the JSON or point to the mcp.json file\n" +
" Windows: %AppData%\\Trae\\mcp.json\n" +
" macOS: ~/Library/Application Support/Trae/mcp.json\n" +
" Linux: ~/.config/Trae/mcp.json\n" +
"4. For local servers, Node.js (npx) or uvx must be installed\n" +
"5. Save and restart Trae",
_ => "Configuration steps not available for this client." _ => "Configuration steps not available for this client."
}; };

View File

@ -108,6 +108,13 @@ namespace MCPForUnity.Editor.Windows
instructionStyle instructionStyle
); );
} }
else if (mcpClient?.mcpType == McpTypes.Trae)
{
EditorGUILayout.LabelField(
" a) Going to Settings > MCP > Add Server > Add Manually",
instructionStyle
);
}
EditorGUILayout.LabelField(" OR", instructionStyle); EditorGUILayout.LabelField(" OR", instructionStyle);
EditorGUILayout.LabelField( EditorGUILayout.LabelField(
" b) Opening the configuration file at:", " b) Opening the configuration file at:",

View File

@ -128,6 +128,22 @@ namespace MCPForUnityTests.Editor.Helpers
Assert.AreEqual("stdio", (string)unity["type"], "VSCode entry should include type=stdio"); Assert.AreEqual("stdio", (string)unity["type"], "VSCode entry should include type=stdio");
} }
[Test]
public void DoesNotAddEnvOrDisabled_ForTrae()
{
var configPath = Path.Combine(_tempRoot, "trae.json");
WriteInitialConfig(configPath, isVSCode: false, command: _fakeUvPath, directory: "/old/path");
var client = new McpClient { name = "Trae", mcpType = McpTypes.Trae };
InvokeWriteToConfig(configPath, client);
var root = JObject.Parse(File.ReadAllText(configPath));
var unity = (JObject)root.SelectToken("mcpServers.unityMCP");
Assert.NotNull(unity, "Expected mcpServers.unityMCP node");
Assert.IsNull(unity["env"], "env should not be added for Trae client");
Assert.IsNull(unity["disabled"], "disabled should not be added for Trae client");
}
[Test] [Test]
public void PreservesExistingEnvAndDisabled() public void PreservesExistingEnvAndDisabled()
{ {

View File

@ -134,6 +134,31 @@ namespace MCPForUnity.Editor.Data
mcpType = McpTypes.VSCode, mcpType = McpTypes.VSCode,
configStatus = "Not Configured", configStatus = "Not Configured",
}, },
// Trae IDE
new()
{
name = "Trae",
windowsConfigPath = Path.Combine(
Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData),
"Trae",
"mcp.json"
),
macConfigPath = Path.Combine(
Environment.GetFolderPath(Environment.SpecialFolder.UserProfile),
"Library",
"Application Support",
"Trae",
"mcp.json"
),
linuxConfigPath = Path.Combine(
Environment.GetFolderPath(Environment.SpecialFolder.UserProfile),
".config",
"Trae",
"mcp.json"
),
mcpType = McpTypes.Trae,
configStatus = "Not Configured",
},
// 3) Kiro // 3) Kiro
new() new()
{ {

View File

@ -9,5 +9,6 @@ namespace MCPForUnity.Editor.Models
Kiro, Kiro,
VSCode, VSCode,
Windsurf, Windsurf,
Trae,
} }
} }

View File

@ -108,6 +108,13 @@ namespace MCPForUnity.Editor.Windows
instructionStyle instructionStyle
); );
} }
else if (mcpClient?.mcpType == McpTypes.Trae)
{
EditorGUILayout.LabelField(
" a) Going to Settings > MCP > Add Server > Add Manually",
instructionStyle
);
}
EditorGUILayout.LabelField(" OR", instructionStyle); EditorGUILayout.LabelField(" OR", instructionStyle);
EditorGUILayout.LabelField( EditorGUILayout.LabelField(
" b) Opening the configuration file at:", " b) Opening the configuration file at:",