CoplayDev/unity-mcp · error · InvalidOperationException

uvx not found. Install uv/uvx or set the override in Advance

Error message

uvx not found. Install uv/uvx or set the override in Advanced Settings.

What it means

GetUvxPathOrError() is a protected helper on McpClientConfiguratorBase used by JsonFileMcpConfigurator.GetManualSnippet() and other base-class methods. It calls MCPServiceLocator.Paths.GetUvxPath() and throws InvalidOperationException if the result is null or empty. GetUvxPath() returns null only when an explicit override is invalid and no system fallback exists; without an override it always returns at least the bare string 'uvx'.

Source

Thrown at MCPForUnity/Editor/Clients/McpClientConfiguratorBase.cs:61

        public virtual string GetSkillInstallPath() => null;

        public abstract string GetConfigPath();
        public abstract McpStatus CheckStatus(bool attemptAutoRewrite = true);
        public abstract void Configure();

        /// <summary>Default Unregister is a no-op. Override in JsonFileMcpConfigurator /
        /// ClaudeCliMcpConfigurator etc. where removal has a concrete implementation.</summary>
        public virtual void Unregister() { }

        public abstract string GetManualSnippet();
        public abstract IList<string> GetInstallationSteps();

        protected string GetUvxPathOrError()
        {
            string uvx = MCPServiceLocator.Paths.GetUvxPath();
            if (string.IsNullOrEmpty(uvx))
            {
                throw new InvalidOperationException("uvx not found. Install uv/uvx or set the override in Advanced Settings.");
            }
            return uvx;
        }

        protected string CurrentOsPath()
        {
            if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
                return client.windowsConfigPath;
            if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
                return client.macConfigPath;
            return client.linuxConfigPath;
        }

        protected static bool ParentDirectoryExists(string configPath)
        {
            try
            {
                if (string.IsNullOrEmpty(configPath)) return false;

View on GitHub (pinned to c21bf496bc)

Solutions

  1. Remove or correct the uvx path override in Advanced Settings.
  2. Install uv/uvx system-wide so GetUvxPath() discovers it via ResolveUvxFromSystem().
  3. If the override is the issue, clear it via EditorPrefs.DeleteKey(EditorPrefKeys.UvxPathOverride) or the Advanced Settings UI.
Defensive patterns

Strategy: validation

Validate before calling

string uvx = MCPServiceLocator.Paths.GetUvxPath();
if (string.IsNullOrEmpty(uvx))
{ ShowErrorAndGuideUser("uvx not found. Install uv or set override in Advanced Settings."); return; }

Try / catch

try { string snippet = configurator.GetManualSnippet(); }
catch (InvalidOperationException ex) when (ex.Message.Contains("uvx not found"))
{ snippet = "# Install uv/uvx first, then retry."; }

Prevention

When it happens

Trigger: Any base-class code path that calls GetUvxPathOrError() — typically GetManualSnippet() on a JsonFileMcpConfigurator subclass — when GetUvxPath() returns null (invalid override, no system binary).

Common situations: The user clicks 'Copy Manual Snippet' or similar in the MCP for Unity UI while a stale uvx override is set. A CI environment where EditorPrefs carries a bad override from a prior run.

Related errors


AI-assisted analysis of CoplayDev/unity-mcp@c21bf496bc (2026-08-13). Data as JSON: /api/errors/d0a011679ef158e4. Report an issue: GitHub.