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
20 changes: 20 additions & 0 deletions src/DynamoCore/Configuration/PreferenceSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ private readonly static Lazy<PreferenceSettings>
private bool isEnablePersistExtensionsEnabled;
private bool isAutoSyncDocumentBrowser = true;
private bool isStaticSplashScreenEnabled;
private bool isMcpServerEnabledOnStartup;
private bool isTimeStampIncludedInExportFilePath;
private bool isCreatedFromValidFile = true;
private string backupLocation;
Expand Down Expand Up @@ -825,6 +826,24 @@ public bool EnableStaticSplashScreen
}
}

/// <summary>
/// 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).
/// </summary>
public bool EnableMcpServerOnStartup

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to add the new property into the PublicAPI.Shipped.txt file? with both getter and setter signatures

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, but I believe they should go into PublicAPI.Unshipped.txt

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed in 6ab83bb — added both the getter and setter to PublicAPI.Unshipped.txt and confirmed the analyzer build passes.

{
get
{
return isMcpServerEnabledOnStartup;
}
set
{
isMcpServerEnabledOnStartup = value;
RaisePropertyChanged(nameof(EnableMcpServerOnStartup));
}
}
Comment on lines +829 to +845

/// <summary>
/// This defines if the user is agree to the ML Automcomplete Terms of Use
/// </summary>
Expand Down Expand Up @@ -1100,6 +1119,7 @@ public PreferenceSettings()
HideAutocompleteMethodOptions = false;
EnableNotificationCenter = true;
isStaticSplashScreenEnabled = true;
isMcpServerEnabledOnStartup = false;
isTimeStampIncludedInExportFilePath = true;
DefaultPythonEngine = string.Empty;
ViewExtensionSettings = new List<ViewExtensionSettings>();
Expand Down
2 changes: 2 additions & 0 deletions src/DynamoCore/PublicAPI.Unshipped.txt
Original file line number Diff line number Diff line change
@@ -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
Expand Down
18 changes: 18 additions & 0 deletions src/DynamoCoreWpf/Properties/Resources.Designer.cs

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

8 changes: 8 additions & 0 deletions src/DynamoCoreWpf/Properties/Resources.en-US.resx
Original file line number Diff line number Diff line change
Expand Up @@ -740,6 +740,14 @@ Don't worry, you'll have the option to save your work.</value>
<value>Experimental</value>
<comment>Preferences | Features | Experimental</comment>
</data>
<data name="PreferencesViewEnableMcpServerOnStartup" xml:space="preserve">
<value>Start the MCP server when Dynamo launches</value>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to add the text values also for the other Languages?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @edwin-vasquez-ucaldas , we provide the default (in English) and en-US and the localization team will discover that there are new strings and provide translations for us.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for clarifying — no action needed, we ship default + en-US only and the localization team picks up the new strings.

<comment>Preferences | Features | Experimental</comment>
</data>
<data name="PreferencesViewEnableMcpServerOnStartupTooltip" xml:space="preserve">
<value>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.</value>
<comment>Preferences | Features | Experimental</comment>
</data>
<data name="DynamoViewSettingMenu" xml:space="preserve">
<value>_Settings</value>
<comment>Setting menu</comment>
Expand Down
8 changes: 8 additions & 0 deletions src/DynamoCoreWpf/Properties/Resources.resx
Original file line number Diff line number Diff line change
Expand Up @@ -600,6 +600,14 @@
<value>Experimental</value>
<comment>Preferences | Features | Experimental</comment>
</data>
<data name="PreferencesViewEnableMcpServerOnStartup" xml:space="preserve">
<value>Start the MCP server when Dynamo launches</value>
<comment>Preferences | Features | Experimental</comment>
</data>
<data name="PreferencesViewEnableMcpServerOnStartupTooltip" xml:space="preserve">
<value>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.</value>
<comment>Preferences | Features | Experimental</comment>
</data>
<data name="PreferencesViewEnableTSplineNodes" xml:space="preserve">
<value>Enable T-Spline nodes</value>
<comment>Preferences | Features | Experimental | Enable T-Spline nodes</comment>
Expand Down
24 changes: 21 additions & 3 deletions src/DynamoCoreWpf/ViewModels/Menu/PreferencesViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -401,6 +401,24 @@ public bool StaticSplashScreenEnabled
}
}

/// <summary>
/// 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).
/// </summary>
public bool McpServerEnabledOnStartup
{
get
{
return preferenceSettings.EnableMcpServerOnStartup;
}
set
{
preferenceSettings.EnableMcpServerOnStartup = value;
RaisePropertyChanged(nameof(McpServerEnabledOnStartup));
}
}

/// <summary>
/// Controls the IsChecked property in the selecting to include timestamp for export path section
/// </summary>
Expand Down Expand Up @@ -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;
}
}

Expand Down
25 changes: 24 additions & 1 deletion src/DynamoCoreWpf/Views/Menu/PreferencesView.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -1100,7 +1100,30 @@
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<!-- Empty for now, ready for future experimental features -->
<!--This Grid row contains the MCP server startup toggle (DYN-9355)-->
<StackPanel Orientation="Horizontal" Margin="0,12,0,0" Grid.Row="0">
<ToggleButton Name="McpServerToggle"
Width="{StaticResource ToggleButtonWidth}"
Height="{StaticResource ToggleButtonHeight}"
VerticalAlignment="Center"
IsChecked="{Binding Path=McpServerEnabledOnStartup}"
Style="{StaticResource EllipseToggleButton1}"/>
<Label Content="{x:Static p:Resources.PreferencesViewEnableMcpServerOnStartup}"
Margin="10,0,0,0"
VerticalAlignment="Center"
Foreground="{StaticResource PreferencesWindowFontColor}"/>
<Image Name="McpServerIcon"
Width="14"
Height="14"
Margin="10,0,0,0"
HorizontalAlignment="Left"
VerticalAlignment="Center"
Style="{StaticResource QuestionIcon}">
<Image.ToolTip>
<ToolTip Content="{x:Static p:Resources.PreferencesViewEnableMcpServerOnStartupTooltip}" Style="{StaticResource GenericToolTipLight}"/>
</Image.ToolTip>
</Image>
</StackPanel>
</Grid>
</Expander>

Expand Down
26 changes: 26 additions & 0 deletions test/DynamoCoreTests/Configuration/PreferenceSettingsTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -427,6 +427,32 @@ 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()
{
// 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;

settings.Save(tempPath);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need to cleanup this file after the test

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed in 6ab83bb — the test now writes to a unique file under the per-test TempFolder, which UnitTestBase auto-cleans on teardown.

var loadedSettings = PreferenceSettings.Load(tempPath);

Assert.IsTrue(loadedSettings.EnableMcpServerOnStartup);
}

[Test]
[Category("UnitTests")]
public void TestTaintedFile()
Expand Down
1 change: 1 addition & 0 deletions test/settings/DynamoSettings-NewSettings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@
<IsAutoSyncDocumentBrowser>false</IsAutoSyncDocumentBrowser>
<EnableNotificationCenter>false</EnableNotificationCenter>
<EnableStaticSplashScreen>false</EnableStaticSplashScreen>
<EnableMcpServerOnStartup>true</EnableMcpServerOnStartup>
<IsMLAutocompleteTOUApproved>false</IsMLAutocompleteTOUApproved>
<IsTimeStampIncludedInExportFilePath>false</IsTimeStampIncludedInExportFilePath>
<EnablePersistExtensions>true</EnablePersistExtensions>
Expand Down
Loading