|
| 1 | +using System; |
| 2 | +using System.Collections.Generic; |
| 3 | +using System.IO; |
| 4 | +using MCPForUnity.Editor.Models; |
| 5 | + |
| 6 | +namespace MCPForUnity.Editor.Clients.Configurators |
| 7 | +{ |
| 8 | + /// <summary> |
| 9 | + /// Qwen Code MCP client configurator. |
| 10 | + /// Qwen Code uses a JSON-based configuration file with mcpServers section. |
| 11 | + /// Config path: ~/.qwen/settings.json |
| 12 | + /// |
| 13 | + /// Qwen Code supports both stdio (uvx) and HTTP transport modes. |
| 14 | + /// Default: stdio mode (works without Unity Editor for basic operations) |
| 15 | + /// HTTP mode: requires Unity Editor running with MCP HTTP server started |
| 16 | + /// </summary> |
| 17 | + public class QwenCodeConfigurator : JsonFileMcpConfigurator |
| 18 | + { |
| 19 | + public QwenCodeConfigurator() : base(new McpClient |
| 20 | + { |
| 21 | + name = "Qwen Code", |
| 22 | + windowsConfigPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), ".qwen", "settings.json"), |
| 23 | + macConfigPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), ".qwen", "settings.json"), |
| 24 | + linuxConfigPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), ".qwen", "settings.json"), |
| 25 | + SupportsHttpTransport = true, |
| 26 | + // Default to stdio transport for Qwen Code (like Cursor) |
| 27 | + // User can switch to HTTP in Unity: Window > MCP for Unity > Settings |
| 28 | + }) |
| 29 | + { } |
| 30 | + |
| 31 | + public override IList<string> GetInstallationSteps() => new List<string> |
| 32 | + { |
| 33 | + "Ensure Qwen Code is installed (npm install -g @anthropic-ai/qwen-code or via official installer)", |
| 34 | + "Open Qwen Code", |
| 35 | + "Click 'Auto Configure' to automatically add UnityMCP to settings.json", |
| 36 | + "OR click 'Manual Setup' to copy the configuration JSON", |
| 37 | + "Open ~/.qwen/settings.json and paste the configuration", |
| 38 | + "Save and restart Qwen Code", |
| 39 | + "Use /mcp command in Qwen Code to verify Unity MCP is connected", |
| 40 | + "Note: For full functionality, open Unity Editor and start HTTP server" |
| 41 | + }; |
| 42 | + } |
| 43 | +} |
0 commit comments