Start built-in web and reconnect enabled MCP profiles

This commit is contained in:
Mark Gregory
2026-11-16 17:43:02 +00:00
parent a2ccafa613
commit dd06e337fc
4 changed files with 111 additions and 25 deletions
+26 -8
View File
@@ -243,9 +243,10 @@ struct MCPSettings: View {
HSplitView {
Form {
Section("Built-In Tools") {
connectionRow(.web, title: BuiltInWebTools.name, subtitle: "Retrieve pages and search via SearXNG", icon: "globe") {
let search = webSearchEndpoint
studio.connectMCP(.web, name: BuiltInWebTools.name) { BuiltInWebTools(searchEndpoint: search) }
LabeledContent {
Text("Runs on demand").foregroundStyle(.secondary)
} label: {
Label(BuiltInWebTools.name, systemImage: "globe")
}
}
Section("Custom MCP Servers") {
@@ -261,11 +262,27 @@ struct MCPSettings: View {
}.buttonStyle(.bordered)
ForEach(profiles.keys.sorted(), id: \.self) { name in
if let profile = profiles[name] {
connectionRow(.profile(name), title: name,
subtitle: profile.command == nil ? "Streamable HTTP" : "Local stdio",
icon: profile.command == nil ? "network" : "terminal",
local: profile.command != nil) {
studio.connectMCP(.profile(name), name: name) { try profile.makeClient() }
let id = MCPConnectionID.profile(name)
let state = studio.mcpConnections[id]
VStack(alignment: .leading, spacing: 5) {
Toggle(name, isOn: Binding(
get: { studio.enabledMCPProfiles(path: configPath).contains(name) },
set: { enabled in
if enabled { selected = id }
studio.setMCPProfile(name, enabled: enabled, path: configPath)
}
))
if let state {
Text(state.progress ?? state.output)
.font(.caption)
.foregroundStyle(state.failed ? Color.red : Color.secondary)
.textSelection(.enabled)
if state.failed {
Button("Retry") { studio.restoreToolsets() }
} else if state.toolset != nil {
Button("Tools") { selected = id }
}
}
}
}
}
@@ -439,6 +456,7 @@ struct MCPSettings: View {
}
profiles = file.mcpServers
configPath = url.path
if invalidateProfiles { studio.restoreToolsets() }
configStatus = "\(profiles.count) custom server(s) loaded from \(url.lastPathComponent)."
} catch {
configStatus = "Could not read \(url.lastPathComponent): \(error.localizedDescription)"