From 83a283198230876a092dc6b184c9379aa2417789 Mon Sep 17 00:00:00 2001 From: Roberto T <61755417+RobertGlobant20@users.noreply.github.com> Date: Tue, 9 Jun 2026 14:32:37 -0600 Subject: [PATCH 1/3] DYN-9355: add MCP server startup preference and toggle Add a user setting to control whether the Dynamo MCP server starts automatically on launch. The DynamoMCP view extension reads this preference (by name) to gate its auto-start, and can still be toggled live from its Extensions menu. - PreferenceSettings: add EnableMcpServerOnStartup (default off). - PreferencesViewModel: add the McpServerEnabledOnStartup wrapper and make the Experimental section visible, since it now hosts this toggle. - PreferencesView: add the toggle to Features > Experimental, with a label and a help tooltip. - Resources: add the label and tooltip strings (resx + designer + en-US). Co-Authored-By: Claude Opus 4.8 (1M context) --- .../Configuration/PreferenceSettings.cs | 20 +++++++++++++++ .../Properties/Resources.Designer.cs | 18 +++++++++++++ .../Properties/Resources.en-US.resx | 8 ++++++ src/DynamoCoreWpf/Properties/Resources.resx | 8 ++++++ .../ViewModels/Menu/PreferencesViewModel.cs | 24 +++++++++++++++--- .../Views/Menu/PreferencesView.xaml | 25 ++++++++++++++++++- 6 files changed, 99 insertions(+), 4 deletions(-) diff --git a/src/DynamoCore/Configuration/PreferenceSettings.cs b/src/DynamoCore/Configuration/PreferenceSettings.cs index 08fe38e99c2..bc57748cc24 100644 --- a/src/DynamoCore/Configuration/PreferenceSettings.cs +++ b/src/DynamoCore/Configuration/PreferenceSettings.cs @@ -76,6 +76,7 @@ private readonly static Lazy private bool isEnablePersistExtensionsEnabled; private bool isAutoSyncDocumentBrowser = true; private bool isStaticSplashScreenEnabled; + private bool isMcpServerEnabledOnStartup; private bool isTimeStampIncludedInExportFilePath; private bool isCreatedFromValidFile = true; private string backupLocation; @@ -825,6 +826,24 @@ public bool EnableStaticSplashScreen } } + /// + /// This defines whether the Dynamo MCP (Model Context Protocol) server starts + /// automatically when Dynamo launches. When false, the server stays off until the + /// user enables it from the MCP extension's Extensions-menu toggle (DYN-9355). + /// + public bool EnableMcpServerOnStartup + { + get + { + return isMcpServerEnabledOnStartup; + } + set + { + isMcpServerEnabledOnStartup = value; + RaisePropertyChanged(nameof(EnableMcpServerOnStartup)); + } + } + /// /// This defines if the user is agree to the ML Automcomplete Terms of Use /// @@ -1100,6 +1119,7 @@ public PreferenceSettings() HideAutocompleteMethodOptions = false; EnableNotificationCenter = true; isStaticSplashScreenEnabled = true; + isMcpServerEnabledOnStartup = false; isTimeStampIncludedInExportFilePath = true; DefaultPythonEngine = string.Empty; ViewExtensionSettings = new List(); diff --git a/src/DynamoCoreWpf/Properties/Resources.Designer.cs b/src/DynamoCoreWpf/Properties/Resources.Designer.cs index 03f501a0c71..29ee279075e 100644 --- a/src/DynamoCoreWpf/Properties/Resources.Designer.cs +++ b/src/DynamoCoreWpf/Properties/Resources.Designer.cs @@ -8390,6 +8390,24 @@ public static string PreferencesViewEnablePersistExtensions { return ResourceManager.GetString("PreferencesViewEnablePersistExtensions", resourceCulture); } } + + /// + /// Looks up a localized string similar to Start the MCP server when Dynamo launches. + /// + public static string PreferencesViewEnableMcpServerOnStartup { + get { + return ResourceManager.GetString("PreferencesViewEnableMcpServerOnStartup", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to When enabled, the Dynamo MCP server starts automatically with Dynamo. When disabled, you can still turn it on at any time from the Extensions menu without restarting Dynamo. + /// + public static string PreferencesViewEnableMcpServerOnStartupTooltip { + get { + return ResourceManager.GetString("PreferencesViewEnableMcpServerOnStartupTooltip", resourceCulture); + } + } /// /// Looks up a localized string similar to Enable T-Spline nodes. diff --git a/src/DynamoCoreWpf/Properties/Resources.en-US.resx b/src/DynamoCoreWpf/Properties/Resources.en-US.resx index 14958c67a51..6552a8e1cfd 100644 --- a/src/DynamoCoreWpf/Properties/Resources.en-US.resx +++ b/src/DynamoCoreWpf/Properties/Resources.en-US.resx @@ -740,6 +740,14 @@ Don't worry, you'll have the option to save your work. Experimental Preferences | Features | Experimental + + Start the MCP server when Dynamo launches + Preferences | Features | Experimental + + + When enabled, the Dynamo MCP server starts automatically with Dynamo. When disabled, you can still turn it on at any time from the Extensions menu without restarting Dynamo. + Preferences | Features | Experimental + _Settings Setting menu diff --git a/src/DynamoCoreWpf/Properties/Resources.resx b/src/DynamoCoreWpf/Properties/Resources.resx index 5f1aae9c455..532fca8c339 100644 --- a/src/DynamoCoreWpf/Properties/Resources.resx +++ b/src/DynamoCoreWpf/Properties/Resources.resx @@ -600,6 +600,14 @@ Experimental Preferences | Features | Experimental + + Start the MCP server when Dynamo launches + Preferences | Features | Experimental + + + When enabled, the Dynamo MCP server starts automatically with Dynamo. When disabled, you can still turn it on at any time from the Extensions menu without restarting Dynamo. + Preferences | Features | Experimental + Enable T-Spline nodes Preferences | Features | Experimental | Enable T-Spline nodes diff --git a/src/DynamoCoreWpf/ViewModels/Menu/PreferencesViewModel.cs b/src/DynamoCoreWpf/ViewModels/Menu/PreferencesViewModel.cs index d5f50cac3b0..ac226dbb9c9 100644 --- a/src/DynamoCoreWpf/ViewModels/Menu/PreferencesViewModel.cs +++ b/src/DynamoCoreWpf/ViewModels/Menu/PreferencesViewModel.cs @@ -401,6 +401,24 @@ public bool StaticSplashScreenEnabled } } + /// + /// Controls the IsChecked property in the "start MCP server on launch" toggle button. + /// When enabled, the Dynamo MCP server starts automatically with Dynamo; otherwise it + /// stays off until enabled from the MCP extension's Extensions-menu toggle (DYN-9355). + /// + public bool McpServerEnabledOnStartup + { + get + { + return preferenceSettings.EnableMcpServerOnStartup; + } + set + { + preferenceSettings.EnableMcpServerOnStartup = value; + RaisePropertyChanged(nameof(McpServerEnabledOnStartup)); + } + } + /// /// Controls the IsChecked property in the selecting to include timestamp for export path section /// @@ -1287,9 +1305,9 @@ public bool IsExperimentalExpanderVisible { get { - // Hide for now since panel nodes are OOTB and no other experimental features - // Keep infrastructure for future experimental features - return false; + // Visible now that the Experimental section hosts the MCP server startup + // toggle (DYN-9355). Previously hidden when the section had no features. + return true; } } diff --git a/src/DynamoCoreWpf/Views/Menu/PreferencesView.xaml b/src/DynamoCoreWpf/Views/Menu/PreferencesView.xaml index 246c0329346..3d410facf32 100644 --- a/src/DynamoCoreWpf/Views/Menu/PreferencesView.xaml +++ b/src/DynamoCoreWpf/Views/Menu/PreferencesView.xaml @@ -1100,7 +1100,30 @@ - + + + + From 0073fa4da3a0fa6ba3be6d5736b52a6a0b4585ad Mon Sep 17 00:00:00 2001 From: Roberto T <61755417+RobertGlobant20@users.noreply.github.com> Date: Wed, 10 Jun 2026 10:39:12 -0600 Subject: [PATCH 2/3] DYN-9355: fix settings fixture and add MCP startup tests Add EnableMcpServerOnStartup to DynamoSettings-NewSettings.xml so TestImportCopySettings' "all properties differ from defaults" invariant holds after the new preference was introduced. Add two unit tests covering the preference: default-off behavior and persistence across a save/load round-trip. Co-Authored-By: Claude Opus 4.8 (1M context) --- .../Configuration/PreferenceSettingsTests.cs | 25 +++++++++++++++++++ test/settings/DynamoSettings-NewSettings.xml | 1 + 2 files changed, 26 insertions(+) diff --git a/test/DynamoCoreTests/Configuration/PreferenceSettingsTests.cs b/test/DynamoCoreTests/Configuration/PreferenceSettingsTests.cs index ab659c59255..8c1c567737f 100644 --- a/test/DynamoCoreTests/Configuration/PreferenceSettingsTests.cs +++ b/test/DynamoCoreTests/Configuration/PreferenceSettingsTests.cs @@ -427,6 +427,31 @@ public void TestImportCopySettings() Assert.IsTrue(checkEquality.SamePropertyValues.Count == checkEquality.Properties.Count); } + [Test] + [Category("UnitTests")] + public void WhenSettingsAreNewThenMcpServerOnStartupDefaultsToFalse() + { + // The MCP server must stay off unless the user opts in (DYN-9355). + var settings = new PreferenceSettings(); + + Assert.IsFalse(settings.EnableMcpServerOnStartup); + } + + [Test] + [Category("UnitTests")] + public void WhenMcpServerOnStartupIsEnabledThenItPersistsAcrossSaveAndLoad() + { + string tempPath = Path.Combine(Path.GetTempPath(), "mcpServerStartupPreference.xml"); + + var settings = new PreferenceSettings(); + settings.EnableMcpServerOnStartup = true; + + settings.Save(tempPath); + var loadedSettings = PreferenceSettings.Load(tempPath); + + Assert.IsTrue(loadedSettings.EnableMcpServerOnStartup); + } + [Test] [Category("UnitTests")] public void TestTaintedFile() diff --git a/test/settings/DynamoSettings-NewSettings.xml b/test/settings/DynamoSettings-NewSettings.xml index 6d0b1938a2e..079694ae326 100644 --- a/test/settings/DynamoSettings-NewSettings.xml +++ b/test/settings/DynamoSettings-NewSettings.xml @@ -87,6 +87,7 @@ false false false + true false false true From 6ab83bb5f2811dd34ae4aa4b7c85a92d554fbfc3 Mon Sep 17 00:00:00 2001 From: Roberto T <61755417+RobertGlobant20@users.noreply.github.com> Date: Wed, 10 Jun 2026 16:53:10 -0600 Subject: [PATCH 3/3] DYN-9355: address PR review feedback - Add EnableMcpServerOnStartup get/set to PublicAPI.Unshipped.txt to satisfy the public API analyzer (jasonstratton, Copilot, edwin). - Write the persistence test to a unique file under the per-test TempFolder (auto-cleaned by UnitTestBase) instead of a fixed temp filename, fixing the cleanup concern and the Path.Combine warning (jasonstratton, Copilot, github-code-quality). Co-Authored-By: Claude Opus 4.8 (1M context) --- src/DynamoCore/PublicAPI.Unshipped.txt | 2 ++ test/DynamoCoreTests/Configuration/PreferenceSettingsTests.cs | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/DynamoCore/PublicAPI.Unshipped.txt b/src/DynamoCore/PublicAPI.Unshipped.txt index fd19c94b62b..ae3bcd415be 100644 --- a/src/DynamoCore/PublicAPI.Unshipped.txt +++ b/src/DynamoCore/PublicAPI.Unshipped.txt @@ -1,3 +1,5 @@ +Dynamo.Configuration.PreferenceSettings.EnableMcpServerOnStartup.get -> bool +Dynamo.Configuration.PreferenceSettings.EnableMcpServerOnStartup.set -> void Dynamo.Graph.Nodes.IValueSchemaProvider Dynamo.Graph.Nodes.IValueSchemaProvider.IsListValue.get -> bool Dynamo.Graph.Nodes.IValueSchemaProvider.ValueTypeId.get -> string diff --git a/test/DynamoCoreTests/Configuration/PreferenceSettingsTests.cs b/test/DynamoCoreTests/Configuration/PreferenceSettingsTests.cs index 8c1c567737f..6e79068321a 100644 --- a/test/DynamoCoreTests/Configuration/PreferenceSettingsTests.cs +++ b/test/DynamoCoreTests/Configuration/PreferenceSettingsTests.cs @@ -441,7 +441,8 @@ public void WhenSettingsAreNewThenMcpServerOnStartupDefaultsToFalse() [Category("UnitTests")] public void WhenMcpServerOnStartupIsEnabledThenItPersistsAcrossSaveAndLoad() { - string tempPath = Path.Combine(Path.GetTempPath(), "mcpServerStartupPreference.xml"); + // Use a unique file under the per-test TempFolder, which UnitTestBase cleans up on teardown. + string tempPath = GetNewFileNameOnTempPath("xml"); var settings = new PreferenceSettings(); settings.EnableMcpServerOnStartup = true;