diff --git a/MCPForUnity/Editor/Constants/EditorPrefKeys.cs b/MCPForUnity/Editor/Constants/EditorPrefKeys.cs index dfa6852..a6e81b4 100644 --- a/MCPForUnity/Editor/Constants/EditorPrefKeys.cs +++ b/MCPForUnity/Editor/Constants/EditorPrefKeys.cs @@ -28,6 +28,7 @@ namespace MCPForUnity.Editor.Constants internal const string WebSocketUrlOverride = "MCPForUnity.WebSocketUrl"; internal const string GitUrlOverride = "MCPForUnity.GitUrlOverride"; internal const string DevModeForceServerRefresh = "MCPForUnity.DevModeForceServerRefresh"; + internal const string ProjectScopedToolsLocalHttp = "MCPForUnity.ProjectScopedTools.LocalHttp"; internal const string PackageDeploySourcePath = "MCPForUnity.PackageDeploy.SourcePath"; internal const string PackageDeployLastBackupPath = "MCPForUnity.PackageDeploy.LastBackupPath"; diff --git a/MCPForUnity/Editor/Services/ServerManagementService.cs b/MCPForUnity/Editor/Services/ServerManagementService.cs index 69ca6d5..b9e5ecd 100644 --- a/MCPForUnity/Editor/Services/ServerManagementService.cs +++ b/MCPForUnity/Editor/Services/ServerManagementService.cs @@ -1312,9 +1312,14 @@ namespace MCPForUnity.Editor.Services // Use central helper that checks both DevModeForceServerRefresh AND local path detection. // Note: --reinstall is not supported by uvx, use --no-cache --refresh instead string devFlags = AssetPathUtility.ShouldForceUvxRefresh() ? "--no-cache --refresh " : string.Empty; + bool projectScopedTools = EditorPrefs.GetBool( + EditorPrefKeys.ProjectScopedToolsLocalHttp, + true + ); + string scopedFlag = projectScopedTools ? " --project-scoped-tools" : string.Empty; string args = string.IsNullOrEmpty(fromUrl) - ? $"{devFlags}{packageName} --transport http --http-url {httpUrl}" - : $"{devFlags}--from {fromUrl} {packageName} --transport http --http-url {httpUrl}"; + ? $"{devFlags}{packageName} --transport http --http-url {httpUrl}{scopedFlag}" + : $"{devFlags}--from {fromUrl} {packageName} --transport http --http-url {httpUrl}{scopedFlag}"; fileName = uvxPath; arguments = args; diff --git a/MCPForUnity/Editor/Windows/Components/Connection/McpConnectionSection.cs b/MCPForUnity/Editor/Windows/Components/Connection/McpConnectionSection.cs index 7d70d47..e984721 100644 --- a/MCPForUnity/Editor/Windows/Components/Connection/McpConnectionSection.cs +++ b/MCPForUnity/Editor/Windows/Components/Connection/McpConnectionSection.cs @@ -35,6 +35,8 @@ namespace MCPForUnity.Editor.Windows.Components.Connection private TextField httpUrlField; private Button startHttpServerButton; private Button stopHttpServerButton; + private VisualElement projectScopedToolsRow; + private Toggle projectScopedToolsToggle; private VisualElement unitySocketPortRow; private TextField unityPortField; private VisualElement statusIndicator; @@ -83,6 +85,8 @@ namespace MCPForUnity.Editor.Windows.Components.Connection httpUrlField = Root.Q("http-url"); startHttpServerButton = Root.Q