Skip to content

A native macOS / windows / Linux database IDE built with Swift and AppKit. Connect to PostgreSQL, MySQL, SQLite, and Redis from a single app with a fast, keyboard-driven interface.

C++

feat(mcp): ConnectionFormDialog MCP mode picker (Round 2C)

DangHuynh9f160a748402
diff --git a/windows/Gridex/ConnectionFormDialog.cpp b/windows/Gridex/ConnectionFormDialog.cpp
index fd576a6..3a90526 100644
--- a/windows/Gridex/ConnectionFormDialog.cpp
+++ b/windows/Gridex/ConnectionFormDialog.cpp
@@ -136,6 +136,11 @@ namespace winrt::Gridex::implementation
auto sslIdx = SslModeInput().SelectedIndex();
config.sslMode = static_cast<DBModels::SSLMode>(sslIdx);
config.sslEnabled = (sslIdx != 1);
+ // MCP access mode — 0=Locked / 1=ReadOnly / 2=ReadWrite,
+ // matches MCPConnectionMode enum ordering.
+ const auto mcpIdx = McpModeInput().SelectedIndex();
+ config.mcpMode = static_cast<DBModels::MCPConnectionMode>(
+ mcpIdx < 0 ? 0 : mcpIdx);
if (dbType_ == DBModels::DatabaseType::SQLite)
config.filePath = std::wstring(FilePathInput().Text());
if (dbType_ == DBModels::DatabaseType::MongoDB)
@@ -188,6 +193,7 @@ namespace winrt::Gridex::implementation
PasswordInput().Password(winrt::hstring(config.password));
DatabaseInput().Text(winrt::hstring(config.database));
SslModeInput().SelectedIndex(static_cast<int>(config.sslMode));
+ McpModeInput().SelectedIndex(static_cast<int>(config.mcpMode));
FilePathInput().Text(winrt::hstring(config.filePath));
UriInput().Text(winrt::hstring(config.connectionUri));
MongoOptionsInput().Text(winrt::hstring(config.mongoOptions));
diff --git a/windows/Gridex/ConnectionFormDialog.xaml b/windows/Gridex/ConnectionFormDialog.xaml
index 77b0cca..37695b3 100644
--- a/windows/Gridex/ConnectionFormDialog.xaml
+++ b/windows/Gridex/ConnectionFormDialog.xaml
@@ -22,6 +22,7 @@
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
+ <RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<!-- Row 0: Name + Group -->
@@ -321,6 +322,36 @@
</Grid>
</Grid>
</StackPanel>
+
+ <!-- Row 10: MCP access mode (per-connection). Decides
+ whether the AI (via MCP server) can see / query /
+ modify this connection. Default Locked, user must
+ opt in explicitly. -->
+ <TextBlock Grid.Row="10" Grid.Column="0"
+ Text="MCP access"
+ VerticalAlignment="Center"
+ HorizontalAlignment="Right"
+ Margin="0,0,16,0"
+ Foreground="{ThemeResource TextFillColorSecondaryBrush}" />
+ <Grid Grid.Row="10" Grid.Column="1" Margin="0,0,0,12">
+ <Grid.ColumnDefinitions>
+ <ColumnDefinition Width="Auto" />
+ <ColumnDefinition Width="*" />
+ </Grid.ColumnDefinitions>
+ <ComboBox x:Name="McpModeInput" Grid.Column="0"
+ MinWidth="160" SelectedIndex="0">
+ <ComboBoxItem Content="Locked (AI hidden)" />
+ <ComboBoxItem Content="Read-only (AI can query)" />
+ <ComboBoxItem Content="Read-write (AI can modify w/ approval)" />
+ </ComboBox>
+ <TextBlock Grid.Column="1"
+ Margin="12,0,0,0"
+ VerticalAlignment="Center"
+ FontSize="11"
+ TextWrapping="Wrap"
+ Foreground="{ThemeResource TextFillColorTertiaryBrush}"
+ Text="You can change this later in MCP Server → Connections." />
+ </Grid>
</Grid>
</ScrollViewer>