From 026fef3eb5b24fcc534133dc182df7f454cacca0 Mon Sep 17 00:00:00 2001 From: "Maxim.Kolmakov" Date: Thu, 3 Jul 2025 15:54:09 +0200 Subject: [PATCH] [mcpServer] Update settings page with parts of the new design * avoid groups for each client, they take too much space * clarify text to be more concise and clear GitOrigin-RevId: 48bade36a117b615ccf782aa9b441f88a33107b0 --- .../messages/McpServerBundle.properties | 13 ++- .../settings/McpServerSettingsConfigurable.kt | 98 +++++++++---------- 2 files changed, 57 insertions(+), 54 deletions(-) diff --git a/plugins/mcp-server/resources/messages/McpServerBundle.properties b/plugins/mcp-server/resources/messages/McpServerBundle.properties index 98fca3c2e3d2..c5feeeda50c2 100644 --- a/plugins/mcp-server/resources/messages/McpServerBundle.properties +++ b/plugins/mcp-server/resources/messages/McpServerBundle.properties @@ -1,5 +1,5 @@ border.title.terminal.commands=Terminal Commands -checkbox.enable.brave.mode.skip.command.execution.confirmations=Enable Brave Mode (skip command execution confirmations) +checkbox.enable.brave.mode.skip.command.execution.confirmations=Enable Brave mode command.name.replace.file.text=Replace File Text command.name.replace.selected.text=Replace Selected Text configurable.name.mcp.plugin=MCP Plugin @@ -30,24 +30,27 @@ mcp.clients.detected.action.show.help=Learn More About MCP mcp.clients.detected.action.dont.show=Don't Show Again notification.group.mcp.server=MCP server -mcp.general.client=General Client +mcp.general.client=Client Manual Configuration mcp.general.terminal.tab.name=MCP mcp.server.configured=\u2713 Client configured -mcp.server.not.configured=Client not configured +mcp.server.not.configured=\u2298 Client not configured mcp.server.configured.port.invalid=\u2717 Client configured but port doesn't match current IDE instance copy.mcp.server.stdio.configuration=Copy Stdio Config copy.mcp.server.configuration=Copy Config copy.mcp.server.sse.configuration=Copy SSE Config mcp.server.client.restart.info=Autoconfiguration complete. The following clients were configured: {0}. \n Client(s) might require restart to take effect. +mcp.server.client.restart.info.settings=Autoconfiguration complete. mcp.server.client.autoconfig.error=Autoconfiguration can't be completed. mcp.client.autoconfigured=Client(s) was autoconfigured mcp.client.error.autoconfigured=Error during client(s) configuration mcp.server.error.autoconfigured.info=The following clients were not configured: {0} -autoconfigure.mcp.server=Auto-Configure Client +autoconfigure.mcp.server=Auto-Configure open.settings.json=Open Settings JSON autoconfigure.progress.title=Configuring MCP Client\u2026 dialog.title.mcp.server.consent=Enable MCP Server -dialog.message.mcp.server.consent=Enabling MCP Server will allow clients to:\n\u2022 Read file structure and file contents\n\u2022 Execute various IDE actions\n\u2022 Run terminal commands\nFor a complete list of available tools, see: MCP Available Tools\n\nDo you want to enable MCP Server? \ No newline at end of file +dialog.message.mcp.server.consent=Enabling MCP Server will allow clients to:\n\u2022 Read file structure and file contents\n\u2022 Execute various IDE actions\n\u2022 Run terminal commands\nFor a complete list of available tools, see: MCP Available Tools\n\nDo you want to enable MCP Server? +settings.comment.manual.config=Paste config into client settings, depending on supported client connection type. +settings.client.group=Clients Auto-Configuration \ No newline at end of file diff --git a/plugins/mcp-server/src/com/intellij/mcpserver/settings/McpServerSettingsConfigurable.kt b/plugins/mcp-server/src/com/intellij/mcpserver/settings/McpServerSettingsConfigurable.kt index 6bcb760bf9d4..7ed2f2c59b34 100644 --- a/plugins/mcp-server/src/com/intellij/mcpserver/settings/McpServerSettingsConfigurable.kt +++ b/plugins/mcp-server/src/com/intellij/mcpserver/settings/McpServerSettingsConfigurable.kt @@ -15,11 +15,7 @@ import com.intellij.openapi.ui.DialogPanel import com.intellij.openapi.ui.MessageDialogBuilder import com.intellij.openapi.ui.popup.JBPopupFactory import com.intellij.openapi.vfs.LocalFileSystem -import com.intellij.ui.dsl.builder.MutableProperty -import com.intellij.ui.dsl.builder.RightGap -import com.intellij.ui.dsl.builder.SpacingConfiguration -import com.intellij.ui.dsl.builder.bindSelected -import com.intellij.ui.dsl.builder.panel +import com.intellij.ui.dsl.builder.* import com.intellij.ui.layout.ComponentPredicate import com.intellij.ui.layout.ValueComponentPredicate import com.intellij.ui.layout.and @@ -83,52 +79,56 @@ class McpServerSettingsConfigurable : SearchableConfigurable { } } panel { - McpClientDetector.detectGlobalMcpClients().forEach { mcpClient -> - val isConfigured = ValueComponentPredicate(mcpClient.isConfigured() ?: false) - val isPortCorrect = ValueComponentPredicate(mcpClient.isPortCorrect()) - val json = mcpClient.json - group(mcpClient.name.displayName) { - row { - text(McpServerBundle.message("mcp.server.not.configured")).visibleIf(isConfigured.not()) - text(McpServerBundle.message("mcp.server.configured")).visibleIf(isConfigured.and(isPortCorrect)) - text(McpServerBundle.message("mcp.server.configured.port.invalid")).visibleIf(isConfigured.and(isPortCorrect.not())) - } - val autoconfiguredPressed = ValueComponentPredicate(false) - val errorDuringConfiguration = ValueComponentPredicate(false) - val configExists = ValueComponentPredicate(mcpClient.configPath.exists() && mcpClient.configPath.isRegularFile()) - row { - icon(AllIcons.General.Information) - comment(McpServerBundle.message("mcp.server.client.restart.info")) - }.visibleIf(autoconfiguredPressed) - row { - icon(AllIcons.General.Error) - comment(McpServerBundle.message("mcp.server.client.autoconfig.error")) - }.visibleIf(errorDuringConfiguration) - row { - button(McpServerBundle.message("autoconfigure.mcp.server"), { - runCatching { - mcpClient.configure() - }.onFailure { - errorDuringConfiguration.set(true) - }.onSuccess { - errorDuringConfiguration.set(false) - isConfigured.set(true) - isPortCorrect.set(true) - configExists.set(true) - autoconfiguredPressed.set(true) - } - }) - button(McpServerBundle.message("open.settings.json"), { openFileInEditor(mcpClient.configPath) }).visibleIf(configExists) - button(McpServerBundle.message("copy.mcp.server.configuration"), { - CopyPasteManager.getInstance().setContents(TextTransferable(json.encodeToString(buildJsonObject { - put("jetbrains", json.encodeToJsonElement(mcpClient.getConfig())) - }) as CharSequence)) - showCopiedBallon(it) - }) - } + group(McpServerBundle.message("settings.client.group")){ + McpClientDetector.detectGlobalMcpClients().forEach { mcpClient -> + val isConfigured = ValueComponentPredicate(mcpClient.isConfigured() ?: false) + val isPortCorrect = ValueComponentPredicate(mcpClient.isPortCorrect()) + val json = mcpClient.json + row { + text(mcpClient.name.displayName) + comment(McpServerBundle.message("mcp.server.not.configured")).visibleIf(isConfigured.not()) + text(McpServerBundle.message("mcp.server.configured")).visibleIf(isConfigured.and(isPortCorrect)) + text(McpServerBundle.message("mcp.server.configured.port.invalid")).visibleIf(isConfigured.and(isPortCorrect.not())) + }.topGap(TopGap.MEDIUM) + val autoconfiguredPressed = ValueComponentPredicate(false) + val errorDuringConfiguration = ValueComponentPredicate(false) + val configExists = ValueComponentPredicate(mcpClient.configPath.exists() && mcpClient.configPath.isRegularFile()) + row { + icon(AllIcons.General.Information) + comment(McpServerBundle.message("mcp.server.client.restart.info.settings")) + }.visibleIf(autoconfiguredPressed) + row { + icon(AllIcons.General.Error) + comment(McpServerBundle.message("mcp.server.client.autoconfig.error")) + }.visibleIf(errorDuringConfiguration) + row { + button(McpServerBundle.message("autoconfigure.mcp.server"), { + runCatching { + mcpClient.configure() + }.onFailure { + errorDuringConfiguration.set(true) + }.onSuccess { + errorDuringConfiguration.set(false) + isConfigured.set(true) + isPortCorrect.set(true) + configExists.set(true) + autoconfiguredPressed.set(true) + } + }) + button(McpServerBundle.message("open.settings.json"), { openFileInEditor(mcpClient.configPath) }).visibleIf(configExists) + button(McpServerBundle.message("copy.mcp.server.configuration"), { + CopyPasteManager.getInstance().setContents(TextTransferable(json.encodeToString(buildJsonObject { + put("jetbrains", json.encodeToJsonElement(mcpClient.getConfig())) + }) as CharSequence)) + showCopiedBallon(it) + }) + } } } group(McpServerBundle.message("mcp.general.client")){ + row { + comment(McpServerBundle.message("settings.comment.manual.config")) + } row{ button(McpServerBundle.message("copy.mcp.server.sse.configuration"), { val json = createSseServerJsonEntry(McpServerService.getInstance().port) @@ -151,7 +151,7 @@ class McpServerSettingsConfigurable : SearchableConfigurable { } row { icon(AllIcons.General.Warning) - comment(McpServerBundle.message("text.warning.enabling.brave.mode.will.allow.terminal.commands.to.execute.without.confirmation.use.with.caution")) + comment(McpServerBundle.message("text.warning.enabling.brave.mode.will.allow.terminal.commands.to.execute.without.confirmation.use.with.caution")).gap(RightGap.SMALL) } } }.enabledIf(enabledCheckboxState!!)