diff --git a/.gitignore b/.gitignore index 2bcb9ff8..88776aef 100644 --- a/.gitignore +++ b/.gitignore @@ -111,8 +111,6 @@ GvhProjectSettings.xml **/StreamingAssets.meta #Project Specific -**/package-lock.json -**/package-lock.json.meta .codeiumignore Server~/log.txt Server~/log.txt.meta diff --git a/.windsurf/workflows/git-commits.md b/.windsurf/workflows/git-commits.md deleted file mode 100644 index 70eefc56..00000000 --- a/.windsurf/workflows/git-commits.md +++ /dev/null @@ -1,101 +0,0 @@ ---- -description: Git Commit Workflow ---- - -## Git Conventional Commit Workflow - -Cascade **MUST** follow this workflow to ensure all git changes are reviewed, structured, and committed correctly using the Conventional Commits specification. - -### Step 1: Assess the State of the Repository - -1. **Check for Uncommitted Changes**: Run `git status` to get an overview of modified, staged, and untracked files. - -### Step 2: Stage and Review Changes - -1. **Stage All Changes**: Run `git add .` to stage all modifications. -2. **Collect Staged Changes**: Run `git diff --staged --word-diff` to get a complete overview of all the changes that will be included in the commit. This is crucial for accurately summarizing the changes. - -### Step 3: Propose the Commit Message - -- Based on the collected diff, formulate a commit message. The message **MUST** be presented to the USER in a markdown block for review before committing. -- When referencing file changes in a commit body, **MUST** use the filename only (e.g., `McpUtils.cs`), not the full path (e.g. `cci:7://file:///c:/mcp-unity/Editor/Utils/conventional-commits.md:0:0-0:0`). - -#### Structuring the Commit - -**For commits containing a single, focused change:** -- Use a standard, single-line header. -- The body is optional and should only be used for significant explanations. - -**For commits containing multiple, logically distinct changes:** -- The header **MUST** list each distinct change on a separate line. Each line must follow the `(scope): ` format. -- The body should provide a high-level summary of the overall changes. - -**Format:** -# For a single change: -``` -(scope): - -[optional footer(s)] -``` - -# For multiple changes: -``` -(scope1): -(scope2): - - - -[optional footer(s)] -``` - -- **Types**: `feat`, `fix`, `build`, `chore`, `ci`, `docs`, `perf`, `refactor`, `revert`, `style`, `test`. -- **Scope**: For providing context (e.g., `feat(api): ...`). -- **Description**: A concise, imperative summary of a single, distinct change. -- **Body**: Explain the 'what' and 'impact' of the changes. For commits with multiple headers, the body should summarize the combined effort. -- **Footer** (Optional): Use for `BREAKING CHANGE:` notifications or for referencing issue numbers (e.g., `Closes #55`). - -### Example Commit Message Proposals - -Here is how you should present commit messages for review. - -#### Example 1: Single Change (No Body Needed) -For simple, self-explanatory changes where the header is sufficient. - -```markdown -fix(login): Correct typo in user login prompt - -Closes #100 -``` - -#### Example 2: Single Change (Body Included) -For a significant change that requires more context to explain the 'what' and 'why'. - -```markdown -refactor(auth): Overhaul authentication flow to use JWTs - -This commit replaces session-based authentication with JWTs to improve statelessness and scalability. - -Impacts: -- API endpoints now expect a JWT in the Authorization header. -- User login returns a JWT. -- Session management code has been removed. - -Closes #111 -``` - -#### Example 3: Multiple Changes -For commits that bundle several distinct changes, use a multi-line header and a summary body. - -```markdown -feat(auth): Add password reset functionality -refactor(login): Revamp login page style - -This commit introduces a new login flow and modernizes the UI. It adds a password reset endpoint and decouples the email service for better maintainability. - -Impacts: -- A new API endpoint `/api/auth/reset-password` is now available. -- The email template system is now in a separate service module. -- The login page CSS in `login.css` has been updated. - -Closes #123 -``` \ No newline at end of file diff --git a/Editor/Resources/GetGameObjectResource.cs b/Editor/Resources/GetGameObjectResource.cs index fbd57d02..58305462 100644 --- a/Editor/Resources/GetGameObjectResource.cs +++ b/Editor/Resources/GetGameObjectResource.cs @@ -15,8 +15,8 @@ public class GetGameObjectResource : McpResourceBase public GetGameObjectResource() { Name = "get_gameobject"; - Description = "Retrieves detailed information about a specific GameObject by instance ID"; - Uri = "unity://gameobject/{id}"; + Description = "Retrieves detailed information about a specific GameObject by instance ID or object name or path"; + Uri = "unity://gameobject/{idOrName}"; } /// @@ -27,28 +27,39 @@ public GetGameObjectResource() public override JObject Fetch(JObject parameters) { // Validate parameters - if (parameters == null || !parameters.ContainsKey("objectPathId")) + if (parameters == null || !parameters.ContainsKey("idOrName")) { return new JObject { ["success"] = false, - ["message"] = "Missing required parameter: objectPathId" + ["message"] = "Missing required parameter: idOrName" + }; + } + + string idOrName = parameters["idOrName"]?.ToObject(); + + if (string.IsNullOrEmpty(idOrName)) + { + return new JObject + { + ["success"] = false, + ["message"] = "Parameter 'objectPathId' cannot be null or empty" }; } - string objectPathId = parameters["objectPathId"]?.ToObject(); GameObject gameObject = null; // Try to parse as an instance ID first - if (int.TryParse(objectPathId, out int instanceId)) + if (int.TryParse(idOrName, out int instanceId)) { - // If it's a valid integer, try to find by instance ID - gameObject = EditorUtility.InstanceIDToObject(instanceId) as GameObject; + // Unity Instance IDs are typically negative, but we'll accept any integer + UnityEngine.Object unityObject = EditorUtility.InstanceIDToObject(instanceId); + gameObject = unityObject as GameObject; } else { - // Otherwise, treat it as a path - gameObject = GameObject.Find(objectPathId); + // Otherwise, treat it as a name or hierarchical path + gameObject = GameObject.Find(idOrName); } // Check if the GameObject was found @@ -57,7 +68,7 @@ public override JObject Fetch(JObject parameters) return new JObject { ["success"] = false, - ["message"] = $"GameObject with path '{objectPathId}' not found" + ["message"] = $"GameObject with '{idOrName}' reference not found. Make sure the GameObject exists and is loaded in the current scene(s)." }; } @@ -69,7 +80,8 @@ public override JObject Fetch(JObject parameters) { ["success"] = true, ["message"] = $"Retrieved GameObject data for '{gameObject.name}'", - ["gameObject"] = gameObjectData + ["gameObject"] = gameObjectData, + ["instanceId"] = gameObject.GetInstanceID() }; } diff --git a/Editor/Tools/CreatePrefabTool.cs b/Editor/Tools/CreatePrefabTool.cs new file mode 100644 index 00000000..6f64c486 --- /dev/null +++ b/Editor/Tools/CreatePrefabTool.cs @@ -0,0 +1,172 @@ +using System; +using UnityEngine; +using UnityEditor; +using Newtonsoft.Json.Linq; +using McpUnity.Unity; +using McpUnity.Utils; + +namespace McpUnity.Tools +{ + /// + /// Tool for creating prefabs with optional MonoBehaviour scripts + /// + public class CreatePrefabTool : McpToolBase + { + public CreatePrefabTool() + { + Name = "create_prefab"; + Description = "Creates a prefab with optional MonoBehaviour script and serialized field values"; + } + + /// + /// Execute the CreatePrefab tool with the provided parameters + /// + /// Tool parameters as a JObject + public override JObject Execute(JObject parameters) + { + // Extract parameters + string scriptName = parameters["scriptName"]?.ToObject(); + string prefabName = parameters["prefabName"]?.ToObject(); + JObject fieldValues = parameters["fieldValues"]?.ToObject(); + + // Validate required parameters + if (string.IsNullOrEmpty(prefabName)) + { + return McpUnitySocketHandler.CreateErrorResponse( + "Required parameter 'prefabName' not provided", + "validation_error" + ); + } + + // Create a temporary GameObject + GameObject tempObject = new GameObject(prefabName); + + // Add component if provided + if (!string.IsNullOrEmpty(scriptName)) + { + try + { + // Add component + Component component = AddComponent(tempObject, scriptName); + + // Apply field values if provided and component exists + ApplyFieldValues(fieldValues, component); + } + catch (Exception ex) + { + return McpUnitySocketHandler.CreateErrorResponse( + $"Failed to add component '{scriptName}' to GameObject", + "component_error" + ); + } + } + + // For safety, we'll create a unique name if prefab already exists + int counter = 1; + string prefabPath = $"{prefabName}.prefab"; + while (AssetDatabase.AssetPathToGUID(prefabPath) != "") + { + prefabPath = $"{prefabName}_{counter}.prefab"; + counter++; + } + + // Create the prefab + GameObject prefab = PrefabUtility.SaveAsPrefabAsset(tempObject, prefabPath); + + // Clean up temporary object + UnityEngine.Object.DestroyImmediate(tempObject); + + // Refresh the asset database + AssetDatabase.Refresh(); + + // Log the action + McpLogger.LogInfo($"Created prefab '{prefab.name}' at path '{prefabPath}' from script '{scriptName}'"); + + // Create the response + return new JObject + { + ["success"] = true, + ["type"] = "text", + ["message"] = $"Successfully created prefab '{prefab.name}' at path '{prefabPath}'", + ["prefabPath"] = prefabPath + }; + } + + private Component AddComponent(GameObject gameObject, string scriptName) + { + // Find the script type + Type scriptType = Type.GetType($"{scriptName}, Assembly-CSharp"); + if (scriptType == null) + { + // Try with just the class name + scriptType = Type.GetType(scriptName); + } + + if (scriptType == null) + { + // Try to find the type using AppDomain + foreach (var assembly in AppDomain.CurrentDomain.GetAssemblies()) + { + scriptType = assembly.GetType(scriptName); + if (scriptType != null) + break; + } + } + + // Throw an error if the type was not found + if (scriptType == null) + { + return null; + } + + // Check if the type is a MonoBehaviour + if (!typeof(MonoBehaviour).IsAssignableFrom(scriptType)) + { + return null; + } + + return gameObject.AddComponent(scriptType); + } + + private void ApplyFieldValues(JObject fieldValues, Component component) + { + // Apply field values if provided and component exists + if (fieldValues == null || fieldValues.Count == 0) + { + return; + } + + Undo.RecordObject(component, "Set field values"); + + foreach (var property in fieldValues.Properties()) + { + // Get the field/property info + var fieldInfo = component.GetType().GetField(property.Name, + System.Reflection.BindingFlags.Public | + System.Reflection.BindingFlags.NonPublic | + System.Reflection.BindingFlags.Instance); + + if (fieldInfo != null) + { + // Set field value + object value = property.Value.ToObject(fieldInfo.FieldType); + fieldInfo.SetValue(component, value); + } + else + { + // Try property + var propInfo = component.GetType().GetProperty(property.Name, + System.Reflection.BindingFlags.Public | + System.Reflection.BindingFlags.NonPublic | + System.Reflection.BindingFlags.Instance); + + if (propInfo != null && propInfo.CanWrite) + { + object value = property.Value.ToObject(propInfo.PropertyType); + propInfo.SetValue(component, value); + } + } + } + } + } +} diff --git a/Editor/Tools/CreatePrefabTool.cs.meta b/Editor/Tools/CreatePrefabTool.cs.meta new file mode 100644 index 00000000..9b3afce5 --- /dev/null +++ b/Editor/Tools/CreatePrefabTool.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 1fe1226cc07d8a149aa31786552a43ca \ No newline at end of file diff --git a/Editor/Tools/SelectGameObjectTool.cs b/Editor/Tools/SelectGameObjectTool.cs index a8f6a3a1..084f5620 100644 --- a/Editor/Tools/SelectGameObjectTool.cs +++ b/Editor/Tools/SelectGameObjectTool.cs @@ -16,7 +16,7 @@ public class SelectGameObjectTool : McpToolBase public SelectGameObjectTool() { Name = "select_gameobject"; - Description = "Sets the selected GameObject in the Unity editor by path or instance ID"; + Description = "Sets the selected GameObject in the Unity editor by path, name or instance ID"; } /// @@ -27,13 +27,15 @@ public override JObject Execute(JObject parameters) { // Extract parameters string objectPath = parameters["objectPath"]?.ToObject(); + string objectName = parameters["objectName"]?.ToObject(); int? instanceId = parameters["instanceId"]?.ToObject(); + GameObject selectedGameObject = null; // Validate parameters - require either objectPath or instanceId - if (string.IsNullOrEmpty(objectPath) && !instanceId.HasValue) + if (string.IsNullOrEmpty(objectPath) && string.IsNullOrEmpty(objectName) && !instanceId.HasValue) { return McpUnitySocketHandler.CreateErrorResponse( - "Required parameter 'objectPath' or 'instanceId' not provided", + "Required parameter 'objectPath', 'objectName' or 'instanceId' not provided", "validation_error" ); } @@ -41,29 +43,32 @@ public override JObject Execute(JObject parameters) // First try to find by instance ID if provided if (instanceId.HasValue) { - Selection.activeGameObject = EditorUtility.InstanceIDToObject(instanceId.Value) as GameObject; + selectedGameObject = EditorUtility.InstanceIDToObject(instanceId.Value) as GameObject; } - // Otherwise, try to find by object path/name if provided - else + else if (!string.IsNullOrEmpty(objectPath)) { // Try to find the object by path in the hierarchy - Selection.activeGameObject = GameObject.Find(objectPath); + selectedGameObject = GameObject.Find(objectPath); } + else + { + // Try to find the object by name in the hierarchy + selectedGameObject = GameObject.Find(objectName); + } + + Selection.activeGameObject = selectedGameObject; // Ping the selected object - EditorGUIUtility.PingObject(Selection.activeGameObject); + EditorGUIUtility.PingObject(selectedGameObject); - // Log the selection - McpLogger.LogInfo($"[MCP Unity] Selected GameObject: " + - (instanceId.HasValue ? $"Instance ID {instanceId.Value}" : $"Path '{objectPath}'")); + McpLogger.LogInfo($"[MCP Unity] Selected GameObject: {selectedGameObject?.name}"); // Create the response return new JObject { ["success"] = true, ["type"] = "text", - ["message"] = $"Successfully selected GameObject" + - (instanceId.HasValue ? $" with instance ID: {instanceId.Value}" : $": {objectPath}") + ["message"] = $"Successfully selected GameObject {selectedGameObject?.name}" }; } } diff --git a/Editor/Tools/UpdateComponentTool.cs b/Editor/Tools/UpdateComponentTool.cs index 36de206a..390dce0b 100644 --- a/Editor/Tools/UpdateComponentTool.cs +++ b/Editor/Tools/UpdateComponentTool.cs @@ -82,7 +82,6 @@ public override JObject Execute(JObject parameters) // Try to find the component by name Component component = gameObject.GetComponent(componentName); - bool wasAdded = false; // If component not found, try to add it if (component == null) @@ -97,31 +96,41 @@ public override JObject Execute(JObject parameters) } component = Undo.AddComponent(gameObject, componentType); - wasAdded = true; + + // Ensure changes are saved + EditorUtility.SetDirty(gameObject); + if (PrefabUtility.IsPartOfAnyPrefab(gameObject)) + { + PrefabUtility.RecordPrefabInstancePropertyModifications(component); + } + McpLogger.LogInfo($"[MCP Unity] Added component '{componentName}' to GameObject '{gameObject.name}'"); } - // Update component fields if (componentData != null && componentData.Count > 0) { - UpdateComponentData(component, componentData); - } - - // Ensure changes are saved - EditorUtility.SetDirty(gameObject); - if (PrefabUtility.IsPartOfAnyPrefab(gameObject)) - { - PrefabUtility.RecordPrefabInstancePropertyModifications(component); + bool success = UpdateComponentData(component, componentData, out string errorMessage); + // If update failed, return error + if (!success) + { + return McpUnitySocketHandler.CreateErrorResponse(errorMessage, "update_error"); + } + + // Ensure field changes are saved + EditorUtility.SetDirty(gameObject); + if (PrefabUtility.IsPartOfAnyPrefab(gameObject)) + { + PrefabUtility.RecordPrefabInstancePropertyModifications(component); + } + } - + // Create the response return new JObject { ["success"] = true, ["type"] = "text", - ["message"] = wasAdded - ? $"Successfully added component '{componentName}' to GameObject '{gameObject.name}' and updated its data" - : $"Successfully updated component '{componentName}' on GameObject '{gameObject.name}'" + ["message"] = $"Successfully updated component '{componentName}' on GameObject '{gameObject.name}'" }; } @@ -236,27 +245,30 @@ private Type FindComponentType(string componentName) /// The component to update /// The data to apply to the component /// True if the component was updated successfully - private bool UpdateComponentData(Component component, JObject componentData) + private bool UpdateComponentData(Component component, JObject componentData, out string errorMessage) { + errorMessage = ""; + if (component == null || componentData == null) { + errorMessage = "Component or component data is null"; return false; } - + Type componentType = component.GetType(); - bool anySuccess = false; - + bool fullSuccess = true; + // Record object for undo Undo.RecordObject(component, $"Update {componentType.Name} fields"); - // Process each field in the component data + // Process each field or property in the component data foreach (var property in componentData.Properties()) { string fieldName = property.Name; JToken fieldValue = property.Value; // Skip null values - if (fieldValue.Type == JTokenType.Null) + if (string.IsNullOrEmpty(fieldName) || fieldValue.Type == JTokenType.Null) { continue; } @@ -269,18 +281,27 @@ private bool UpdateComponentData(Component component, JObject componentData) { object value = ConvertJTokenToValue(fieldValue, fieldInfo.FieldType); fieldInfo.SetValue(component, value); - anySuccess = true; continue; } - else + + // Try to update property if not found as a field + PropertyInfo propertyInfo = componentType.GetProperty(fieldName, + BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance); + + if (propertyInfo != null) { - McpLogger.LogWarning($"Field '{fieldName}' not found on component '{componentType.Name}'"); + object value = ConvertJTokenToValue(fieldValue, propertyInfo.PropertyType); + propertyInfo.SetValue(component, value); + continue; } + + fullSuccess = false; + errorMessage = $"Field or Property with name '{fieldName}' not found on component '{componentType.Name}'"; } - - return anySuccess; + + return fullSuccess; } - + /// /// Convert a JToken to a value of the specified type /// diff --git a/Editor/UnityBridge/McpUnityEditorWindow.cs b/Editor/UnityBridge/McpUnityEditorWindow.cs index 53cdb197..b53a2226 100644 --- a/Editor/UnityBridge/McpUnityEditorWindow.cs +++ b/Editor/UnityBridge/McpUnityEditorWindow.cs @@ -1,3 +1,4 @@ +using System; using McpUnity.Utils; using UnityEngine; using UnityEditor; @@ -55,7 +56,7 @@ private void OnGUI() DrawHelpTab(); break; } - + // Version info at the bottom GUILayout.FlexibleSpace(); WrappedLabel($"MCP Unity v{McpUnitySettings.ServerVersion}", EditorStyles.miniLabel, GUILayout.Width(150)); @@ -247,49 +248,24 @@ private void DrawServerTab() EditorGUILayout.Space(); - if (GUILayout.Button("Configure Windsurf IDE", GUILayout.Height(30))) - { - bool added = McpUtils.AddToWindsurfIdeConfig(_tabsIndentationJson); - if (added) - { - EditorUtility.DisplayDialog("Success", "The MCP configuration was successfully added to the Windsurf config file.", "OK"); - } - else - { - EditorUtility.DisplayDialog("Error", "The MCP configuration could not be added to the Windsurf config file.", "OK"); - } - } + ShowConfigButton("Windsurf", McpUtils.AddToWindsurfIdeConfig); EditorGUILayout.Space(); - if (GUILayout.Button("Configure Claude Desktop", GUILayout.Height(30))) - { - bool added = McpUtils.AddToClaudeDesktopConfig(_tabsIndentationJson); - if (added) - { - EditorUtility.DisplayDialog("Success", "The MCP configuration was successfully added to the Claude Desktop config file.", "OK"); - } - else - { - EditorUtility.DisplayDialog("Error", "The MCP configuration could not be added to the Claude Desktop config file.", "OK"); - } - } + ShowConfigButton("Claude Desktop", McpUtils.AddToClaudeDesktopConfig); EditorGUILayout.Space(); - if (GUILayout.Button("Configure Cursor", GUILayout.Height(30))) - { - bool added = McpUtils.AddToCursorConfig(_tabsIndentationJson); - if (added) - { - EditorUtility.DisplayDialog("Success", "The MCP configuration was successfully added to the Cursor config file.", "OK"); - } - else - { - EditorUtility.DisplayDialog("Error", "The MCP configuration could not be added to the Cursor Desktop config file.", "OK"); - } - } - + ShowConfigButton("Cursor", McpUtils.AddToCursorConfig); + + EditorGUILayout.Space(); + + ShowConfigButton("Claude Code", McpUtils.AddToClaudeCodeConfig); + + EditorGUILayout.Space(); + + ShowConfigButton("GitHub Copilot", McpUtils.AddToGitHubCopilotConfig); + EditorGUILayout.Separator(); EditorGUILayout.Separator(); @@ -618,6 +594,26 @@ private void WrappedLabel(string text, GUIStyle style = null, params GUILayoutOp EditorGUILayout.LabelField(text, wrappedStyle, options); } + + + + // Helper to show a config button with unified logic + private void ShowConfigButton(string configLabel, Func configAction) + { + if (GUILayout.Button($"Configure {configLabel}", GUILayout.Height(30))) + { + bool added = configAction(_tabsIndentationJson); + if (added) + { + EditorUtility.DisplayDialog("Success", $"The MCP configuration was successfully added to the {configLabel} config file.", "OK"); + } + else + { + EditorUtility.DisplayDialog("Error", $"The MCP configuration could not be added to the {configLabel} config file.", "OK"); + } + } + } + #endregion } diff --git a/Editor/UnityBridge/McpUnityServer.cs b/Editor/UnityBridge/McpUnityServer.cs index 28c231bd..03ae37ac 100644 --- a/Editor/UnityBridge/McpUnityServer.cs +++ b/Editor/UnityBridge/McpUnityServer.cs @@ -249,6 +249,10 @@ private void RegisterTools() // Register AddAssetToSceneTool AddAssetToSceneTool addAssetToSceneTool = new AddAssetToSceneTool(); _tools.Add(addAssetToSceneTool.Name, addAssetToSceneTool); + + // Register CreatePrefabTool + CreatePrefabTool createPrefabTool = new CreatePrefabTool(); + _tools.Add(createPrefabTool.Name, createPrefabTool); } /// diff --git a/Editor/UnityBridge/McpUnitySettings.cs b/Editor/UnityBridge/McpUnitySettings.cs index d93b5564..7ac6e4a3 100644 --- a/Editor/UnityBridge/McpUnitySettings.cs +++ b/Editor/UnityBridge/McpUnitySettings.cs @@ -13,7 +13,7 @@ namespace McpUnity.Unity public class McpUnitySettings { // Constants - public const string ServerVersion = "1.1.1"; + public const string ServerVersion = "1.1.2"; public const string PackageName = "com.gamelovers.mcp-unity"; public const int RequestTimeoutMinimum = 10; diff --git a/Editor/Utils/McpUtils.cs b/Editor/Utils/McpUtils.cs index 8313ebf8..2ecc281d 100644 --- a/Editor/Utils/McpUtils.cs +++ b/Editor/Utils/McpUtils.cs @@ -150,6 +150,24 @@ public static bool AddToCursorConfig(bool useTabsIndentation) string configFilePath = GetCursorConfigPath(); return AddToConfigFile(configFilePath, useTabsIndentation, "Cursor"); } + + /// + /// Adds the MCP configuration to the Claude Code config file + /// + public static bool AddToClaudeCodeConfig(bool useTabsIndentation) + { + string configFilePath = GetClaudeCodeConfigPath(); + return AddToConfigFile(configFilePath, useTabsIndentation, "Claude Code"); + } + + /// + /// Adds the MCP configuration to the GitHub Copilot config file + /// + public static bool AddToGitHubCopilotConfig(bool useTabsIndentation) + { + string configFilePath = GetGitHubCopilotConfigPath(); + return AddToConfigFile(configFilePath, useTabsIndentation, "GitHub Copilot"); + } /// /// Common method to add MCP configuration to a specified config file @@ -168,38 +186,16 @@ private static bool AddToConfigFile(string configFilePath, bool useTabsIndentati // Generate fresh MCP config JSON string mcpConfigJson = GenerateMcpConfigJson(useTabsIndentation); - - // Parse the MCP config JSON - JObject mcpConfig = JObject.Parse(mcpConfigJson); try { + // Parse the MCP config JSON + JObject mcpConfig = JObject.Parse(mcpConfigJson); + // Check if the file exists if (File.Exists(configFilePath)) { - // Read the existing config - string existingConfigJson = File.ReadAllText(configFilePath); - JObject existingConfig = string.IsNullOrEmpty(existingConfigJson) ? new JObject() : JObject.Parse(existingConfigJson); - - // Merge the mcpServers from our config into the existing config - if (mcpConfig["mcpServers"] != null && mcpConfig["mcpServers"] is JObject mcpServers) - { - // Create mcpServers object if it doesn't exist - if (existingConfig["mcpServers"] == null) - { - existingConfig["mcpServers"] = new JObject(); - } - - // Add or update the mcp-unity server config - if (mcpServers["mcp-unity"] != null) - { - ((JObject)existingConfig["mcpServers"])["mcp-unity"] = mcpServers["mcp-unity"]; - } - - // Write the updated config back to the file - File.WriteAllText(configFilePath, existingConfig.ToString(Formatting.Indented)); - return true; - } + return TryMergeMcpServers(configFilePath, mcpConfig, productName); } else if(Directory.Exists(Path.GetDirectoryName(configFilePath))) { @@ -281,9 +277,7 @@ private static string GetClaudeDesktopConfigPath() // Return the path to the claude_desktop_config.json file return Path.Combine(basePath, "claude_desktop_config.json"); } - - - + /// /// Gets the path to the Cursor config file based on the current OS /// @@ -315,6 +309,48 @@ private static string GetCursorConfigPath() return Path.Combine(basePath, "mcp.json"); } + /// + /// Gets the path to the Claude Code config file based on the current OS + /// + /// The path to the Claude Code config file + private static string GetClaudeCodeConfigPath() + { + // Returns the absolute path to the global Claude configuration file. + // Windows: %USERPROFILE%\.claude.json + // macOS/Linux: $HOME/.claude.json + string homeDir; + + if (Application.platform == RuntimePlatform.WindowsEditor) + { + // Windows: %USERPROFILE%\.claude.json + homeDir = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile); + } + else if (Application.platform == RuntimePlatform.OSXEditor) + { + // macOS: ~/.claude.json + homeDir = Environment.GetFolderPath(Environment.SpecialFolder.Personal); + } + else + { + Debug.LogError("Unsupported platform for Claude configuration path resolution"); + return null; + } + + return Path.Combine(homeDir, ".claude.json"); + } + + /// + /// Gets the path to the GitHub Copilot config file (workspace .vscode/mcp.json) + /// + /// The path to the GitHub Copilot config file + private static string GetGitHubCopilotConfigPath() + { + // Default to current Unity project root/.vscode/mcp.json + string projectRoot = Directory.GetParent(Application.dataPath).FullName; + string vscodeDir = Path.Combine(projectRoot, ".vscode"); + return Path.Combine(vscodeDir, "mcp.json"); + } + /// /// Runs an npm command (such as install or build) in the specified working directory. /// Handles cross-platform compatibility (Windows/macOS/Linux) for invoking npm. @@ -391,5 +427,73 @@ public static void RunNpmCommand(string arguments, string workingDirectory) Debug.LogError($"[MCP Unity] Exception while running npm {arguments} in {workingDirectory}. Error: {ex.Message}"); } } + + /// + /// Returns the appropriate config JObject for merging MCP server settings, + /// with special handling for "Claude Code": + /// - For most products, returns the root config object. + /// - For "Claude Code", returns the project-specific config under "projects/[serverPathParent]". + /// Throws a MissingMemberException if the expected project entry does not exist. + /// + private static JObject GetMcpServersConfig(JObject existingConfig, string productName) + { + // For most products, use the root config object. + if (productName != "Claude Code") + { + return existingConfig; + } + + // For Claude Code, use the project-specific config. + if (existingConfig["projects"] == null) + { + throw new MissingMemberException("Claude Code config error: Could not find 'projects' entry in existing config."); + } + + string serverPath = GetServerPath(); + string serverPathParent = Path.GetDirectoryName(serverPath)?.Replace("\\", "/"); + var projectConfig = existingConfig["projects"][serverPathParent]; + + if (projectConfig == null) + { + throw new MissingMemberException( + $"Claude Code config error: Could not find project entry for parent directory '{serverPathParent}' in existing config." + ); + } + + return (JObject)projectConfig; + } + + /// + /// Helper to merge mcpServers from mcpConfig into the existing config file. + /// + private static bool TryMergeMcpServers(string configFilePath, JObject mcpConfig, string productName) + { + // Read the existing config + string existingConfigJson = File.ReadAllText(configFilePath); + JObject existingConfig = string.IsNullOrEmpty(existingConfigJson) ? new JObject() : JObject.Parse(existingConfigJson); + JObject mcpServersConfig = GetMcpServersConfig(existingConfig, productName); + + // Merge the mcpServers from our config into the existing config + if (mcpConfig["mcpServers"] != null && mcpConfig["mcpServers"] is JObject mcpServers) + { + // Create mcpServers object if it doesn't exist + if (mcpServersConfig["mcpServers"] == null) + { + mcpServersConfig["mcpServers"] = new JObject(); + } + + // Add or update the mcp-unity server config + if (mcpServers["mcp-unity"] != null) + { + ((JObject)mcpServersConfig["mcpServers"])["mcp-unity"] = mcpServers["mcp-unity"]; + } + + // Write the updated config back to the file + File.WriteAllText(configFilePath, existingConfig.ToString(Formatting.Indented)); + return true; + } + + return false; + } } } diff --git a/README-ja.md b/README-ja.md index 5da04ada..f64a8669 100644 --- a/README-ja.md +++ b/README-ja.md @@ -1,13 +1,13 @@ # MCP Unity Editor(ゲームエンジン) -[![](https://badge.mcpx.dev?status=on 'MCP 有効')](https://modelcontextprotocol.io/introduction) +[![](https://badge.mcpx.dev?status=on 'MCP Enabled')](https://modelcontextprotocol.io/introduction) [![](https://img.shields.io/badge/Unity-000000?style=flat&logo=unity&logoColor=white 'Unity')](https://unity.com/releases/editor/archive) [![](https://img.shields.io/badge/Node.js-339933?style=flat&logo=nodedotjs&logoColor=white 'Node.js')](https://nodejs.org/en/download/) -[![](https://img.shields.io/github/stars/CoderGamester/mcp-unity 'スター')](https://github.com/CoderGamester/mcp-unity/stargazers) -[![](https://img.shields.io/github/last-commit/CoderGamester/mcp-unity '最終コミット')](https://github.com/CoderGamester/mcp-unity/commits/main) -[![](https://img.shields.io/badge/License-MIT-red.svg 'MIT ライセンス')](https://opensource.org/licenses/MIT) +[![](https://img.shields.io/github/stars/CoderGamester/mcp-unity 'Stars')](https://github.com/CoderGamester/mcp-unity/stargazers) +[![](https://img.shields.io/github/last-commit/CoderGamester/mcp-unity 'Last Commit')](https://github.com/CoderGamester/mcp-unity/commits/main) +[![](https://img.shields.io/badge/License-MIT-red.svg 'MIT License')](https://opensource.org/licenses/MIT) -| [英語](README.md) | [🇨🇳簡体中文](README_zh-CN.md) | [🇯🇵日本語](README-ja.md) | +| [🇺🇸英語](README.md) | [🇨🇳簡体中文](README_zh-CN.md) | [🇯🇵日本語](README-ja.md) | |----------------------|---------------------------------|----------------------| ``` @@ -83,6 +83,9 @@ MCP Unityは、Unityの`Library/PackedCache`フォルダーをワークスペー - `add_asset_to_scene`: AssetDatabaseからアセットをUnityシーンに追加 > **例:** "プロジェクトからPlayerプレハブを現在のシーンに追加" +- `create_prefab`: プレハブを作成し、オプションでMonoBehaviourスクリプトとシリアライズされたフィールド値を設定 + > **例:** "'PlayerController'スクリプトから'Player'という名前のプレハブを作成" + ### MCPサーバーリソース - `unity://menu-items`: `execute_menu_item`ツールを容易にするために、Unityエディターで利用可能なすべてのメニュー項目のリストを取得 @@ -111,8 +114,6 @@ MCP Unityは、Unityの`Library/PackedCache`フォルダーをワークスペー - Node.js 18以降 - [サーバーを起動](#start-server)するため - npm 9以降 - [サーバーをデバッグ](#debug-server)するため -## インストール - > [!IMPORTANT] > **プロジェクトパスにスペースを含めることはできません** > @@ -125,6 +126,8 @@ MCP Unityは、Unityの`Library/PackedCache`フォルダーをワークスペー > > インストールを進める前に、プロジェクトがスペースを含まないパスにあることを確認してください。 +## インストール + このMCP Unityサーバーのインストールは複数ステップのプロセスです: ### ステップ1: Node.jsをインストール @@ -210,35 +213,24 @@ AIクライアントのMCP設定ファイル(例:Claude Desktopのclaude_des ## サーバーの起動 -MCP Unityサーバーを起動するには2つの方法があります: - -## オプション: Node.jsサーバーのインストール -デフォルトでは、Node.jsサーバーは `Server~/` ディレクトリにインストールされます。 -問題が発生した場合は、以下の手順で強制的にインストールできます: - 1. Unityエディターを開く -2. メニューから Tools > MCP Unity > Server Window に移動 -3. 「Force Install Server」ボタンをクリック +2. Tools > MCP Unity > Server Window に移動 +3. "Start Server" をクリックして WebSocket サーバーを起動 +4. Claude Desktop または AI コーディング IDE(例:Cursor IDE、Windsurf IDE など)を開き、Unity ツールの実行を開始 + +![connect](https://github.com/user-attachments/assets/2e266a8b-8ba3-4902-b585-b220b11ab9a2) -> [!TIP] -> Node.js サーバーは `Server~/` ディレクトリにインストールされます。 +> AI クライアントが WebSocket サーバーに接続すると、ウィンドウの緑色のボックスに自動的に表示されます +## オプション:WebSocket ポートを設定 +デフォルトでは、WebSocket サーバーは '8090' ポートで動作します。次の手順でポートを変更できます: -### オプション1: Unityエディター経由で起動 1. Unityエディターを開く -2. Tools > MCP Unity > Server Windowに移動 -3. "Start Server"ボタンをクリック -4. Open Claude Desktop or your AI Coding IDE (e.g. Cursor IDE, Windsurf IDE, etc.) and start executing Unity tools - -![connect](https://github.com/user-attachments/assets/2e266a8b-8ba3-4902-b585-b220b11ab9a2) - -### オプション2: コマンドラインから起動 -1. ターミナルまたはコマンドプロンプトを開く -2. MCP Unityサーバーディレクトリに移動 -3. 以下のコマンドを実行: - ```bash - node Server~/build/index.js - ``` +2. Tools > MCP Unity > Server Window に移動 +3. "WebSocket Port" の値を希望のポート番号に変更 +4. Unity はシステム環境変数 UNITY_PORT を新しいポート番号に設定 +5. Node.js サーバーを再起動 +6. 再度 "Start Server" をクリックして、Unity Editor の WebSocket を Node.js MCP サーバーに再接続 ## オプション: タイムアウト設定 @@ -267,29 +259,74 @@ MCP Unityサーバーを起動するには2つの方法があります: 6. リモートで MCP ブリッジを実行する場合は、環境変数 UNITY_HOST を Unity 実行マシンの IP アドレスに設定して起動: `UNITY_HOST=192.168.1.100 node server.js` -## サポート & フィードバック +## サーバーのデバッグ -ご質問やサポートが必要な場合は、このリポジトリの[Issue](https://github.com/CoderGamester/mcp-unity/issues)を開くか、以下までご連絡ください: -- LinkedIn: [![](https://img.shields.io/badge/LinkedIn-0077B5?style=flat&logo=linkedin&logoColor=white 'LinkedIn')](https://www.linkedin.com/in/miguel-tomas/) -- Discord: gamester7178 -- Email: game.gamester@gmail.com +
+Node.js サーバーのビルド -## 貢献 +MCP Unity サーバーは Node.js で構築されています。TypeScript コードを `build` ディレクトリにコンパイルする必要があります。問題がある場合は、以下の手順で強制的にインストールできます: -貢献は大歓迎です!プルリクエストを送信するか、Issueを開いてください。 +1. Unityエディターを開く +2. Tools > MCP Unity > Server Window に移動 +3. 「Force Install Server」ボタンをクリック -**コミットメッセージ**は[Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/)形式に従ってください。 +![install](docs/install.jpg) -## ライセンス +手動でビルドする場合は、以下の手順に従ってください: -本プロジェクトは[MIT License](License.md)の下で提供されます。 +1. ターミナル/PowerShell/コマンドプロンプトを開く +2. Server ディレクトリに移動: + ```bash + cd ABSOLUTE/PATH/TO/mcp-unity/Server~ + ``` +3. 依存関係をインストール: + ```bash + npm install + ``` +4. サーバーをビルド: + ```bash + npm run build + ``` +5. サーバーを実行: + ```bash + node build/index.js + ``` -## 謝辞 +
+ +
+MCP Inspector でデバッグ + +[@modelcontextprotocol/inspector](https://github.com/modelcontextprotocol/inspector) を使用してサーバーをデバッグします: + - Powershell + ```powershell + npx @modelcontextprotocol/inspector node Server~/build/index.js + ``` + - コマンドプロンプト/ターミナル + ```cmd + npx @modelcontextprotocol/inspector node Server~/build/index.js + ``` + +ターミナルを閉じる前、または [MCP Inspector](https://github.com/modelcontextprotocol/inspector) でデバッグする前に、必ず `Ctrl + C` でサーバーを終了してください。 + +
-- Model Context Protocol -- Unity Technologies -- Node.js -- WebSocket-Sharp +
+コンソールログを有効化 + +1. ターミナルまたは log.txt ファイルにログ出力を有効化: + - Powershell + ```powershell + $env:LOGGING = "true" + $env:LOGGING_FILE = "true" + ``` + - コマンドプロンプト/ターミナル + ```cmd + set LOGGING=true + set LOGGING_FILE=true + ``` + +
## よくある質問 @@ -371,3 +408,100 @@ MCP Unityは、MCPクライアントとして機能できるAIアシスタント
MCP Unityに接続できないのはなぜですか? + +- WebSocket サーバーが起動していることを確認(Unity の Server Window を確認) +- MCP クライアントからコンソールログを 1 件送信して、MCP クライアントと Unity サーバー間の再接続をトリガー +- Unity Editor の MCP Server ウィンドウ(Tools > MCP Unity > Server Window)でポート番号を変更 + +
+ +
+MCP Unity サーバーが起動しないのはなぜですか? + +- Unity コンソールにエラーメッセージがないか確認 +- Node.js が正しくインストールされ、PATH から実行できることを確認 +- Server ディレクトリで依存関係がインストールされていることを確認 + +
+ +
+Play Mode テストを実行すると接続失敗エラーが発生するのはなぜですか? + +`run_tests` ツールは次のレスポンスを返すことがあります: +``` +Error: +Connection failed: Unknown error +``` + +これは、Play Mode に切り替える際のドメインリロードでブリッジ接続が失われるために発生します。回避策として、**Edit > Project Settings > Editor > "Enter Play Mode Settings"** で **Reload Domain** をオフにしてください。 + +
+ +## トラブルシューティング:WSL2(Windows 11)のネットワーク + +WSL2 内で MCP(Node.js)サーバーを実行し、Unity が Windows 11 上で動作している場合、`ws://localhost:8090/McpUnity` への接続が `ECONNREFUSED` で失敗することがあります。 + +原因:WSL2 と Windows は別々のネットワーク名前空間を持ち、WSL2 内の `localhost` は Windows ホストを指しません。既定では Unity は `localhost:8090` で待ち受けます。 + +### 解決策 1 — WSL2 のミラー化ネットワークを有効化(推奨) +- Windows 11: 設定 → システム → 開発者向け → WSL → 「ミラー化モードのネットワーク」を有効化。 +- または `.wslconfig` で設定(適用後に `wsl --shutdown` を実行して WSL を再起動): + +```ini +[wsl2] +networkingMode=mirrored +``` + +有効化後は Windows と WSL2 で `localhost` が共有され、既定設定(`localhost:8090`)で動作します。 + +### 解決策 2 — Node クライアントを Windows ホストに向ける +MCP クライアントを起動する前に、WSL シェルで以下を設定します: + +```bash +# resolv.conf から検出した Windows ホスト IP を使用 +export UNITY_HOST=$(grep -m1 nameserver /etc/resolv.conf | awk '{print $2}') +``` + +これにより、`Server~/src/unity/mcpUnity.ts` は `localhost` の代わりに `ws://$UNITY_HOST:8090/McpUnity` に接続します(`UNITY_HOST` を参照し、必要に応じて `ProjectSettings/McpUnitySettings.json` の `Host` も使用されます)。 + +### 解決策 3 — Unity からのリモート接続を許可 +- Unity: Tools → MCP Unity → Server Window → 「Allow Remote Connections」を有効化(`0.0.0.0` にバインド)。 +- Windows ファイアウォールで、設定したポート(既定 8090)への受信 TCP を許可します。 +- WSL2 からは、Windows ホストの IP(解決策 2 を参照)またはミラー化有効時は `localhost` へ接続します。 + +> [!NOTE] +> 既定のポートは `8090` です。Unity の Server Window(Tools → MCP Unity → Server Window)で変更できます。値は `McpUnitySettings` に対応し、`ProjectSettings/McpUnitySettings.json` に保存されます。 + +#### 接続確認 + +```bash +npm i -g wscat +# ミラー化ネットワーク有効化後 +wscat -c ws://localhost:8090/McpUnity +# または Windows ホスト IP を使用 +wscat -c ws://$UNITY_HOST:8090/McpUnity +``` + +## サポート & フィードバック + +ご質問やサポートが必要な場合は、このリポジトリの[Issue](https://github.com/CoderGamester/mcp-unity/issues)を開くか、以下までご連絡ください: +- LinkedIn: [![](https://img.shields.io/badge/LinkedIn-0077B5?style=flat&logo=linkedin&logoColor=white 'LinkedIn')](https://www.linkedin.com/in/miguel-tomas/) +- Discord: gamester7178 +- Email: game.gamester@gmail.com + +## 貢献 + +貢献は大歓迎です!プルリクエストを送信するか、Issueを開いてください。 + +**コミットメッセージ**は[Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/)形式に従ってください。 + +## ライセンス + +本プロジェクトは[MIT License](LICENSE.md)の下で提供されます。 + +## 謝辞 + +- [Model Context Protocol](https://modelcontextprotocol.io) +- [Unity Technologies](https://unity.com) +- [Node.js](https://nodejs.org) +- [WebSocket-Sharp](https://github.com/sta/websocket-sharp) diff --git a/README.md b/README.md index 5df08f45..db28e90b 100644 --- a/README.md +++ b/README.md @@ -7,10 +7,12 @@ [![](https://img.shields.io/github/last-commit/CoderGamester/mcp-unity 'Last Commit')](https://github.com/CoderGamester/mcp-unity/commits/main) [![](https://img.shields.io/badge/License-MIT-red.svg 'MIT License')](https://opensource.org/licenses/MIT) -| [English](README.md) | [🇨🇳简体中文](README_zh-CN.md) | [🇯🇵日本語](README-ja.md) | +[![Trust Score](https://archestra.ai/mcp-catalog/api/badge/quality/CoderGamester/mcp-unity)](https://archestra.ai/mcp-catalog/codergamester__mcp-unity) + +| [🇺🇸English](README.md) | [🇨🇳简体中文](README_zh-CN.md) | [🇯🇵日本語](README-ja.md) | |----------------------|---------------------------------|----------------------| -``` +``` ,/(/. *(/, */(((((/. *((((((*. .*((((((((((/. *((((((((((/. @@ -85,6 +87,9 @@ The following tools are available for manipulating and querying Unity scenes and - `add_asset_to_scene`: Adds an asset from the AssetDatabase to the Unity scene > **Example prompt:** "Add the Player prefab from my project to the current scene" +- `create_prefab`: Creates a prefab with optional MonoBehaviour script and serialized field values + > **Example prompt:** "Create a prefab named 'Player' from the 'PlayerController' script" + ### MCP Server Resources - `unity://menu-items`: Retrieves a list of all available menu items in the Unity Editor to facilitate `execute_menu_item` tool @@ -435,11 +440,55 @@ Error: Connection failed: Unknown error ``` -This error occurs because the bridge connection is lost when the domain reloads upon switching to Play Mode. -The workaround is to turn off **Reload Domain** in **Edit > Project Settings > Editor > "Enter Play Mode Settings"**. +This error occurs because the bridge connection is lost when the domain reloads upon switching to Play Mode. The workaround is to turn off **Reload Domain** in **Edit > Project Settings > Editor > "Enter Play Mode Settings"**. +## Troubleshooting: WSL2 (Windows 11) networking + +When running the MCP (Node.js) server inside WSL2 while Unity runs on Windows 11, connecting to `ws://localhost:8090/McpUnity` may fail with `ECONNREFUSED`. + +Cause: WSL2 and Windows have separate network namespaces — `localhost` inside WSL2 does not point to the Windows host. By default, Unity listens on `localhost:8090`. + +### Solution 1 — Enable WSL2 Mirrored mode networking (preferred) +- Windows 11: Settings → System → For developers → WSL → Enable “Mirrored mode networking”. +- Or via `.wslconfig` (then run `wsl --shutdown` and reopen WSL): + +```ini +[wsl2] +networkingMode=mirrored +``` + +After enabling, `localhost` is shared between Windows and WSL2, so the default config (`localhost:8090`) works. + +### Solution 2 — Point the Node client to the Windows host +Set in your WSL shell before starting the MCP client: + +```bash +# Use the Windows host IP detected from resolv.conf +export UNITY_HOST=$(grep -m1 nameserver /etc/resolv.conf | awk '{print $2}') +``` + +With this, `Server~/src/unity/mcpUnity.ts` will connect to `ws://$UNITY_HOST:8090/McpUnity` instead of `localhost` (it reads `UNITY_HOST`, and may also honor a `Host` in `ProjectSettings/McpUnitySettings.json` if present). + +### Solution 3 — Allow remote connections from Unity +- Unity: Tools → MCP Unity → Server Window → enable “Allow Remote Connections” (Unity binds to `0.0.0.0`). +- Ensure Windows Firewall allows inbound TCP on your configured port (default 8090). +- From WSL2, connect to the Windows host IP (see Solution 2) or to `localhost` if mirrored mode is enabled. + +> [!NOTE] +> Default port is `8090`. You can change it in the Unity Server Window (Tools → MCP Unity → Server Window). The value maps to `McpUnitySettings` and is persisted in `ProjectSettings/McpUnitySettings.json`. + +#### Validate connectivity + +```bash +npm i -g wscat +# After enabling mirrored networking +wscat -c ws://localhost:8090/McpUnity +# Or using the Windows host IP +wscat -c ws://$UNITY_HOST:8090/McpUnity +``` + ## Support & Feedback If you have any questions or need support, please open an [issue](https://github.com/CoderGamester/mcp-unity/issues) on this repository or alternative you can reach out on: @@ -455,7 +504,7 @@ Contributions are welcome! Please feel free to submit a Pull Request or open an ## License -This project is under [MIT License](License.md) +This project is under [MIT License](LICENSE.md) ## Acknowledgements diff --git a/README_zh-CN.md b/README_zh-CN.md index 51a26107..c5a70fbf 100644 --- a/README_zh-CN.md +++ b/README_zh-CN.md @@ -1,13 +1,13 @@ # MCP Unity Editor(游戏引擎) -[![](https://badge.mcpx.dev?status=on 'MCP 启用')](https://modelcontextprotocol.io/introduction) +[![](https://badge.mcpx.dev?status=on 'MCP Enabled')](https://modelcontextprotocol.io/introduction) [![](https://img.shields.io/badge/Unity-000000?style=flat&logo=unity&logoColor=white 'Unity')](https://unity.com/releases/editor/archive) [![](https://img.shields.io/badge/Node.js-339933?style=flat&logo=nodedotjs&logoColor=white 'Node.js')](https://nodejs.org/en/download/) [![](https://img.shields.io/github/stars/CoderGamester/mcp-unity 'Stars')](https://github.com/CoderGamester/mcp-unity/stargazers) [![](https://img.shields.io/github/last-commit/CoderGamester/mcp-unity 'Last Commit')](https://github.com/CoderGamester/mcp-unity/commits/main) -[![](https://img.shields.io/badge/License-MIT-red.svg 'MIT 许可证')](https://opensource.org/licenses/MIT) +[![](https://img.shields.io/badge/License-MIT-red.svg 'MIT License')](https://opensource.org/licenses/MIT) -| [英文](README.md) | [🇨🇳简体中文](README_zh-CN.md) | [🇯🇵日本語](README-ja.md) | +| [🇺🇸英文](README.md) | [🇨🇳简体中文](README_zh-CN.md) | [🇯🇵日本語](README-ja.md) | |----------------------|---------------------------------|----------------------| @@ -45,7 +45,7 @@ MCP Unity 是 Model Context Protocol 在 Unity 编辑器中的实现,允许 AI 助手与您的 Unity 项目交互。这个包提供了 Unity 和实现 MCP 协议的 Node.js 服务器之间的桥梁,使 Claude、Windsurf 和 Cursor 等 AI 代理能够在 Unity 编辑器中执行操作。 - Unity MCP 服务器 + Unity MCP server ## 功能 @@ -84,6 +84,9 @@ MCP Unity 通过将 Unity `Library/PackedCache` 文件夹添加到您的工作 - `add_asset_to_scene`: 将 AssetDatabase 中的资源添加到 Unity 场景中 > **示例提示:** "将我的项目中的 Player 预制体添加到当前场景" +- `create_prefab`: 创建预制体,并可选择添加 MonoBehaviour 脚本和设置序列化字段值 + > **示例提示:** "从 'PlayerController' 脚本创建一个名为 'Player' 的预制体" + ### MCP 服务器资源 - `unity://menu-items`: 获取 Unity 编辑器中所有可用的菜单项列表,以方便 `execute_menu_item` 工具 @@ -112,8 +115,6 @@ MCP Unity 通过将 Unity `Library/PackedCache` 文件夹添加到您的工作 - Node.js 18 或更高版本 - 用于[启动服务器](#start-server) - npm 9 或更高版本 - 用于[调试服务器](#debug-server) -## 安装 - > [!IMPORTANT] > **项目路径不能包含空格** > @@ -126,6 +127,8 @@ MCP Unity 通过将 Unity `Library/PackedCache` 文件夹添加到您的工作 > > 在继续安装之前,请确保您的项目位于不含空格的路径中。 +## 安装 + 安装 MCP Unity 服务器是一个多步骤过程: ### 步骤 1: 安装 Node.js @@ -339,50 +342,47 @@ MCP Unity 是一个功能强大的桥梁,使用 Model Context Protocol (MCP) 本质上,MCP Unity: - 将 Unity 编辑器功能(如创建对象、修改组件、运行测试等)公开为 AI 可以理解和使用的“工具”和“资源”。 -- 在 Unity 内部运行 WebSocket 服务器,并在 Node.js 服务器(作为 Unity 的 WebSocket 客户端)中实现 MCP。这允许 AI 助手向 Unity 发送命令并接收信息。 -- 使您能够使用 AI 助手通过自然语言提示在 Unity 项目中执行复杂任务,从而显著加快开发工作流程。 +- 在 Unity 内运行 WebSocket 服务器,并在 Node.js 服务器(作为 Unity 的 WebSocket 客户端)中实现 MCP。这允许 AI 助手向 Unity 发送命令并接收信息。 +- 使您能够使用自然语言提示与 AI 助手在 Unity 项目中执行复杂任务,从而显著加快开发工作流程。
为什么要使用 MCP Unity? -MCP Unity 为开发人员、美工和项目经理提供了几个引人注目的优势: +MCP Unity 为开发人员、美术和项目经理提供了多个优势: -- **加速开发:** 使用 AI 提示自动化重复任务、生成样板代码和管理资产。这使您有时间专注于创造性和复杂的解决问题。 -- **提高生产力:** 无需手动点击菜单或编写脚本即可与 Unity 编辑器功能交互。您的 AI 助手成为您在 Unity 中能力的直接延伸。 -- **提高可访问性:** 允许不熟悉 Unity 编辑器或 C# 脚本的深层复杂性用户仍然通过 AI 指导对项目做出有意义的贡献和修改。 -- **无缝集成:** 旨在与支持 MCP 的各种 AI 助手和 IDE 配合使用,提供一种一致的方式来利用 AI 跨您的开发工具包。 -- **可扩展性:** 协议和工具集可以扩展。您可以定义新的工具和资源,以向 AI 公开更多特定于项目或 Unity 的功能。 -- **协作潜力:** 促进了一种新的协作方式,AI 可以协助传统上由团队成员完成的任务,或者通过指导他们了解项目结构和操作来帮助新开发人员入职。 +- **加速开发:** 使用 AI 提示自动化重复任务、生成样板代码并管理资源。 +- **提高生产力:** 无需手动点击菜单或为简单操作编写脚本即可与 Unity 编辑器交互。 +- **提高可访问性:** 让不熟悉 Unity 编辑器或 C# 的用户也能在 AI 引导下进行有效修改。 +- **无缝集成:** 适配支持 MCP 的多种 AI 助手和 IDE。 +- **可扩展性:** 可以扩展协议和工具集,按需暴露更多项目/Unity 功能。 +- **协作潜力:** 促进新的协作方式,帮助新人上手项目结构与操作。
MCP Unity 与即将发布的 Unity 6.2 AI 功能有何比较? -Unity 6.2 将引入新的内置 AI 工具,包括之前的 Unity Muse(用于生成纹理和动画等生成式 AI 功能)和 Unity Sentis(用于在 Unity 运行时运行神经网络)。由于 Unity 6.2 尚未完全发布,此比较基于公开信息和预期功能: - - **焦点:** - - **MCP Unity:** 主要侧重于**编辑器自动化和交互**。它允许外部 AI(例如基于 LLM 的编码助手)*控制和查询 Unity 编辑器本身*来操作场景、资产和项目设置。它旨在增强编辑器内的*开发人员工作流程*。 + - **MCP Unity:** 侧重于**编辑器自动化与交互**,允许外部 AI *控制和查询 Unity 编辑器* 来操作场景、资源与项目设置。 - **Unity 6.2 AI:** - - 旨在在编辑器内创建内容(生成纹理、精灵、动画、行为、脚本)以及 AI 驱动的常见任务协助,直接集成到 Unity 编辑器界面中。 - - 一个经过微调的模型,可以询问有关 Unity 文档和 API 结构的任何问题,并提供更准确的 Unity 环境自定义示例。 - - 添加了运行 AI 模型推理的功能,允许开发人员*在您的游戏或应用程序中*部署和运行预训练神经网络,以实现 NPC 行为、图像识别等功能。 + - 在编辑器内进行内容生成(纹理、精灵、动画、行为、脚本)和 AI 辅助,直接集成到编辑器界面。 + - 提供微调模型以回答关于 Unity 文档与 API 结构的问题。 + - 增加运行 AI 推理能力,支持在运行时*部署并运行*预训练网络(如 NPC 行为、图像识别等)。 - **用例:** - - **MCP Unity:** “创建一个新的 3D 对象,将其命名为 ‘Player’,添加一个 Rigidbody,并将其质量设置为 10。”“运行所有 Play Mode 测试。”“要求修复控制台日志中的错误。”“执行自定义菜单项 ‘Prepare build for iOS’ 并修复可能发生的任何错误。” - - **Unity 6.2 AI:** “为这个材质生成一个科幻纹理。”“更新场景中所有树木的位置,使其放置在标记为 ‘forest’ 的地形区域内。”“为这个角色创建一个行走动画。”“生成 2D 精灵以完成角色。”“询问控制台日志中错误的详细信息。” + - **MCP Unity:** “创建一个新的 3D 对象,将其命名为 ‘Player’,添加 Rigidbody,并将质量设为 10。” “运行所有 Play Mode 测试。” “请求修复控制台错误。” “执行自定义菜单项 ‘Prepare build for iOS’ 并修复错误。” + - **Unity 6.2 AI:** “为该材质生成科幻纹理。” “将所有树木放入标记为 ‘forest’ 的区域。” “创建行走动画。” “生成 2D 精灵。” “询问控制台错误细节。” -- **互补,而非互斥:** - MCP Unity 和 Unity 的原生 AI 工具可以被视为互补的。您可以使用 MCP Unity 和您的 AI 编码助手来设置场景或批量修改资产,然后使用 Unity AI 工具来生成特定纹理,或创建动画,或为其中一个资产创建 2D 精灵。MCP Unity 提供了一种灵活的、基于协议的方式与编辑器交互,这对于希望与更广泛的外部 AI 服务集成或构建自定义自动化工作流程的开发人员来说非常强大。 +- **互补而非互斥:** 两者可以互补:用 MCP Unity 做编辑器自动化/批量修改,再用 Unity AI 工具做内容生成。
-目前哪些 MCP 主机和 IDE 支持 MCP Unity? +当前哪些 MCP 主机和 IDE 支持 MCP Unity? -MCP Unity 旨在与任何可以作为 MCP 客户端的 AI 助手或开发环境配合使用。生态系统正在不断发展,但目前已知的集成或兼容平台包括: +已知兼容的平台包括: - Windsurf - Cursor - GitHub Copilot @@ -393,32 +393,115 @@ MCP Unity 旨在与任何可以作为 MCP 客户端的 AI 助手或开发环境
我可以为我的项目扩展 MCP Unity 以使用自定义工具吗? -是的,当然可以!MCP Unity 架构的一个显著优点是其可扩展性。 -- **在 Unity (C#) 中:** 您可以创建继承自 `McpToolBase`(或资源类似基类)的新 C# 类,以公开自定义 Unity 编辑器功能。这些工具随后将在 `McpUnityServer.cs` 中注册。例如,您可以编写一个工具来自动化您项目特有的特定资产导入管道。 -- **在 Node.js 服务器 (TypeScript) 中:** 然后您需要在 `Server/src/tools/` 目录中定义相应的 TypeScript 工具处理程序,包括其用于输入/输出的 Zod 模式,并在 `Server/src/index.ts` 中注册。此 Node.js 部分会将请求转发到 Unity 中的新 C# 工具。 - -这使您能够根据游戏或应用程序的特定需求和工作流程调整 AI 的功能。 +可以。 +- **在 Unity (C#) 中:** 创建继承自 `McpToolBase` 的 C# 类并在 `McpUnityServer.cs` 注册。 +- **在 Node.js (TypeScript) 中:** 在 `Server/src/tools/` 定义对应工具(含 Zod 输入/输出模式),并在 `Server/src/index.ts` 注册。Node 端会将请求转发给 Unity C# 工具。
MCP Unity 是免费使用的吗? -是的,MCP Unity 是一个在 MIT 许可证下分发的开源项目。您可以根据许可证条款自由使用、修改和分发它。 +是的,MCP Unity 在 MIT 许可证下开源发布。
为什么我无法连接到 MCP Unity? -如果您无法连接到 MCP Unity,请检查以下常见问题: +- 确认 WebSocket 服务器已启动(在 Unity 的 Server Window) +- 从 MCP 客户端发送一条控制台日志以强制重连 +- 在 Unity Editor MCP Server 窗口更改端口号(Tools > MCP Unity > Server Window) + +
+ +
+为什么 MCP Unity 服务器无法启动? + +- 检查 Unity 控制台错误 +- 确保 Node.js 已安装并在 PATH 中 +- 验证 Server 目录依赖已安装 + +
+ +
+为什么运行 Play Mode 测试时会出现连接失败错误? + +`run_tests` 工具会返回: +``` +Error: +Connection failed: Unknown error +``` + +这是因为切换到 Play Mode 时域重载导致桥接连接丢失。解决方法是在 **Edit > Project Settings > Editor > "Enter Play Mode Settings"** 中关闭 **Reload Domain**。 + +
+ +## 故障排除:WSL2(Windows 11)网络 + +当 MCP(Node.js)服务器在 WSL2 内运行,而 Unity 在 Windows 11 上运行时,连接 `ws://localhost:8090/McpUnity` 可能会失败并报错 `ECONNREFUSED`。 + +原因:WSL2 与 Windows 使用不同的网络命名空间——WSL2 内的 `localhost` 并不指向 Windows 主机。默认情况下,Unity 监听 `localhost:8090`。 + +### 解决方案 1 — 启用 WSL2 镜像网络(推荐) +- Windows 11:设置 → 系统 → 面向开发人员 → WSL → 启用“镜像模式网络”。 +- 或通过 `.wslconfig`(之后执行 `wsl --shutdown` 并重新打开 WSL): + +```ini +[wsl2] +networkingMode=mirrored +``` + +启用后,Windows 与 WSL2 共享 `localhost`,默认配置(`localhost:8090`)即可正常工作。 + +### 解决方案 2 — 将 Node 客户端指向 Windows 主机 +在启动 MCP 客户端之前,在 WSL 终端中设置: + +```bash +# 从 resolv.conf 中检测 Windows 主机 IP +export UNITY_HOST=$(grep -m1 nameserver /etc/resolv.conf | awk '{print $2}') +``` + +这样,`Server~/src/unity/mcpUnity.ts` 将连接到 `ws://$UNITY_HOST:8090/McpUnity` 而不是 `localhost`(它读取 `UNITY_HOST`,如果 `ProjectSettings/McpUnitySettings.json` 中存在 `Host` 字段,也会优先使用)。 + +### 解决方案 3 — 允许 Unity 接受远程连接 +- Unity:Tools → MCP Unity → Server Window → 勾选“Allow Remote Connections”(Unity 绑定到 `0.0.0.0`)。 +- 确保 Windows 防火墙允许所配置端口(默认 8090)的入站 TCP。 +- 在 WSL2 中,连接到 Windows 主机 IP(见解决方案 2),或在启用镜像网络后连接 `localhost`。 + +> [!NOTE] +> 默认端口为 `8090`。您可以在 Unity 的 Server Window(Tools → MCP Unity → Server Window)中进行更改。该值映射到 `McpUnitySettings`,并持久化到 `ProjectSettings/McpUnitySettings.json`。 + +#### 验证连接 + +```bash +npm i -g wscat +# 启用镜像网络后 +wscat -c ws://localhost:8090/McpUnity +# 或使用 Windows 主机 IP +wscat -c ws://$UNITY_HOST:8090/McpUnity +``` + +## 支持与反馈 + +如有问题或需要支持,请在本仓库提交 [issue](https://github.com/CoderGamester/mcp-unity/issues),或通过以下方式联系: +- Linkedin: [![](https://img.shields.io/badge/LinkedIn-0077B5?style=flat&logo=linkedin&logoColor=white 'LinkedIn')](https://www.linkedin.com/in/miguel-tomas/) +- Discord: gamester7178 +- Email: game.gamester@gmail.com + +## 贡献 + +欢迎贡献!欢迎提交 Pull Request 或 Issue。 + +提交请遵循 [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/) 规范。 + +## 许可证 + +本项目使用 [MIT License](LICENSE.md) 授权。 -- **项目路径:** 确保您的 Unity 项目路径不包含任何空格。这是最常见的问题。 -- **服务器状态:** 确保 MCP Unity 服务器正在运行。您可以在 Unity 编辑器中通过 Tools > MCP Unity > Server Window 检查其状态。 -- **端口冲突:** 确保 MCP Unity 服务器使用的端口(默认为 8090)没有被其他应用程序占用。 -- **防火墙:** 检查您的防火墙设置,确保它没有阻止 MCP Unity 服务器的连接。 -- **Node.js 版本:** 确保您安装了 Node.js 18 或更高版本。 -- **MCP 客户端配置:** 确保您的 AI 客户端已正确配置为连接到 MCP Unity 服务器。检查 `mcpServers` 配置中的 `command` 和 `args` 是否正确。 -- **日志:** 启用服务器日志以获取更多详细信息。在终端中设置 `LOGGING=true` 和 `LOGGING_FILE=true` 环境变量,然后重新启动服务器。 +## 鸣谢 -如果您仍然遇到问题,请在 GitHub 仓库中打开一个 Issue,并提供尽可能多的详细信息,包括错误消息、日志和您的配置。 +- [Model Context Protocol](https://modelcontextprotocol.io) +- [Unity Technologies](https://unity.com) +- [Node.js](https://nodejs.org) +- [WebSocket-Sharp](https://github.com/sta/websocket-sharp) diff --git a/Server~/Dockerfile b/Server~/Dockerfile index 75daceef..8d92ee02 100644 --- a/Server~/Dockerfile +++ b/Server~/Dockerfile @@ -47,12 +47,12 @@ RUN chown -R nodejs:nodejs /app # Switch to non-root user USER nodejs -# Expose WebSocket port -EXPOSE 8090 +# Expose WebSocket and HTTP ports +EXPOSE 8090 3000 # Health check to ensure the application is running HEALTHCHECK --interval=30s --timeout=5s --start-period=5s --retries=3 \ - CMD wget --no-verbose --tries=1 --spider http://localhost:8090/health || exit 1 + CMD wget --no-verbose --tries=1 --spider http://localhost:3000/health || exit 1 # Command to run the MCP server ENTRYPOINT ["node", "build/index.js"] diff --git a/Server~/package-lock.json b/Server~/package-lock.json new file mode 100644 index 00000000..a035aa05 --- /dev/null +++ b/Server~/package-lock.json @@ -0,0 +1,1339 @@ +{ + "name": "mcp-unity-server", + "version": "1.0.0", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "mcp-unity-server", + "version": "1.0.0", + "license": "MIT", + "dependencies": { + "@modelcontextprotocol/sdk": "^1.7.0", + "axios": "^1.8.4", + "cors": "^2.8.5", + "express": "^5.0.1", + "uuid": "^11.1.0", + "winreg": "^1.2.5", + "ws": "^8.18.1", + "zod": "^3.24.4", + "zod-to-json-schema": "^3.24.3" + }, + "bin": { + "mcp-unity-server": "build/index.js" + }, + "devDependencies": { + "@types/cors": "^2.8.17", + "@types/express": "^5.0.0", + "@types/node": "^22.13.10", + "@types/uuid": "^10.0.0", + "@types/winreg": "^1.2.36", + "@types/ws": "^8.18.0", + "typescript": "^5.8.2" + } + }, + "node_modules/@modelcontextprotocol/sdk": { + "version": "1.8.0", + "resolved": "https://registry.npmjs.org/@modelcontextprotocol/sdk/-/sdk-1.8.0.tgz", + "integrity": "sha512-e06W7SwrontJDHwCawNO5SGxG+nU9AAx+jpHHZqGl/WrDBdWOpvirC+s58VpJTB5QemI4jTRcjWT4Pt3Q1NPQQ==", + "license": "MIT", + "dependencies": { + "content-type": "^1.0.5", + "cors": "^2.8.5", + "cross-spawn": "^7.0.3", + "eventsource": "^3.0.2", + "express": "^5.0.1", + "express-rate-limit": "^7.5.0", + "pkce-challenge": "^4.1.0", + "raw-body": "^3.0.0", + "zod": "^3.23.8", + "zod-to-json-schema": "^3.24.1" + }, + "engines": { + "node": ">=18" + } + }, + "node_modules/@types/body-parser": { + "version": "1.19.5", + "resolved": "https://registry.npmjs.org/@types/body-parser/-/body-parser-1.19.5.tgz", + "integrity": "sha512-fB3Zu92ucau0iQ0JMCFQE7b/dv8Ot07NI3KaZIkIUNXq82k4eBAqUaneXfleGY9JWskeS9y+u0nXMyspcuQrCg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/connect": "*", + "@types/node": "*" + } + }, + "node_modules/@types/connect": { + "version": "3.4.38", + "resolved": "https://registry.npmjs.org/@types/connect/-/connect-3.4.38.tgz", + "integrity": "sha512-K6uROf1LD88uDQqJCktA4yzL1YYAK6NgfsI0v/mTgyPKWsX1CnJ0XPSDhViejru1GcRkLWb8RlzFYJRqGUbaug==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/node": "*" + } + }, + "node_modules/@types/cors": { + "version": "2.8.17", + "resolved": "https://registry.npmjs.org/@types/cors/-/cors-2.8.17.tgz", + "integrity": "sha512-8CGDvrBj1zgo2qE+oS3pOCyYNqCPryMWY2bGfwA0dcfopWGgxs+78df0Rs3rc9THP4JkOhLsAa+15VdpAqkcUA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/node": "*" + } + }, + "node_modules/@types/express": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/@types/express/-/express-5.0.1.tgz", + "integrity": "sha512-UZUw8vjpWFXuDnjFTh7/5c2TWDlQqeXHi6hcN7F2XSVT5P+WmUnnbFS3KA6Jnc6IsEqI2qCVu2bK0R0J4A8ZQQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/body-parser": "*", + "@types/express-serve-static-core": "^5.0.0", + "@types/serve-static": "*" + } + }, + "node_modules/@types/express-serve-static-core": { + "version": "5.0.6", + "resolved": "https://registry.npmjs.org/@types/express-serve-static-core/-/express-serve-static-core-5.0.6.tgz", + "integrity": "sha512-3xhRnjJPkULekpSzgtoNYYcTWgEZkp4myc+Saevii5JPnHNvHMRlBSHDbs7Bh1iPPoVTERHEZXyhyLbMEsExsA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/node": "*", + "@types/qs": "*", + "@types/range-parser": "*", + "@types/send": "*" + } + }, + "node_modules/@types/http-errors": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/@types/http-errors/-/http-errors-2.0.4.tgz", + "integrity": "sha512-D0CFMMtydbJAegzOyHjtiKPLlvnm3iTZyZRSZoLq2mRhDdmLfIWOCYPfQJ4cu2erKghU++QvjcUjp/5h7hESpA==", + "dev": true, + "license": "MIT" + }, + "node_modules/@types/mime": { + "version": "1.3.5", + "resolved": "https://registry.npmjs.org/@types/mime/-/mime-1.3.5.tgz", + "integrity": "sha512-/pyBZWSLD2n0dcHE3hq8s8ZvcETHtEuF+3E7XVt0Ig2nvsVQXdghHVcEkIWjy9A0wKfTn97a/PSDYohKIlnP/w==", + "dev": true, + "license": "MIT" + }, + "node_modules/@types/node": { + "version": "22.13.16", + "resolved": "https://registry.npmjs.org/@types/node/-/node-22.13.16.tgz", + "integrity": "sha512-15tM+qA4Ypml/N7kyRdvfRjBQT2RL461uF1Bldn06K0Nzn1lY3nAPgHlsVrJxdZ9WhZiW0Fmc1lOYMtDsAuB3w==", + "dev": true, + "license": "MIT", + "dependencies": { + "undici-types": "~6.20.0" + } + }, + "node_modules/@types/qs": { + "version": "6.9.18", + "resolved": "https://registry.npmjs.org/@types/qs/-/qs-6.9.18.tgz", + "integrity": "sha512-kK7dgTYDyGqS+e2Q4aK9X3D7q234CIZ1Bv0q/7Z5IwRDoADNU81xXJK/YVyLbLTZCoIwUoDoffFeF+p/eIklAA==", + "dev": true, + "license": "MIT" + }, + "node_modules/@types/range-parser": { + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/@types/range-parser/-/range-parser-1.2.7.tgz", + "integrity": "sha512-hKormJbkJqzQGhziax5PItDUTMAM9uE2XXQmM37dyd4hVM+5aVl7oVxMVUiVQn2oCQFN/LKCZdvSM0pFRqbSmQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/@types/send": { + "version": "0.17.4", + "resolved": "https://registry.npmjs.org/@types/send/-/send-0.17.4.tgz", + "integrity": "sha512-x2EM6TJOybec7c52BX0ZspPodMsQUd5L6PRwOunVyVUhXiBSKf3AezDL8Dgvgt5o0UfKNfuA0eMLr2wLT4AiBA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/mime": "^1", + "@types/node": "*" + } + }, + "node_modules/@types/serve-static": { + "version": "1.15.7", + "resolved": "https://registry.npmjs.org/@types/serve-static/-/serve-static-1.15.7.tgz", + "integrity": "sha512-W8Ym+h8nhuRwaKPaDw34QUkwsGi6Rc4yYqvKFo5rm2FUEhCFbzVWrxXUxuKK8TASjWsysJY0nsmNCGhCOIsrOw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/http-errors": "*", + "@types/node": "*", + "@types/send": "*" + } + }, + "node_modules/@types/uuid": { + "version": "10.0.0", + "resolved": "https://registry.npmjs.org/@types/uuid/-/uuid-10.0.0.tgz", + "integrity": "sha512-7gqG38EyHgyP1S+7+xomFtL+ZNHcKv6DwNaCZmJmo1vgMugyF3TCnXVg4t1uk89mLNwnLtnY3TpOpCOyp1/xHQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/@types/winreg": { + "version": "1.2.36", + "resolved": "https://registry.npmjs.org/@types/winreg/-/winreg-1.2.36.tgz", + "integrity": "sha512-DtafHy5A8hbaosXrbr7YdjQZaqVewXmiasRS5J4tYMzt3s1gkh40ixpxgVFfKiQ0JIYetTJABat47v9cpr/sQg==", + "dev": true, + "license": "MIT" + }, + "node_modules/@types/ws": { + "version": "8.18.1", + "resolved": "https://registry.npmjs.org/@types/ws/-/ws-8.18.1.tgz", + "integrity": "sha512-ThVF6DCVhA8kUGy+aazFQ4kXQ7E1Ty7A3ypFOe0IcJV8O/M511G99AW24irKrW56Wt44yG9+ij8FaqoBGkuBXg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/node": "*" + } + }, + "node_modules/accepts": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/accepts/-/accepts-2.0.0.tgz", + "integrity": "sha512-5cvg6CtKwfgdmVqY1WIiXKc3Q1bkRqGLi+2W/6ao+6Y7gu/RCwRuAhGEzh5B4KlszSuTLgZYuqFqo5bImjNKng==", + "license": "MIT", + "dependencies": { + "mime-types": "^3.0.0", + "negotiator": "^1.0.0" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/asynckit": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", + "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==", + "license": "MIT" + }, + "node_modules/axios": { + "version": "1.8.4", + "resolved": "https://registry.npmjs.org/axios/-/axios-1.8.4.tgz", + "integrity": "sha512-eBSYY4Y68NNlHbHBMdeDmKNtDgXWhQsJcGqzO3iLUM0GraQFSS9cVgPX5I9b3lbdFKyYoAEGAZF1DwhTaljNAw==", + "license": "MIT", + "dependencies": { + "follow-redirects": "^1.15.6", + "form-data": "^4.0.0", + "proxy-from-env": "^1.1.0" + } + }, + "node_modules/body-parser": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-2.2.0.tgz", + "integrity": "sha512-02qvAaxv8tp7fBa/mw1ga98OGm+eCbqzJOKoRt70sLmfEEi+jyBYVTDGfCL/k06/4EMk/z01gCe7HoCH/f2LTg==", + "license": "MIT", + "dependencies": { + "bytes": "^3.1.2", + "content-type": "^1.0.5", + "debug": "^4.4.0", + "http-errors": "^2.0.0", + "iconv-lite": "^0.6.3", + "on-finished": "^2.4.1", + "qs": "^6.14.0", + "raw-body": "^3.0.0", + "type-is": "^2.0.0" + }, + "engines": { + "node": ">=18" + } + }, + "node_modules/bytes": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.2.tgz", + "integrity": "sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/call-bind-apply-helpers": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/call-bind-apply-helpers/-/call-bind-apply-helpers-1.0.2.tgz", + "integrity": "sha512-Sp1ablJ0ivDkSzjcaJdxEunN5/XvksFJ2sMBFfq6x0ryhQV/2b/KwFe21cMpmHtPOSij8K99/wSfoEuTObmuMQ==", + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0", + "function-bind": "^1.1.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/call-bound": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/call-bound/-/call-bound-1.0.4.tgz", + "integrity": "sha512-+ys997U96po4Kx/ABpBCqhA9EuxJaQWDQg7295H4hBphv3IZg0boBKuwYpt4YXp6MZ5AmZQnU/tyMTlRpaSejg==", + "license": "MIT", + "dependencies": { + "call-bind-apply-helpers": "^1.0.2", + "get-intrinsic": "^1.3.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/combined-stream": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", + "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", + "license": "MIT", + "dependencies": { + "delayed-stream": "~1.0.0" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/content-disposition": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-1.0.0.tgz", + "integrity": "sha512-Au9nRL8VNUut/XSzbQA38+M78dzP4D+eqg3gfJHMIHHYa3bg067xj1KxMUWj+VULbiZMowKngFFbKczUrNJ1mg==", + "license": "MIT", + "dependencies": { + "safe-buffer": "5.2.1" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/content-type": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.5.tgz", + "integrity": "sha512-nTjqfcBFEipKdXCv4YDQWCfmcLZKm81ldF0pAopTvyrFGVbcR6P/VAAd5G7N+0tTr8QqiU0tFadD6FK4NtJwOA==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/cookie": { + "version": "0.7.2", + "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.7.2.tgz", + "integrity": "sha512-yki5XnKuf750l50uGTllt6kKILY4nQ1eNIQatoXEByZ5dWgnKqbnqmTrBE5B4N7lrMJKQ2ytWMiTO2o0v6Ew/w==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/cookie-signature": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.2.2.tgz", + "integrity": "sha512-D76uU73ulSXrD1UXF4KE2TMxVVwhsnCgfAyTg9k8P6KGZjlXKrOLe4dJQKI3Bxi5wjesZoFXJWElNWBjPZMbhg==", + "license": "MIT", + "engines": { + "node": ">=6.6.0" + } + }, + "node_modules/cors": { + "version": "2.8.5", + "resolved": "https://registry.npmjs.org/cors/-/cors-2.8.5.tgz", + "integrity": "sha512-KIHbLJqu73RGr/hnbrO9uBeixNGuvSQjul/jdFvS/KFSIH1hWVd1ng7zOHx+YrEfInLG7q4n6GHQ9cDtxv/P6g==", + "license": "MIT", + "dependencies": { + "object-assign": "^4", + "vary": "^1" + }, + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/cross-spawn": { + "version": "7.0.6", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.6.tgz", + "integrity": "sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==", + "license": "MIT", + "dependencies": { + "path-key": "^3.1.0", + "shebang-command": "^2.0.0", + "which": "^2.0.1" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/debug": { + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.0.tgz", + "integrity": "sha512-6WTZ/IxCY/T6BALoZHaE4ctp9xm+Z5kY/pzYaCHRFeyVhojxlrm+46y68HA6hr0TcwEssoxNiDEUJQjfPZ/RYA==", + "license": "MIT", + "dependencies": { + "ms": "^2.1.3" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/delayed-stream": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", + "integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==", + "license": "MIT", + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/depd": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz", + "integrity": "sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/dunder-proto": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/dunder-proto/-/dunder-proto-1.0.1.tgz", + "integrity": "sha512-KIN/nDJBQRcXw0MLVhZE9iQHmG68qAVIBg9CqmUYjmQIhgij9U5MFvrqkUL5FbtyyzZuOeOt0zdeRe4UY7ct+A==", + "license": "MIT", + "dependencies": { + "call-bind-apply-helpers": "^1.0.1", + "es-errors": "^1.3.0", + "gopd": "^1.2.0" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/ee-first": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", + "integrity": "sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow==", + "license": "MIT" + }, + "node_modules/encodeurl": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-2.0.0.tgz", + "integrity": "sha512-Q0n9HRi4m6JuGIV1eFlmvJB7ZEVxu93IrMyiMsGC0lrMJMWzRgx6WGquyfQgZVb31vhGgXnfmPNNXmxnOkRBrg==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/es-define-property": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/es-define-property/-/es-define-property-1.0.1.tgz", + "integrity": "sha512-e3nRfgfUZ4rNGL232gUgX06QNyyez04KdjFrF+LTRoOXmrOgFKDg4BCdsjW8EnT69eqdYGmRpJwiPVYNrCaW3g==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es-errors": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/es-errors/-/es-errors-1.3.0.tgz", + "integrity": "sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es-object-atoms": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/es-object-atoms/-/es-object-atoms-1.1.1.tgz", + "integrity": "sha512-FGgH2h8zKNim9ljj7dankFPcICIK9Cp5bm+c2gQSYePhpaG5+esrLODihIorn+Pe6FGJzWhXQotPv73jTaldXA==", + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es-set-tostringtag": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/es-set-tostringtag/-/es-set-tostringtag-2.1.0.tgz", + "integrity": "sha512-j6vWzfrGVfyXxge+O0x5sh6cvxAog0a/4Rdd2K36zCMV5eJ+/+tOAngRO8cODMNWbVRdVlmGZQL2YS3yR8bIUA==", + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0", + "get-intrinsic": "^1.2.6", + "has-tostringtag": "^1.0.2", + "hasown": "^2.0.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/escape-html": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz", + "integrity": "sha512-NiSupZ4OeuGwr68lGIeym/ksIZMJodUGOSCZ/FSnTxcrekbvqrgdUxlJOMpijaKZVjAJrWrGs/6Jy8OMuyj9ow==", + "license": "MIT" + }, + "node_modules/etag": { + "version": "1.8.1", + "resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz", + "integrity": "sha512-aIL5Fx7mawVa300al2BnEE4iNvo1qETxLrPI/o05L7z6go7fCw1J6EQmbK4FmJ2AS7kgVF/KEZWufBfdClMcPg==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/eventsource": { + "version": "3.0.6", + "resolved": "https://registry.npmjs.org/eventsource/-/eventsource-3.0.6.tgz", + "integrity": "sha512-l19WpE2m9hSuyP06+FbuUUf1G+R0SFLrtQfbRb9PRr+oimOfxQhgGCbVaXg5IvZyyTThJsxh6L/srkMiCeBPDA==", + "license": "MIT", + "dependencies": { + "eventsource-parser": "^3.0.1" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/eventsource-parser": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/eventsource-parser/-/eventsource-parser-3.0.1.tgz", + "integrity": "sha512-VARTJ9CYeuQYb0pZEPbzi740OWFgpHe7AYJ2WFZVnUDUQp5Dk2yJUgF36YsZ81cOyxT0QxmXD2EQpapAouzWVA==", + "license": "MIT", + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/express": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/express/-/express-5.1.0.tgz", + "integrity": "sha512-DT9ck5YIRU+8GYzzU5kT3eHGA5iL+1Zd0EutOmTE9Dtk+Tvuzd23VBU+ec7HPNSTxXYO55gPV/hq4pSBJDjFpA==", + "license": "MIT", + "dependencies": { + "accepts": "^2.0.0", + "body-parser": "^2.2.0", + "content-disposition": "^1.0.0", + "content-type": "^1.0.5", + "cookie": "^0.7.1", + "cookie-signature": "^1.2.1", + "debug": "^4.4.0", + "encodeurl": "^2.0.0", + "escape-html": "^1.0.3", + "etag": "^1.8.1", + "finalhandler": "^2.1.0", + "fresh": "^2.0.0", + "http-errors": "^2.0.0", + "merge-descriptors": "^2.0.0", + "mime-types": "^3.0.0", + "on-finished": "^2.4.1", + "once": "^1.4.0", + "parseurl": "^1.3.3", + "proxy-addr": "^2.0.7", + "qs": "^6.14.0", + "range-parser": "^1.2.1", + "router": "^2.2.0", + "send": "^1.1.0", + "serve-static": "^2.2.0", + "statuses": "^2.0.1", + "type-is": "^2.0.1", + "vary": "^1.1.2" + }, + "engines": { + "node": ">= 18" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/express-rate-limit": { + "version": "7.5.0", + "resolved": "https://registry.npmjs.org/express-rate-limit/-/express-rate-limit-7.5.0.tgz", + "integrity": "sha512-eB5zbQh5h+VenMPM3fh+nw1YExi5nMr6HUCR62ELSP11huvxm/Uir1H1QEyTkk5QX6A58pX6NmaTMceKZ0Eodg==", + "license": "MIT", + "engines": { + "node": ">= 16" + }, + "funding": { + "url": "https://github.com/sponsors/express-rate-limit" + }, + "peerDependencies": { + "express": "^4.11 || 5 || ^5.0.0-beta.1" + } + }, + "node_modules/finalhandler": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-2.1.0.tgz", + "integrity": "sha512-/t88Ty3d5JWQbWYgaOGCCYfXRwV1+be02WqYYlL6h0lEiUAMPM8o8qKGO01YIkOHzka2up08wvgYD0mDiI+q3Q==", + "license": "MIT", + "dependencies": { + "debug": "^4.4.0", + "encodeurl": "^2.0.0", + "escape-html": "^1.0.3", + "on-finished": "^2.4.1", + "parseurl": "^1.3.3", + "statuses": "^2.0.1" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/follow-redirects": { + "version": "1.15.9", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.9.tgz", + "integrity": "sha512-gew4GsXizNgdoRyqmyfMHyAmXsZDk6mHkSxZFCzW9gwlbtOW44CDtYavM+y+72qD/Vq2l550kMF52DT8fOLJqQ==", + "funding": [ + { + "type": "individual", + "url": "https://github.com/sponsors/RubenVerborgh" + } + ], + "license": "MIT", + "engines": { + "node": ">=4.0" + }, + "peerDependenciesMeta": { + "debug": { + "optional": true + } + } + }, + "node_modules/form-data": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.2.tgz", + "integrity": "sha512-hGfm/slu0ZabnNt4oaRZ6uREyfCj6P4fT/n6A1rGV+Z0VdGXjfOhVUpkn6qVQONHGIFwmveGXyDs75+nr6FM8w==", + "license": "MIT", + "dependencies": { + "asynckit": "^0.4.0", + "combined-stream": "^1.0.8", + "es-set-tostringtag": "^2.1.0", + "mime-types": "^2.1.12" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/form-data/node_modules/mime-db": { + "version": "1.52.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", + "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/form-data/node_modules/mime-types": { + "version": "2.1.35", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz", + "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==", + "license": "MIT", + "dependencies": { + "mime-db": "1.52.0" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/forwarded": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.2.0.tgz", + "integrity": "sha512-buRG0fpBtRHSTCOASe6hD258tEubFoRLb4ZNA6NxMVHNw2gOcwHo9wyablzMzOA5z9xA9L1KNjk/Nt6MT9aYow==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/fresh": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/fresh/-/fresh-2.0.0.tgz", + "integrity": "sha512-Rx/WycZ60HOaqLKAi6cHRKKI7zxWbJ31MhntmtwMoaTeF7XFH9hhBp8vITaMidfljRQ6eYWCKkaTK+ykVJHP2A==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/function-bind": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz", + "integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==", + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/get-intrinsic": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.3.0.tgz", + "integrity": "sha512-9fSjSaos/fRIVIp+xSJlE6lfwhES7LNtKaCBIamHsjr2na1BiABJPo0mOjjz8GJDURarmCPGqaiVg5mfjb98CQ==", + "license": "MIT", + "dependencies": { + "call-bind-apply-helpers": "^1.0.2", + "es-define-property": "^1.0.1", + "es-errors": "^1.3.0", + "es-object-atoms": "^1.1.1", + "function-bind": "^1.1.2", + "get-proto": "^1.0.1", + "gopd": "^1.2.0", + "has-symbols": "^1.1.0", + "hasown": "^2.0.2", + "math-intrinsics": "^1.1.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/get-proto": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/get-proto/-/get-proto-1.0.1.tgz", + "integrity": "sha512-sTSfBjoXBp89JvIKIefqw7U2CCebsc74kiY6awiGogKtoSGbgjYE/G/+l9sF3MWFPNc9IcoOC4ODfKHfxFmp0g==", + "license": "MIT", + "dependencies": { + "dunder-proto": "^1.0.1", + "es-object-atoms": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/gopd": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/gopd/-/gopd-1.2.0.tgz", + "integrity": "sha512-ZUKRh6/kUFoAiTAtTYPZJ3hw9wNxx+BIBOijnlG9PnrJsCcSjs1wyyD6vJpaYtgnzDrKYRSqf3OO6Rfa93xsRg==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/has-symbols": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.1.0.tgz", + "integrity": "sha512-1cDNdwJ2Jaohmb3sg4OmKaMBwuC48sYni5HUw2DvsC8LjGTLK9h+eb1X6RyuOHe4hT0ULCW68iomhjUoKUqlPQ==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/has-tostringtag": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/has-tostringtag/-/has-tostringtag-1.0.2.tgz", + "integrity": "sha512-NqADB8VjPFLM2V0VvHUewwwsw0ZWBaIdgo+ieHtK3hasLz4qeCRjYcqfB6AQrBggRKppKF8L52/VqdVsO47Dlw==", + "license": "MIT", + "dependencies": { + "has-symbols": "^1.0.3" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/hasown": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.2.tgz", + "integrity": "sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==", + "license": "MIT", + "dependencies": { + "function-bind": "^1.1.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/http-errors": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-2.0.0.tgz", + "integrity": "sha512-FtwrG/euBzaEjYeRqOgly7G0qviiXoJWnvEH2Z1plBdXgbyjv34pHTSb9zoeHMyDy33+DWy5Wt9Wo+TURtOYSQ==", + "license": "MIT", + "dependencies": { + "depd": "2.0.0", + "inherits": "2.0.4", + "setprototypeof": "1.2.0", + "statuses": "2.0.1", + "toidentifier": "1.0.1" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/iconv-lite": { + "version": "0.6.3", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.6.3.tgz", + "integrity": "sha512-4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw==", + "license": "MIT", + "dependencies": { + "safer-buffer": ">= 2.1.2 < 3.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", + "license": "ISC" + }, + "node_modules/ipaddr.js": { + "version": "1.9.1", + "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.9.1.tgz", + "integrity": "sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g==", + "license": "MIT", + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/is-promise": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/is-promise/-/is-promise-4.0.0.tgz", + "integrity": "sha512-hvpoI6korhJMnej285dSg6nu1+e6uxs7zG3BYAm5byqDsgJNWwxzM6z6iZiAgQR4TJ30JmBTOwqZUw3WlyH3AQ==", + "license": "MIT" + }, + "node_modules/isexe": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", + "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==", + "license": "ISC" + }, + "node_modules/math-intrinsics": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/math-intrinsics/-/math-intrinsics-1.1.0.tgz", + "integrity": "sha512-/IXtbwEk5HTPyEwyKX6hGkYXxM9nbj64B+ilVJnC/R6B0pH5G4V3b0pVbL7DBj4tkhBAppbQUlf6F6Xl9LHu1g==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/media-typer": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-1.1.0.tgz", + "integrity": "sha512-aisnrDP4GNe06UcKFnV5bfMNPBUw4jsLGaWwWfnH3v02GnBuXX2MCVn5RbrWo0j3pczUilYblq7fQ7Nw2t5XKw==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/merge-descriptors": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-2.0.0.tgz", + "integrity": "sha512-Snk314V5ayFLhp3fkUREub6WtjBfPdCPY1Ln8/8munuLuiYhsABgBVWsozAG+MWMbVEvcdcpbi9R7ww22l9Q3g==", + "license": "MIT", + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/mime-db": { + "version": "1.54.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.54.0.tgz", + "integrity": "sha512-aU5EJuIN2WDemCcAp2vFBfp/m4EAhWJnUNSSw0ixs7/kXbd6Pg64EmwJkNdFhB8aWt1sH2CTXrLxo/iAGV3oPQ==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/mime-types": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-3.0.1.tgz", + "integrity": "sha512-xRc4oEhT6eaBpU1XF7AjpOFD+xQmXNB5OVKwp4tqCuBpHLS/ZbBDrc07mYTDqVMg6PfxUjjNp85O6Cd2Z/5HWA==", + "license": "MIT", + "dependencies": { + "mime-db": "^1.54.0" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "license": "MIT" + }, + "node_modules/negotiator": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-1.0.0.tgz", + "integrity": "sha512-8Ofs/AUQh8MaEcrlq5xOX0CQ9ypTF5dl78mjlMNfOK08fzpgTHQRQPBxcPlEtIw0yRpws+Zo/3r+5WRby7u3Gg==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/object-assign": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", + "integrity": "sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==", + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/object-inspect": { + "version": "1.13.4", + "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.13.4.tgz", + "integrity": "sha512-W67iLl4J2EXEGTbfeHCffrjDfitvLANg0UlX3wFUUSTx92KXRFegMHUVgSqE+wvhAbi4WqjGg9czysTV2Epbew==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/on-finished": { + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.4.1.tgz", + "integrity": "sha512-oVlzkg3ENAhCk2zdv7IJwd/QUD4z2RxRwpkcGY8psCVcCYZNq4wYnVWALHM+brtuJjePWiYF/ClmuDr8Ch5+kg==", + "license": "MIT", + "dependencies": { + "ee-first": "1.1.1" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", + "license": "ISC", + "dependencies": { + "wrappy": "1" + } + }, + "node_modules/parseurl": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz", + "integrity": "sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/path-key": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", + "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/path-to-regexp": { + "version": "8.2.0", + "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-8.2.0.tgz", + "integrity": "sha512-TdrF7fW9Rphjq4RjrW0Kp2AW0Ahwu9sRGTkS6bvDi0SCwZlEZYmcfDbEsTz8RVk0EHIS/Vd1bv3JhG+1xZuAyQ==", + "license": "MIT", + "engines": { + "node": ">=16" + } + }, + "node_modules/pkce-challenge": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/pkce-challenge/-/pkce-challenge-4.1.0.tgz", + "integrity": "sha512-ZBmhE1C9LcPoH9XZSdwiPtbPHZROwAnMy+kIFQVrnMCxY4Cudlz3gBOpzilgc0jOgRaiT3sIWfpMomW2ar2orQ==", + "license": "MIT", + "engines": { + "node": ">=16.20.0" + } + }, + "node_modules/proxy-addr": { + "version": "2.0.7", + "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.7.tgz", + "integrity": "sha512-llQsMLSUDUPT44jdrU/O37qlnifitDP+ZwrmmZcoSKyLKvtZxpyV0n2/bD/N4tBAAZ/gJEdZU7KMraoK1+XYAg==", + "license": "MIT", + "dependencies": { + "forwarded": "0.2.0", + "ipaddr.js": "1.9.1" + }, + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/proxy-from-env": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz", + "integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==", + "license": "MIT" + }, + "node_modules/qs": { + "version": "6.14.0", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.14.0.tgz", + "integrity": "sha512-YWWTjgABSKcvs/nWBi9PycY/JiPJqOD4JA6o9Sej2AtvSGarXxKC3OQSk4pAarbdQlKAh5D4FCQkJNkW+GAn3w==", + "license": "BSD-3-Clause", + "dependencies": { + "side-channel": "^1.1.0" + }, + "engines": { + "node": ">=0.6" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/range-parser": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz", + "integrity": "sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/raw-body": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-3.0.0.tgz", + "integrity": "sha512-RmkhL8CAyCRPXCE28MMH0z2PNWQBNk2Q09ZdxM9IOOXwxwZbN+qbWaatPkdkWIKL2ZVDImrN/pK5HTRz2PcS4g==", + "license": "MIT", + "dependencies": { + "bytes": "3.1.2", + "http-errors": "2.0.0", + "iconv-lite": "0.6.3", + "unpipe": "1.0.0" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/router": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/router/-/router-2.2.0.tgz", + "integrity": "sha512-nLTrUKm2UyiL7rlhapu/Zl45FwNgkZGaCpZbIHajDYgwlJCOzLSk+cIPAnsEqV955GjILJnKbdQC1nVPz+gAYQ==", + "license": "MIT", + "dependencies": { + "debug": "^4.4.0", + "depd": "^2.0.0", + "is-promise": "^4.0.0", + "parseurl": "^1.3.3", + "path-to-regexp": "^8.0.0" + }, + "engines": { + "node": ">= 18" + } + }, + "node_modules/safe-buffer": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", + "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "MIT" + }, + "node_modules/safer-buffer": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", + "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==", + "license": "MIT" + }, + "node_modules/send": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/send/-/send-1.2.0.tgz", + "integrity": "sha512-uaW0WwXKpL9blXE2o0bRhoL2EGXIrZxQ2ZQ4mgcfoBxdFmQold+qWsD2jLrfZ0trjKL6vOw0j//eAwcALFjKSw==", + "license": "MIT", + "dependencies": { + "debug": "^4.3.5", + "encodeurl": "^2.0.0", + "escape-html": "^1.0.3", + "etag": "^1.8.1", + "fresh": "^2.0.0", + "http-errors": "^2.0.0", + "mime-types": "^3.0.1", + "ms": "^2.1.3", + "on-finished": "^2.4.1", + "range-parser": "^1.2.1", + "statuses": "^2.0.1" + }, + "engines": { + "node": ">= 18" + } + }, + "node_modules/serve-static": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-2.2.0.tgz", + "integrity": "sha512-61g9pCh0Vnh7IutZjtLGGpTA355+OPn2TyDv/6ivP2h/AdAVX9azsoxmg2/M6nZeQZNYBEwIcsne1mJd9oQItQ==", + "license": "MIT", + "dependencies": { + "encodeurl": "^2.0.0", + "escape-html": "^1.0.3", + "parseurl": "^1.3.3", + "send": "^1.2.0" + }, + "engines": { + "node": ">= 18" + } + }, + "node_modules/setprototypeof": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.2.0.tgz", + "integrity": "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==", + "license": "ISC" + }, + "node_modules/shebang-command": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", + "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", + "license": "MIT", + "dependencies": { + "shebang-regex": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/shebang-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", + "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/side-channel": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.1.0.tgz", + "integrity": "sha512-ZX99e6tRweoUXqR+VBrslhda51Nh5MTQwou5tnUDgbtyM0dBgmhEDtWGP/xbKn6hqfPRHujUNwz5fy/wbbhnpw==", + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0", + "object-inspect": "^1.13.3", + "side-channel-list": "^1.0.0", + "side-channel-map": "^1.0.1", + "side-channel-weakmap": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/side-channel-list": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/side-channel-list/-/side-channel-list-1.0.0.tgz", + "integrity": "sha512-FCLHtRD/gnpCiCHEiJLOwdmFP+wzCmDEkc9y7NsYxeF4u7Btsn1ZuwgwJGxImImHicJArLP4R0yX4c2KCrMrTA==", + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0", + "object-inspect": "^1.13.3" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/side-channel-map": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/side-channel-map/-/side-channel-map-1.0.1.tgz", + "integrity": "sha512-VCjCNfgMsby3tTdo02nbjtM/ewra6jPHmpThenkTYh8pG9ucZ/1P8So4u4FGBek/BjpOVsDCMoLA/iuBKIFXRA==", + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.2", + "es-errors": "^1.3.0", + "get-intrinsic": "^1.2.5", + "object-inspect": "^1.13.3" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/side-channel-weakmap": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/side-channel-weakmap/-/side-channel-weakmap-1.0.2.tgz", + "integrity": "sha512-WPS/HvHQTYnHisLo9McqBHOJk2FkHO/tlpvldyrnem4aeQp4hai3gythswg6p01oSoTl58rcpiFAjF2br2Ak2A==", + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.2", + "es-errors": "^1.3.0", + "get-intrinsic": "^1.2.5", + "object-inspect": "^1.13.3", + "side-channel-map": "^1.0.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/statuses": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/statuses/-/statuses-2.0.1.tgz", + "integrity": "sha512-RwNA9Z/7PrK06rYLIzFMlaF+l73iwpzsqRIFgbMLbTcLD6cOao82TaWefPXQvB2fOC4AjuYSEndS7N/mTCbkdQ==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/toidentifier": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.1.tgz", + "integrity": "sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA==", + "license": "MIT", + "engines": { + "node": ">=0.6" + } + }, + "node_modules/type-is": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/type-is/-/type-is-2.0.1.tgz", + "integrity": "sha512-OZs6gsjF4vMp32qrCbiVSkrFmXtG/AZhY3t0iAMrMBiAZyV9oALtXO8hsrHbMXF9x6L3grlFuwW2oAz7cav+Gw==", + "license": "MIT", + "dependencies": { + "content-type": "^1.0.5", + "media-typer": "^1.1.0", + "mime-types": "^3.0.0" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/typescript": { + "version": "5.8.2", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.8.2.tgz", + "integrity": "sha512-aJn6wq13/afZp/jT9QZmwEjDqqvSGp1VT5GVg+f/t6/oVyrgXM6BY1h9BRh/O5p3PlUPAe+WuiEZOmb/49RqoQ==", + "dev": true, + "license": "Apache-2.0", + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=14.17" + } + }, + "node_modules/undici-types": { + "version": "6.20.0", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.20.0.tgz", + "integrity": "sha512-Ny6QZ2Nju20vw1SRHe3d9jVu6gJ+4e3+MMpqu7pqE5HT6WsTSlce++GQmK5UXS8mzV8DSYHrQH+Xrf2jVcuKNg==", + "dev": true, + "license": "MIT" + }, + "node_modules/unpipe": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz", + "integrity": "sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/uuid": { + "version": "11.1.0", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-11.1.0.tgz", + "integrity": "sha512-0/A9rDy9P7cJ+8w1c9WD9V//9Wj15Ce2MPz8Ri6032usz+NfePxx5AcN3bN+r6ZL6jEo066/yNYB3tn4pQEx+A==", + "funding": [ + "https://github.com/sponsors/broofa", + "https://github.com/sponsors/ctavan" + ], + "license": "MIT", + "bin": { + "uuid": "dist/esm/bin/uuid" + } + }, + "node_modules/vary": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz", + "integrity": "sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/which": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", + "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", + "license": "ISC", + "dependencies": { + "isexe": "^2.0.0" + }, + "bin": { + "node-which": "bin/node-which" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/winreg": { + "version": "1.2.5", + "resolved": "https://registry.npmjs.org/winreg/-/winreg-1.2.5.tgz", + "integrity": "sha512-uf7tHf+tw0B1y+x+mKTLHkykBgK2KMs3g+KlzmyMbLvICSHQyB/xOFjTT8qZ3oeTFyU7Bbj4FzXitGG6jvKhYw==", + "license": "BSD-2-Clause" + }, + "node_modules/wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==", + "license": "ISC" + }, + "node_modules/ws": { + "version": "8.18.1", + "resolved": "https://registry.npmjs.org/ws/-/ws-8.18.1.tgz", + "integrity": "sha512-RKW2aJZMXeMxVpnZ6bck+RswznaxmzdULiBr6KY7XkTnW8uvt0iT9H5DkHUChXrc+uurzwa0rVI16n/Xzjdz1w==", + "license": "MIT", + "engines": { + "node": ">=10.0.0" + }, + "peerDependencies": { + "bufferutil": "^4.0.1", + "utf-8-validate": ">=5.0.2" + }, + "peerDependenciesMeta": { + "bufferutil": { + "optional": true + }, + "utf-8-validate": { + "optional": true + } + } + }, + "node_modules/zod": { + "version": "3.24.4", + "resolved": "https://registry.npmjs.org/zod/-/zod-3.24.4.tgz", + "integrity": "sha512-OdqJE9UDRPwWsrHjLN2F8bPxvwJBK22EHLWtanu0LSYr5YqzsaaW3RMgmjwr8Rypg5k+meEJdSPXJZXE/yqOMg==", + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/colinhacks" + } + }, + "node_modules/zod-to-json-schema": { + "version": "3.24.5", + "resolved": "https://registry.npmjs.org/zod-to-json-schema/-/zod-to-json-schema-3.24.5.tgz", + "integrity": "sha512-/AuWwMP+YqiPbsJx5D6TfgRTc4kTLjsh5SOcd4bLsfUg2RcEXrFMJl1DGgdHy2aCfsIA/cr/1JM0xcB2GZji8g==", + "license": "ISC", + "peerDependencies": { + "zod": "^3.24.1" + } + } + } +} diff --git a/Server~/src/index.ts b/Server~/src/index.ts index d8d67e10..8abbea8e 100644 --- a/Server~/src/index.ts +++ b/Server~/src/index.ts @@ -12,6 +12,7 @@ import { registerGetConsoleLogsTool } from './tools/getConsoleLogsTool.js'; import { registerUpdateComponentTool } from './tools/updateComponentTool.js'; import { registerAddAssetToSceneTool } from './tools/addAssetToSceneTool.js'; import { registerUpdateGameObjectTool } from './tools/updateGameObjectTool.js'; +import { registerCreatePrefabTool } from './tools/createPrefabTool.js'; import { registerGetMenuItemsResource } from './resources/getMenuItemResource.js'; import { registerGetConsoleLogsResource } from './resources/getConsoleLogsResource.js'; import { registerGetHierarchyResource } from './resources/getScenesHierarchyResource.js'; @@ -55,6 +56,7 @@ registerGetConsoleLogsTool(server, mcpUnity, toolLogger); registerUpdateComponentTool(server, mcpUnity, toolLogger); registerAddAssetToSceneTool(server, mcpUnity, toolLogger); registerUpdateGameObjectTool(server, mcpUnity, toolLogger); +registerCreatePrefabTool(server, mcpUnity, toolLogger); // Register all resources into the MCP server registerGetTestsResource(server, mcpUnity, resourceLogger); diff --git a/Server~/src/prompts/gameobjectHandlingPrompt.ts b/Server~/src/prompts/gameobjectHandlingPrompt.ts index e5707501..3079e2c6 100644 --- a/Server~/src/prompts/gameobjectHandlingPrompt.ts +++ b/Server~/src/prompts/gameobjectHandlingPrompt.ts @@ -12,33 +12,37 @@ export function registerGameObjectHandlingPrompt(server: McpServer) { 'gameobject_handling_strategy', 'Defines the proper workflow for handling gameobjects in Unity', { - gameObjectId: z.string().describe("The ID of the GameObject to handle. It can be the name of the GameObject or the path to the GameObject."), + gameObjectIdOrName: z.string().describe("The resource to identify the GameObject intended to handle. It can be the **instance ID**, the **name** or the **path** to the GameObject."), }, - async ({ gameObjectId }) => ({ + async ({ gameObjectIdOrName }) => ({ messages: [ { role: 'user', content: { type: 'text', - text: `You are an expert AI assistant integrated with Unity via MCP. + text: `You are an expert AI assistant integrated with Unity via a MCP server. + When working directly with GameObjects or any of their components in Unity scenes, you have access to the following resources and tools: - Resource "get_scenes_hierarchy" (unity://scenes_hierarchy) to list all GameObjects. -- Resource "get_gameobject" (unity://gameobject/{id}) to fetch detailed GameObject info, with the id being the name of the GameObject or the path to the GameObject. -- Tool "select_gameobject" to select a GameObject by ID or path. +- Resource "get_gameobject" (unity://gameobject/{idOrName}) to fetch detailed GameObject info, with the *idOrName* being either the **instance ID**, the **name** or the **path** to the GameObject. +- Tool "select_gameobject" to select a GameObject by **instance ID**, the **name** or the **path** of the GameObject. - Tool "update_gameobject" to update a GameObject's core properties (name, tag, layer, active state, static state), or create the GameObject if it does not exist. - Tool "update_component" to update or add a component on a GameObject, including common frequently used components (e.g. Transform, RectTransform, BoxCollider, Rigidbody, etc). +- Tool "create_prefab" to create a prefab from a GameObject in the scene with optional MonoBehaviour script and serialized field values. Workflow: -1. Use "get_scenes_hierarchy" to confirm the GameObject ID or path for "${gameObjectId}". +1. Use "get_scenes_hierarchy" to confirm the GameObject ID, name or path for "${gameObjectIdOrName}". 2. If you need to update the GameObject's core properties (name, tag, layer, active state, static state), or create the GameObject if it does not exist, use "update_gameobject". 3. To focus the Unity Editor on the target GameObject, invoke "select_gameobject". -4. Optionally, use "unity://gameobject/${gameObjectId}" to retrieve detailed properties. +4. Optionally, use "unity://gameobject/${gameObjectIdOrName}" to retrieve detailed properties. 5. To update or add a component on the GameObject, use "update_component". 6. Confirm success and report any errors. Guidance: -- Use "update_gameobject" for creating GameObjects or changing their core properties. -- Use "update_component" for adding or modifying components on an existing GameObject. +- Use "update_gameobject" for creating GameObjects in the scene or to change a GameObject's core properties. +- Use "update_component" for adding or modifying components on an existing GameObject in the scene. +- Use "create_prefab" for creating prefabs from GameObjects in the scene. +- Component Scripts must be compiled in the Unity project before using "update_component" or "create_prefab". - Always validate inputs and request clarification if the identifier is ambiguous.` } }, @@ -46,7 +50,7 @@ Guidance: role: 'user', content: { type: 'text', - text: `Handle GameObject "${gameObjectId}" through the above workflow.` + text: `Handle GameObject "${gameObjectIdOrName}" through the above workflow.` } } ] diff --git a/Server~/src/resources/getGameObjectResource.ts b/Server~/src/resources/getGameObjectResource.ts index 8d79b632..48f14c55 100644 --- a/Server~/src/resources/getGameObjectResource.ts +++ b/Server~/src/resources/getGameObjectResource.ts @@ -8,7 +8,7 @@ import { resourceName as hierarchyResourceName } from './getScenesHierarchyResou // Constants for the resource const resourceName = 'get_gameobject'; -const resourceUri = 'unity://gameobject/{id}'; +const resourceUri = 'unity://gameobject/{idOrName}'; const resourceMimeType = 'application/json'; /** @@ -36,7 +36,7 @@ export function registerGetGameObjectResource(server: McpServer, mcpUnity: McpUn resourceName, resourceTemplate, { - description: 'Retrieve a GameObject by ID or path', + description: 'Retrieve a GameObject by instance ID, name, or hierarchical path (e.g., "Parent/Child/MyObject")', mimeType: resourceMimeType }, async (uri, variables) => { @@ -61,13 +61,13 @@ export function registerGetGameObjectResource(server: McpServer, mcpUnity: McpUn */ async function resourceHandler(mcpUnity: McpUnity, uri: URL, variables: Variables, logger: Logger): Promise { // Extract and convert the parameter from the template variables - const id = decodeURIComponent(variables["id"] as string); + const idOrName = decodeURIComponent(variables["idOrName"] as string); // Send request to Unity const response = await mcpUnity.sendRequest({ method: resourceName, params: { - objectPathId: id + idOrName: idOrName } }); @@ -80,7 +80,7 @@ async function resourceHandler(mcpUnity: McpUnity, uri: URL, variables: Variable return { contents: [{ - uri: `unity://gameobject/${id}`, + uri: `unity://gameobject/${idOrName}`, mimeType: resourceMimeType, text: JSON.stringify(response, null, 2) }] diff --git a/Server~/src/tools/createPrefabTool.ts b/Server~/src/tools/createPrefabTool.ts new file mode 100644 index 00000000..d17c2f7b --- /dev/null +++ b/Server~/src/tools/createPrefabTool.ts @@ -0,0 +1,91 @@ +import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js'; +import { McpUnity } from '../unity/mcpUnity.js'; +import { McpUnityError, ErrorType } from '../utils/errors.js'; +import * as z from 'zod'; +import { Logger } from '../utils/logger.js'; + +// Constants for the tool +const toolName = 'create_prefab'; +const toolDescription = 'Creates a prefab with optional MonoBehaviour script and serialized field values'; + +// Parameter schema for the tool +const paramsSchema = z.object({ + componentName: z.string().optional().describe('The name of the MonoBehaviour Component to add to the prefab (optional)'), + prefabName: z.string().describe('The name of the prefab to create'), + fieldValues: z.record(z.any()).optional().describe('Optional JSON object of serialized field values to apply to the prefab') +}); + +/** + * Creates and registers the CreatePrefab tool with the MCP server + * + * @param server The MCP server to register the tool with + * @param mcpUnity The McpUnity instance to communicate with Unity + * @param logger The logger instance for diagnostic information + */ +export function registerCreatePrefabTool(server: McpServer, mcpUnity: McpUnity, logger: Logger) { + logger.info(`Registering tool: ${toolName}`); + + server.tool( + toolName, + toolDescription, + paramsSchema.shape, + async (params: any) => { + try { + logger.info(`Executing tool: ${toolName}`, params); + const result = await toolHandler(mcpUnity, params); + logger.info(`Tool execution successful: ${toolName}`); + return result; + } catch (error) { + logger.error(`Tool execution failed: ${toolName}`, error); + throw error; + } + } + ); +} + +/** + * Handler function for the CreatePrefab tool + * + * @param mcpUnity The McpUnity instance to communicate with Unity + * @param params The validated parameters for the tool + * @returns A promise that resolves to the tool execution result + * @throws McpUnityError if validation fails or the request to Unity fails + */ +async function toolHandler(mcpUnity: McpUnity, params: any) { + if (!params.scriptName) { + throw new McpUnityError( + ErrorType.VALIDATION, + "'scriptName' must be provided" + ); + } + + if (!params.prefabName) { + throw new McpUnityError( + ErrorType.VALIDATION, + "'prefabName' must be provided" + ); + } + + const response = await mcpUnity.sendRequest({ + method: toolName, + params + }); + + if (!response.success) { + throw new McpUnityError( + ErrorType.TOOL_EXECUTION, + response.message || `Failed to create prefab` + ); + } + + return { + content: [{ + type: response.type, + text: response.message || `Successfully created prefab` + }], + // Include the prefab path in the result for programmatic access + data: { + prefabPath: response.prefabPath + } + }; +} diff --git a/Server~/src/tools/selectGameObjectTool.ts b/Server~/src/tools/selectGameObjectTool.ts index 2c577903..40818a5f 100644 --- a/Server~/src/tools/selectGameObjectTool.ts +++ b/Server~/src/tools/selectGameObjectTool.ts @@ -7,9 +7,10 @@ import { CallToolResult } from '@modelcontextprotocol/sdk/types.js'; // Constants for the tool const toolName = 'select_gameobject'; -const toolDescription = 'Sets the selected GameObject in the Unity editor by path or instance ID'; +const toolDescription = 'Sets the selected GameObject in the Unity editor by path, name or instance ID'; const paramsSchema = z.object({ objectPath: z.string().optional().describe('The path or name of the GameObject to select (e.g. "Main Camera")'), + objectName: z.string().optional().describe('The name of the GameObject to select'), instanceId: z.number().optional().describe('The instance ID of the GameObject to select') }); @@ -53,10 +54,10 @@ export function registerSelectGameObjectTool(server: McpServer, mcpUnity: McpUni */ async function toolHandler(mcpUnity: McpUnity, params: any): Promise { // Custom validation since we can't use refine/superRefine while maintaining ZodObject type - if (params.objectPath === undefined && params.instanceId === undefined) { + if (params.objectPath === undefined && params.objectName === undefined && params.instanceId === undefined) { throw new McpUnityError( ErrorType.VALIDATION, - "Either 'objectPath' or 'instanceId' must be provided" + "Either 'objectPath', 'objectName' or 'instanceId' must be provided" ); } diff --git a/llms.txt b/llms.txt new file mode 100644 index 00000000..8cb88c9e --- /dev/null +++ b/llms.txt @@ -0,0 +1,46 @@ +# MCP Unity + +> MCP Unity is an open-source implementation of the Model Context Protocol (MCP) for the Unity Editor. +> It connects a C# Unity Editor package with a Node.js/TypeScript server over WebSockets and exposes +> high-level "tools" and "resources" so language-model agents and other automated clients can safely +> inspect, test, and modify Unity projects in real-time. + +This repository consists of two coordinated halves that communicate using JSON-encoded MCP messages: + +- **Editor/** – Unity package that starts an internal WebSocket server and registers C# MCP tools & resources. +- **Server/** – Node.js/TypeScript application that runs outside Unity, connects to the Editor server, and + re-exposes identical MCP tools/resources for AI assistants. + +Together they allow AI coding assistants (e.g. Windsurf, Cursor, Claude Code, GitHub Copilot) to drive the Unity Editor headlessly, +automate scene and asset management, run tests, install packages, and gather diagnostics. + +## Docs +- [Project README](README.md): Full feature list, installation, and getting-started guide. +- [Installation guide](README.md#installation): Step-by-step setup instructions. +- [Unity Editor Tools source](Editor/Tools/): C# classes that implement individual editor actions. +- [Node.js Tools source](Server~/src/tools/): TypeScript wrappers that forward requests to Unity. + +## Tools +- [`execute_menu_item`](README.md#mcp-server-tools): Executes Unity Editor menu items by path. +- [`select_gameobject`](README.md#mcp-server-tools): Selects GameObjects in the Unity scene by path or instance ID. +- [`update_gameobject`](README.md#mcp-server-tools): Creates or updates GameObjects (name, tag, layer, active/static). +- [`update_component`](README.md#mcp-server-tools): Adds or edits component fields on GameObjects. +- [`add_package`](README.md#mcp-server-tools): Installs Unity packages via the Package Manager. +- [`run_tests`](README.md#mcp-server-tools): Runs Unity Test Runner tests (EditMode/PlayMode). +- [`send_console_log`](README.md#mcp-server-tools): Sends a console message to the Unity Editor log. +- [`add_asset_to_scene`](README.md#mcp-server-tools): Adds an AssetDatabase asset to the current scene. + +## Resources +- [unity://menu-items](README.md#mcp-server-resources): Returns all available Unity menu items. +- [unity://scenes-hierarchy](README.md#mcp-server-resources): Current scene hierarchy tree. +- [unity://gameobject/{id}](README.md#mcp-server-resources): Detailed info for a specific GameObject. +- [unity://logs](README.md#mcp-server-resources): Unity console log entries. +- [unity://packages](README.md#mcp-server-resources): Installed/available Unity packages. +- [unity://assets](README.md#mcp-server-resources): AssetDatabase search results. +- [unity://tests/{testMode}](README.md#mcp-server-resources): Test metadata for EditMode/PlayMode. + +## Optional +- [Model Context Protocol specification](https://modelcontextprotocol.io/spec): Formal protocol definition for MCP. +- [Unity Editor](https://unity.com/releases/editor/archive): Official Unity Editor download and documentation. +- [Node.js](https://nodejs.org/en/download/): JavaScript runtime used for the MCP server backend. +- [WebSocket-Sharp (C#)](https://github.com/sta/websocket-sharp/tree/master/websocket-sharp/Server): C# WebSocket server library used in the Unity package. diff --git a/llms.txt.meta b/llms.txt.meta new file mode 100644 index 00000000..7594fb64 --- /dev/null +++ b/llms.txt.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: b9c363f2a15e77647af6dd394f8fc838 +TextScriptImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 00000000..c06e5300 --- /dev/null +++ b/package-lock.json @@ -0,0 +1,13 @@ +{ + "name": "com.gamelovers.mcp-unity", + "version": "1.1.2", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "com.gamelovers.mcp-unity", + "version": "1.1.2", + "license": "MIT" + } + } +} diff --git a/package-lock.json.meta b/package-lock.json.meta new file mode 100644 index 00000000..f2b42ac5 --- /dev/null +++ b/package-lock.json.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 0cbd8dae4bef74f469c80aa209ebef3e +TextScriptImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/package.json b/package.json index bd6ed727..89b19749 100644 --- a/package.json +++ b/package.json @@ -2,14 +2,14 @@ "name": "com.gamelovers.mcp-unity", "displayName": "MCP Unity Server", "author": "CoderGamester", - "version": "1.1.2", + "version": "1.2.0", "unity": "2022.3", "license": "MIT", "description": "The purpose of this package is to provide a MCP Unity Server for executing Unity operations and request Editor information from AI MCP enabled hosts", "dependencies": { "com.unity.nuget.newtonsoft-json": "3.2.1", "com.unity.editorcoroutines": "1.0.0", - "com.unity.test-framework": "1.3.3" + "com.unity.test-framework": "1.3.3" }, "type": "library", "hideInEditor": false