Skip to content
Closed
Show file tree
Hide file tree
Changes from 40 commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
401e276
Unity MCP: stable framing handshake + non-blocking script writes; rem…
dsarno Aug 15, 2025
7eeac65
Bridge framing hardening: 64MiB cap, zero-length reject, timeout Read…
dsarno Aug 15, 2025
eafe309
ManageScript: improve method span parsing and validation behavior for…
dsarno Aug 15, 2025
73d212f
Unity MCP: prefer micro-edits & resources; add script_apply_edits pri…
dsarno Aug 16, 2025
a12dcab
test: add initial script and asset edit tests
dsarno Aug 16, 2025
92a6825
Merge pull request #3 from dsarno/codex/refactor-mcp-editing-tools-wi…
dsarno Aug 16, 2025
96c4b80
Merge branch 'CoplayDev:main' into protocol-framing
dsarno Aug 16, 2025
de4a6bc
Maintain manage_script compatibility and add safety checks
dsarno Aug 16, 2025
560213f
Merge pull request #6 from dsarno/codex/update-managescript-for-backw…
dsarno Aug 16, 2025
c13a2da
Support explicit validation levels
dsarno Aug 16, 2025
031f5d7
Merge pull request #7 from dsarno/codex/update-managescript-for-backw…
dsarno Aug 16, 2025
49a3355
Fix script tool returns and handshake edge cases
dsarno Aug 17, 2025
19b1b4f
Merge pull request #8 from dsarno/codex/streamline-protocol-framing-i…
dsarno Aug 17, 2025
c735117
Prevent overflow when counting edit bytes
dsarno Aug 17, 2025
fedf444
Merge pull request #10 from dsarno/codex/fix-potential-integer-overfl…
dsarno Aug 17, 2025
79ba5ec
Fix refresh debounce scheduling
dsarno Aug 17, 2025
7ee2191
Merge pull request #12 from dsarno/codex/fix-roslyn-error-handling-lo…
dsarno Aug 17, 2025
01fc4f1
Clean up temp backups and guard symlinked edits
dsarno Aug 17, 2025
a53204a
Merge pull request #13 from dsarno/codex/fix-roslyn-error-handling-lo…
dsarno Aug 17, 2025
fd79127
Fix debouncing race condition
dsarno Aug 17, 2025
fb0f464
Merge pull request #14 from dsarno/codex/fix-debouncing-logic-in-refr…
dsarno Aug 17, 2025
200483e
Add initial transport handshake tests with plan placeholders
dsarno Aug 17, 2025
a3c81d6
Fix dummy server startup and cleanup in transport tests
dsarno Aug 17, 2025
b01978c
test: enforce no prints and handshake preamble
dsarno Aug 17, 2025
555d965
feat: add defensive server path resolution in tests
dsarno Aug 17, 2025
e4544f6
Refine server source path lookup
dsarno Aug 17, 2025
9dbb4ff
Refine handshake tests and stdout hygiene
dsarno Aug 18, 2025
fde29d0
Convert skipped tests to xfail and improve framing robustness
dsarno Aug 18, 2025
5386b23
clarify stdout test failure messaging
dsarno Aug 18, 2025
63b070b
Add handshake fallback and logging checks
dsarno Aug 18, 2025
6cedb80
Claude Desktop: write BOM-free config to macOS path; dual-path fallba…
dsarno Aug 17, 2025
3bc9cd0
MCP: natural-language edit defaults; header guard + precondition for …
dsarno Aug 18, 2025
3cc1acd
MCP: add anchor_delete/anchor_replace structured ops; normalize NL/te…
dsarno Aug 18, 2025
22f55ce
Convert skipped tests to xfail and improve framing robustness
dsarno Aug 18, 2025
f3e94db
clarify stdout test failure messaging
dsarno Aug 18, 2025
d1362ac
Add handshake fallback and logging checks
dsarno Aug 18, 2025
e4e89e4
Claude Desktop: write BOM-free config to macOS path; dual-path fallba…
dsarno Aug 17, 2025
f1d773b
MCP: resolve merge conflicts; unify NL parsing and text-edit guards; …
dsarno Aug 18, 2025
c26ee13
MCP: add spec resource (script-edits); tighten script_apply_edits des…
dsarno Aug 18, 2025
3962cad
MCP: add script-edits spec resource; route all-structured edits via '…
dsarno Aug 18, 2025
c28bb38
CI: gate Unity compile steps behind secrets.UNITY_LICENSE to avoid 'C…
dsarno Aug 19, 2025
3943abd
CI: add Claude NL/T prompt at .claude/prompts/nl-unity-suite.md
dsarno Aug 19, 2025
77c841b
Tests: switch NL suite to ClaudeTests/longUnityScript-claudeTest.cs; …
dsarno Aug 19, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions UnityMcpBridge/Editor/Data/McpClients.cs
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,13 @@ public class McpClients
"Claude",
"claude_desktop_config.json"
),
macConfigPath = Path.Combine(
Environment.GetFolderPath(Environment.SpecialFolder.Personal),
"Library",
"Application Support",
"Claude",
"claude_desktop_config.json"
),
linuxConfigPath = Path.Combine(
Environment.GetFolderPath(Environment.SpecialFolder.UserProfile),
".config",
Expand Down
9 changes: 6 additions & 3 deletions UnityMcpBridge/Editor/Helpers/Response.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,21 +38,24 @@ public static object Success(string message, object data = null)
/// <param name="errorMessage">A message describing the error.</param>
/// <param name="data">Optional additional data (e.g., error details) to include.</param>
/// <returns>An object representing the error response.</returns>
public static object Error(string errorMessage, object data = null)
public static object Error(string errorCodeOrMessage, object data = null)
{
if (data != null)
{
// Note: The key is "error" for error messages, not "message"
return new
{
success = false,
error = errorMessage,
// Preserve original behavior while adding a machine-parsable code field.
// If callers pass a code string, it will be echoed in both code and error.
code = errorCodeOrMessage,
error = errorCodeOrMessage,
data = data,
};
}
else
{
return new { success = false, error = errorMessage };
return new { success = false, code = errorCodeOrMessage, error = errorCodeOrMessage };
}
}
}
Expand Down
1 change: 1 addition & 0 deletions UnityMcpBridge/Editor/Models/McpClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ public class McpClient
{
public string name;
public string windowsConfigPath;
public string macConfigPath;
public string linuxConfigPath;
public McpTypes mcpType;
public string configStatus;
Expand Down
24 changes: 23 additions & 1 deletion UnityMcpBridge/Editor/Tools/ManageEditor.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using Newtonsoft.Json.Linq;
using UnityEditor;
using UnityEditorInternal; // Required for tag management
Expand Down Expand Up @@ -89,6 +90,8 @@ public static object HandleCommand(JObject @params)
// Editor State/Info
case "get_state":
return GetEditorState();
case "get_project_root":
return GetProjectRoot();
case "get_windows":
return GetEditorWindows();
case "get_active_tool":
Expand Down Expand Up @@ -137,7 +140,7 @@ public static object HandleCommand(JObject @params)

default:
return Response.Error(
$"Unknown action: '{action}'. Supported actions include play, pause, stop, get_state, get_windows, get_active_tool, get_selection, set_active_tool, add_tag, remove_tag, get_tags, add_layer, remove_layer, get_layers."
$"Unknown action: '{action}'. Supported actions include play, pause, stop, get_state, get_project_root, get_windows, get_active_tool, get_selection, set_active_tool, add_tag, remove_tag, get_tags, add_layer, remove_layer, get_layers."
);
}
}
Expand Down Expand Up @@ -165,6 +168,25 @@ private static object GetEditorState()
}
}

private static object GetProjectRoot()
{
try
{
// Application.dataPath points to <Project>/Assets
string assetsPath = Application.dataPath.Replace('\\', '/');
string projectRoot = Directory.GetParent(assetsPath)?.FullName.Replace('\\', '/');
if (string.IsNullOrEmpty(projectRoot))
{
return Response.Error("Could not determine project root from Application.dataPath");
}
return Response.Success("Project root resolved.", new { projectRoot });
}
catch (Exception e)
{
return Response.Error($"Error getting project root: {e.Message}");
}
}

private static object GetEditorWindows()
{
try
Expand Down
Loading