mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[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
This commit is contained in:
committed by
intellij-monorepo-bot
parent
44a95f72c3
commit
026fef3eb5
@@ -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=<span style='color: #00AA00;'>\u2713 Client configured</span>
|
||||
mcp.server.not.configured=Client not configured
|
||||
mcp.server.not.configured=\u2298 Client not configured
|
||||
mcp.server.configured.port.invalid=<span style='color: #CC0000;'>\u2717 Client configured but port doesn't match current IDE instance</span>
|
||||
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: <a href="https://youtrack.jetbrains.com/articles/SUPPORT-A-2156/MCP-Available-Tools">MCP Available Tools</a>\n\nDo you want to 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: <a href="https://youtrack.jetbrains.com/articles/SUPPORT-A-2156/MCP-Available-Tools">MCP Available Tools</a>\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
|
||||
+49
-49
@@ -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!!)
|
||||
|
||||
Reference in New Issue
Block a user