CoplayDev/unity-mcp · error · InvalidOperationException
{result}
Error message
{result} What it means
JsonFileMcpConfigurator.Configure() calls McpConfigurationHelper.WriteMcpConfiguration(path, client). If the helper returns any string other than 'Configured successfully', Configure() throws InvalidOperationException with that string as the message. The two known non-success returns are 'uv package manager not found. Please install uv first.' (GetUvxPath returns null) and 'Skipped (locked)' (LOCK_CONFIG_KEY EditorPrefs is true).
Source
Thrown at MCPForUnity/Editor/Clients/McpClientConfiguratorBase.cs:357
return client.status;
}
public override void Configure()
{
// Always idempotent-write. The per-client UI button routes through Unregister
// when the user clicks while the client is already Configured; the bulk
// "Configure All" path calls this directly and expects an unconditional write.
string path = GetConfigPath();
McpConfigurationHelper.EnsureConfigDirectoryExists(path);
string result = McpConfigurationHelper.WriteMcpConfiguration(path, client);
if (result == "Configured successfully")
{
client.SetStatus(McpStatus.Configured);
client.configuredTransport = HttpEndpointUtility.GetCurrentServerTransport();
}
else
{
throw new InvalidOperationException(result);
}
}
public override string GetConfigureActionLabel()
=> client.status == McpStatus.Configured ? "Unregister" : "Configure";
/// <summary>
/// Removes the unityMCP entry from the client's JSON config (VS Code-style
/// `servers` / `mcp.servers` layouts, the standard `mcpServers` layout, or a
/// client-specific container such as Kilo's `mcp`). Leaves the file in place so we
/// don't clobber other servers the user has configured.
/// </summary>
public override void Unregister()
{
string path = GetConfigPath();
try
{
if (!File.Exists(path))View on GitHub (pinned to c21bf496bc)
Solutions
- Install uv (https://docs.astral.sh/uv/getting-started/installation/) — the most common trigger is 'uv package manager not found'.
- Disable the config lock: set EditorPref LOCK_CONFIG_KEY to false, or use the MCP for Unity UI toggle.
- If a uvx path override is set incorrectly, clear it in Advanced Settings.
- Read the exception Message field — it contains the exact helper return string that identifies the root cause.
Defensive patterns
Strategy: try-catch
Validate before calling
string probe = MCPServiceLocator.Paths.GetUvxPath();
if (probe == null)
{ ShowError("uv not found. Install uv first."); return; }
if (EditorPrefs.GetBool(LOCK_CONFIG_KEY, false))
{ ShowError("Config is locked. Disable lock in settings."); return; } Try / catch
try { configurator.Configure(); }
catch (InvalidOperationException ex)
{ Debug.LogError($"Configuration failed: {ex.Message}"); } Prevention
- Install uv before configuring any JSON-based MCP client.
- Disable the config lock before clicking Configure.
- Read the exception Message to distinguish uv-not-found from config-locked.
When it happens
Trigger: Clicking Configure on a JSON-file-based client (Claude Desktop, Cursor, Windsurf, etc.) when uv is not resolvable, or when the config lock EditorPref is enabled.
Common situations: uv/uvx not installed on a fresh machine. Config lock was enabled for troubleshooting and not turned off. The uvx override is invalid.
Related errors
- uvx not found. Install uv/uvx or set the override in Advance
- Failed to unregister: {ex.Message}
- uvx not found. Install uv/uvx or set the override in Advance
- uvx not found. Install uv/uvx or set the override in Advance
- Cherry Studio uses UI-based configuration. Please use the Ma
AI-assisted analysis of CoplayDev/unity-mcp@c21bf496bc (2026-08-13).
Data as JSON: /api/errors/e0fd685eddcd822f.
Report an issue: GitHub.