Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions MCPForUnity/Editor/Constants/EditorPrefKeys.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down
16 changes: 14 additions & 2 deletions MCPForUnity/Editor/Helpers/ConfigJsonBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -170,7 +170,19 @@ private static IList<string> 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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -64,6 +65,7 @@ private void CacheUIElements()
clearGitUrlButton = Root.Q<Button>("clear-git-url-button");
debugLogsToggle = Root.Q<Toggle>("debug-logs-toggle");
devModeForceRefreshToggle = Root.Q<Toggle>("dev-mode-force-refresh-toggle");
useTestPyPIToggle = Root.Q<Toggle>("use-testpypi-toggle");
deploySourcePath = Root.Q<TextField>("deploy-source-path");
browseDeploySourceButton = Root.Q<Button>("browse-deploy-source-button");
clearDeploySourceButton = Root.Q<Button>("clear-deploy-source-button");
Expand Down Expand Up @@ -98,6 +100,13 @@ private void InitializeUI()
if (forceRefreshLabel != null)
forceRefreshLabel.tooltip = devModeForceRefreshToggle.tooltip;
}
if (useTestPyPIToggle != null)
{
useTestPyPIToggle.tooltip = "When enabled, uvx will use TestPyPI (test.pypi.org) instead of PyPI to fetch the server package. Useful for testing pre-release versions.";
var testPyPILabel = useTestPyPIToggle?.parent?.Q<Label>();
if (testPyPILabel != null)
testPyPILabel.tooltip = useTestPyPIToggle.tooltip;
}
if (testConnectionButton != null)
testConnectionButton.tooltip = "Test the connection between Unity and the MCP server.";
if (deploySourcePath != null)
Expand Down Expand Up @@ -128,6 +137,7 @@ private void InitializeUI()
McpLog.SetDebugLoggingEnabled(debugEnabled);

devModeForceRefreshToggle.value = EditorPrefs.GetBool(EditorPrefKeys.DevModeForceServerRefresh, false);
useTestPyPIToggle.value = EditorPrefs.GetBool(EditorPrefKeys.UseTestPyPI, false);
UpdatePathOverrides();
UpdateDeploymentSection();
}
Expand Down Expand Up @@ -172,6 +182,12 @@ private void RegisterCallbacks()
OnHttpServerCommandUpdateRequested?.Invoke();
});

useTestPyPIToggle.RegisterValueChangedCallback(evt =>
{
EditorPrefs.SetBool(EditorPrefKeys.UseTestPyPI, evt.newValue);
OnHttpServerCommandUpdateRequested?.Invoke();
});

deploySourcePath.RegisterValueChangedCallback(evt =>
{
string path = evt.newValue?.Trim();
Expand Down Expand Up @@ -274,6 +290,7 @@ public void UpdatePathOverrides()
gitUrlOverride.value = EditorPrefs.GetString(EditorPrefKeys.GitUrlOverride, "");
debugLogsToggle.value = EditorPrefs.GetBool(EditorPrefKeys.DebugLogs, false);
devModeForceRefreshToggle.value = EditorPrefs.GetBool(EditorPrefKeys.DevModeForceServerRefresh, false);
useTestPyPIToggle.value = EditorPrefs.GetBool(EditorPrefKeys.UseTestPyPI, false);
UpdateDeploymentSection();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,11 @@
<ui:Toggle name="dev-mode-force-refresh-toggle" class="setting-toggle" />
</ui:VisualElement>

<ui:VisualElement class="setting-row">
<ui:Label text="Use TestPyPI:" class="setting-label" />
<ui:Toggle name="use-testpypi-toggle" class="setting-toggle" />
</ui:VisualElement>

<ui:VisualElement class="override-row" style="margin-top: 8px;">
<ui:Label text="Package Source:" class="override-label" />
</ui:VisualElement>
Expand Down