diff --git a/MCPForUnity/Editor/Data/McpClients.cs b/MCPForUnity/Editor/Data/McpClients.cs index 6ddf304..6871751 100644 --- a/MCPForUnity/Editor/Data/McpClients.cs +++ b/MCPForUnity/Editor/Data/McpClients.cs @@ -133,6 +133,34 @@ namespace MCPForUnity.Editor.Data mcpType = McpTypes.VSCode, 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 new() { diff --git a/MCPForUnity/Editor/Models/McpTypes.cs b/MCPForUnity/Editor/Models/McpTypes.cs index a5a03de..7c86489 100644 --- a/MCPForUnity/Editor/Models/McpTypes.cs +++ b/MCPForUnity/Editor/Models/McpTypes.cs @@ -9,5 +9,6 @@ namespace MCPForUnity.Editor.Models Kiro, VSCode, Windsurf, + Trae, } } diff --git a/MCPForUnity/Editor/Services/ClientConfigurationService.cs b/MCPForUnity/Editor/Services/ClientConfigurationService.cs index 39728e0..dea5358 100644 --- a/MCPForUnity/Editor/Services/ClientConfigurationService.cs +++ b/MCPForUnity/Editor/Services/ClientConfigurationService.cs @@ -459,6 +459,16 @@ namespace MCPForUnity.Editor.Services " OR manually run: claude mcp add UnityMCP\n" + "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." }; diff --git a/MCPForUnity/Editor/Windows/ManualConfigEditorWindow.cs b/MCPForUnity/Editor/Windows/ManualConfigEditorWindow.cs index ecccbef..ec3f9be 100644 --- a/MCPForUnity/Editor/Windows/ManualConfigEditorWindow.cs +++ b/MCPForUnity/Editor/Windows/ManualConfigEditorWindow.cs @@ -108,6 +108,13 @@ namespace MCPForUnity.Editor.Windows 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( " b) Opening the configuration file at:", diff --git a/TestProjects/UnityMCPTests/Assets/Tests/EditMode/Helpers/WriteToConfigTests.cs b/TestProjects/UnityMCPTests/Assets/Tests/EditMode/Helpers/WriteToConfigTests.cs index 88f4118..f34130d 100644 --- a/TestProjects/UnityMCPTests/Assets/Tests/EditMode/Helpers/WriteToConfigTests.cs +++ b/TestProjects/UnityMCPTests/Assets/Tests/EditMode/Helpers/WriteToConfigTests.cs @@ -128,6 +128,22 @@ namespace MCPForUnityTests.Editor.Helpers 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] public void PreservesExistingEnvAndDisabled() { diff --git a/UnityMcpBridge/Editor/Data/McpClients.cs b/UnityMcpBridge/Editor/Data/McpClients.cs index 9e71884..1616c46 100644 --- a/UnityMcpBridge/Editor/Data/McpClients.cs +++ b/UnityMcpBridge/Editor/Data/McpClients.cs @@ -134,6 +134,31 @@ namespace MCPForUnity.Editor.Data mcpType = McpTypes.VSCode, 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 new() { diff --git a/UnityMcpBridge/Editor/Models/McpTypes.cs b/UnityMcpBridge/Editor/Models/McpTypes.cs index a5a03de..7c86489 100644 --- a/UnityMcpBridge/Editor/Models/McpTypes.cs +++ b/UnityMcpBridge/Editor/Models/McpTypes.cs @@ -9,5 +9,6 @@ namespace MCPForUnity.Editor.Models Kiro, VSCode, Windsurf, + Trae, } } diff --git a/UnityMcpBridge/Editor/Windows/ManualConfigEditorWindow.cs b/UnityMcpBridge/Editor/Windows/ManualConfigEditorWindow.cs index ecccbef..ec3f9be 100644 --- a/UnityMcpBridge/Editor/Windows/ManualConfigEditorWindow.cs +++ b/UnityMcpBridge/Editor/Windows/ManualConfigEditorWindow.cs @@ -108,6 +108,13 @@ namespace MCPForUnity.Editor.Windows 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( " b) Opening the configuration file at:",