From 5fc99b4d96e14cde9e58f3a7a2efeb65c7508f8a Mon Sep 17 00:00:00 2001 From: Marcus Sanatan Date: Tue, 27 Jan 2026 02:06:40 -0400 Subject: [PATCH 1/7] feat: add TestPyPI toggle for pre-release server package testing - Add UseTestPyPI editor preference key - Add TestPyPI toggle to Advanced settings UI with tooltip - Configure uvx to use test.pypi.org when TestPyPI mode enabled - Skip version pinning in TestPyPI mode to get latest pre-release - Update ConfigJsonBuilder to handle TestPyPI index URL --- MCPForUnity/Editor/Constants/EditorPrefKeys.cs | 1 + MCPForUnity/Editor/Helpers/ConfigJsonBuilder.cs | 16 ++++++++++++++-- .../Components/Advanced/McpAdvancedSection.cs | 17 +++++++++++++++++ .../Components/Advanced/McpAdvancedSection.uxml | 5 +++++ 4 files changed, 37 insertions(+), 2 deletions(-) diff --git a/MCPForUnity/Editor/Constants/EditorPrefKeys.cs b/MCPForUnity/Editor/Constants/EditorPrefKeys.cs index a6e81b4ac..42bfac2dd 100644 --- a/MCPForUnity/Editor/Constants/EditorPrefKeys.cs +++ b/MCPForUnity/Editor/Constants/EditorPrefKeys.cs @@ -28,6 +28,7 @@ internal static class EditorPrefKeys internal const string WebSocketUrlOverride = "MCPForUnity.WebSocketUrl"; internal const string GitUrlOverride = "MCPForUnity.GitUrlOverride"; internal const string DevModeForceServerRefresh = "MCPForUnity.DevModeForceServerRefresh"; + internal const string UseTestPyPI = "MCPForUnity.UseTestPyPI"; internal const string ProjectScopedToolsLocalHttp = "MCPForUnity.ProjectScopedTools.LocalHttp"; internal const string PackageDeploySourcePath = "MCPForUnity.PackageDeploy.SourcePath"; diff --git a/MCPForUnity/Editor/Helpers/ConfigJsonBuilder.cs b/MCPForUnity/Editor/Helpers/ConfigJsonBuilder.cs index dd00d73d0..489e9a070 100644 --- a/MCPForUnity/Editor/Helpers/ConfigJsonBuilder.cs +++ b/MCPForUnity/Editor/Helpers/ConfigJsonBuilder.cs @@ -2,8 +2,8 @@ using System.Collections.Generic; using System.IO; using System.Linq; -using MCPForUnity.Editor.Constants; using MCPForUnity.Editor.Clients.Configurators; +using MCPForUnity.Editor.Constants; using MCPForUnity.Editor.Helpers; using MCPForUnity.Editor.Models; using Newtonsoft.Json; @@ -170,7 +170,19 @@ private static IList BuildUvxArgs(string fromUrl, string packageName) args.Add("--no-cache"); args.Add("--refresh"); } - if (!string.IsNullOrEmpty(fromUrl)) + + // TestPyPI mode: use test.pypi.org as the default index for pre-release testing + // When using TestPyPI, don't pin version since TestPyPI versions may differ from PyPI + bool useTestPyPI = EditorPrefs.GetBool(EditorPrefKeys.UseTestPyPI, false); + if (useTestPyPI) + { + args.Add("--default-index"); + args.Add("https://test.pypi.org/simple/"); + // Use unversioned package name to get latest from TestPyPI + args.Add("--from"); + args.Add("mcpforunityserver"); + } + else if (!string.IsNullOrEmpty(fromUrl)) { args.Add("--from"); args.Add(fromUrl); diff --git a/MCPForUnity/Editor/Windows/Components/Advanced/McpAdvancedSection.cs b/MCPForUnity/Editor/Windows/Components/Advanced/McpAdvancedSection.cs index 26f610167..cc5d1defb 100644 --- a/MCPForUnity/Editor/Windows/Components/Advanced/McpAdvancedSection.cs +++ b/MCPForUnity/Editor/Windows/Components/Advanced/McpAdvancedSection.cs @@ -26,6 +26,7 @@ public class McpAdvancedSection private Button clearGitUrlButton; private Toggle debugLogsToggle; private Toggle devModeForceRefreshToggle; + private Toggle useTestPyPIToggle; private TextField deploySourcePath; private Button browseDeploySourceButton; private Button clearDeploySourceButton; @@ -64,6 +65,7 @@ private void CacheUIElements() clearGitUrlButton = Root.Q