Skip to content

Commit 3f54efc

Browse files
taylorwilsdondaniel-lxsmrubens
authored
feat: Add Refresh MCP Servers capability, fix state changes in MCP server management UI view (RooCodeInc#4267)
* docs: update contributors list [skip ci] * add refresh all mcp button & supporting logic * fully working, clean up debug * begin cleanup * console debug logging cleanup * more logging * Revert "Update contributors list" * cleanup * add missing translations * global and project level i18n strings * refactor: move translations * fix: improve MCP settings buttons layout for responsive design - Add flexWrap to button container to allow wrapping on smaller screens - Change buttons from fixed flex:1 to flex: 1 1 auto with minWidth - Ensures buttons maintain minimum readable width of 120px - Prevents button text from being truncated on narrow viewports * fix: Add missing vscode mock method and execa mock for McpHub tests - Added createTextEditorDecorationType to vscode mock in McpHub.test.ts - Created execa mock to handle ESM module import issues - Fixes test failure that was exposed by PR RooCodeInc#4267's module loading changes * fix: watch changes on project mcp settings file --------- Co-authored-by: taylorwilsdon <[email protected]> Co-authored-by: Daniel Riccio <[email protected]> Co-authored-by: Matt Rubens <[email protected]>
1 parent 1be30fc commit 3f54efc

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+730
-268
lines changed

src/__mocks__/execa.js

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
const execa = jest.fn().mockResolvedValue({
2+
stdout: "",
3+
stderr: "",
4+
exitCode: 0,
5+
failed: false,
6+
killed: false,
7+
signal: null,
8+
timedOut: false,
9+
})
10+
11+
class ExecaError extends Error {
12+
constructor(message) {
13+
super(message)
14+
this.name = "ExecaError"
15+
this.exitCode = 1
16+
this.stdout = ""
17+
this.stderr = message
18+
this.failed = true
19+
this.timedOut = false
20+
this.isCanceled = false
21+
this.killed = false
22+
this.signal = null
23+
}
24+
}
25+
26+
module.exports = {
27+
execa,
28+
ExecaError,
29+
}

src/core/webview/webviewMessageHandler.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -505,7 +505,7 @@ export const webviewMessageHandler = async (provider: ClineProvider, message: We
505505

506506
await openFile(mcpPath)
507507
} catch (error) {
508-
vscode.window.showErrorMessage(t("common:errors.create_mcp_json", { error: `${error}` }))
508+
vscode.window.showErrorMessage(t("mcp:errors.create_json", { error: `${error}` }))
509509
}
510510

511511
break
@@ -578,6 +578,13 @@ export const webviewMessageHandler = async (provider: ClineProvider, message: We
578578
await updateGlobalState("enableMcpServerCreation", message.bool ?? true)
579579
await provider.postStateToWebview()
580580
break
581+
case "refreshAllMcpServers": {
582+
const mcpHub = provider.getMcpHub()
583+
if (mcpHub) {
584+
await mcpHub.refreshAllConnections()
585+
}
586+
break
587+
}
581588
// playSound handler removed - now handled directly in the webview
582589
case "soundEnabled":
583590
const soundEnabled = message.bool ?? true

src/i18n/locales/ca/common.json

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,6 @@
2727
"this_and_subsequent": "Aquest i tots els missatges posteriors"
2828
},
2929
"errors": {
30-
"invalid_mcp_config": "Format de configuració MCP del projecte no vàlid",
31-
"invalid_mcp_settings_format": "Format JSON de configuració MCP no vàlid. Si us plau, assegura't que la teva configuració segueix el format JSON correcte.",
32-
"invalid_mcp_settings_syntax": "Format JSON de configuració MCP no vàlid. Si us plau, comprova si hi ha errors de sintaxi al teu fitxer de configuració.",
33-
"invalid_mcp_settings_validation": "Format de configuració MCP no vàlid: {{errorMessages}}",
34-
"failed_initialize_project_mcp": "Ha fallat la inicialització del servidor MCP del projecte: {{error}}",
3530
"invalid_data_uri": "Format d'URI de dades no vàlid",
3631
"checkpoint_timeout": "S'ha esgotat el temps en intentar restaurar el punt de control.",
3732
"checkpoint_failed": "Ha fallat la restauració del punt de control.",
@@ -48,8 +43,6 @@
4843
"delete_api_config": "Ha fallat l'eliminació de la configuració de l'API",
4944
"list_api_config": "Ha fallat l'obtenció de la llista de configuracions de l'API",
5045
"update_server_timeout": "Ha fallat l'actualització del temps d'espera del servidor",
51-
"failed_update_project_mcp": "Ha fallat l'actualització dels servidors MCP del projecte",
52-
"create_mcp_json": "Ha fallat la creació o obertura de .roo/mcp.json: {{error}}",
5346
"hmr_not_running": "El servidor de desenvolupament local no està executant-se, l'HMR no funcionarà. Si us plau, executa 'npm run dev' abans de llançar l'extensió per habilitar l'HMR.",
5447
"retrieve_current_mode": "Error en recuperar el mode actual de l'estat.",
5548
"failed_delete_repo": "Ha fallat l'eliminació del repositori o branca associada: {{error}}",
@@ -75,10 +68,6 @@
7568
"no_changes": "No s'han trobat canvis.",
7669
"clipboard_copy": "Missatge del sistema copiat correctament al portapapers",
7770
"history_cleanup": "S'han netejat {{count}} tasques amb fitxers que falten de l'historial.",
78-
"mcp_server_restarting": "Reiniciant el servidor MCP {{serverName}}...",
79-
"mcp_server_connected": "Servidor MCP {{serverName}} connectat",
80-
"mcp_server_deleted": "Servidor MCP eliminat: {{serverName}}",
81-
"mcp_server_not_found": "Servidor \"{{serverName}}\" no trobat a la configuració",
8271
"custom_storage_path_set": "Ruta d'emmagatzematge personalitzada establerta: {{path}}",
8372
"default_storage_path": "S'ha reprès l'ús de la ruta d'emmagatzematge predeterminada",
8473
"settings_imported": "Configuració importada correctament.",

src/i18n/locales/ca/mcp.json

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
"errors": {
3+
"invalid_settings_format": "Format JSON de configuració MCP no vàlid. Si us plau, assegura't que la teva configuració segueix el format JSON correcte.",
4+
"invalid_settings_syntax": "Format JSON de configuració MCP no vàlid. Si us plau, comprova si hi ha errors de sintaxi al teu fitxer de configuració.",
5+
"invalid_settings_validation": "Format de configuració MCP no vàlid: {{errorMessages}}",
6+
"create_json": "Ha fallat la creació o obertura de .roo/mcp.json: {{error}}",
7+
"failed_update_project": "Ha fallat l'actualització dels servidors MCP del projecte"
8+
},
9+
"info": {
10+
"server_restarting": "Reiniciant el servidor MCP {{serverName}}...",
11+
"server_connected": "Servidor MCP {{serverName}} connectat",
12+
"server_deleted": "Servidor MCP eliminat: {{serverName}}",
13+
"server_not_found": "Servidor \"{{serverName}}\" no trobat a la configuració",
14+
"global_servers_active": "Servidors MCP globals actius: {{mcpServers}}",
15+
"project_servers_active": "Servidors MCP del projecte actius: {{mcpServers}}",
16+
"already_refreshing": "Els servidors MCP ja s'estan actualitzant.",
17+
"refreshing_all": "Actualitzant tots els servidors MCP...",
18+
"all_refreshed": "Tots els servidors MCP han estat actualitzats.",
19+
"project_config_deleted": "Fitxer de configuració MCP del projecte eliminat. Tots els servidors MCP del projecte han estat desconnectats."
20+
}
21+
}

src/i18n/locales/de/common.json

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,6 @@
2323
"this_and_subsequent": "Diese und alle nachfolgenden Nachrichten"
2424
},
2525
"errors": {
26-
"invalid_mcp_config": "Ungültiges MCP-Projekt-Konfigurationsformat",
27-
"invalid_mcp_settings_format": "Ungültiges MCP-Einstellungen-JSON-Format. Bitte stelle sicher, dass deine Einstellungen dem korrekten JSON-Format entsprechen.",
28-
"invalid_mcp_settings_syntax": "Ungültiges MCP-Einstellungen-JSON-Format. Bitte überprüfe deine Einstellungsdatei auf Syntaxfehler.",
29-
"invalid_mcp_settings_validation": "Ungültiges MCP-Einstellungen-Format: {{errorMessages}}",
30-
"failed_initialize_project_mcp": "Fehler beim Initialisieren des Projekt-MCP-Servers: {{error}}",
3126
"invalid_data_uri": "Ungültiges Daten-URI-Format",
3227
"checkpoint_timeout": "Zeitüberschreitung beim Versuch, den Checkpoint wiederherzustellen.",
3328
"checkpoint_failed": "Fehler beim Wiederherstellen des Checkpoints.",
@@ -44,8 +39,6 @@
4439
"delete_api_config": "Fehler beim Löschen der API-Konfiguration",
4540
"list_api_config": "Fehler beim Abrufen der API-Konfigurationsliste",
4641
"update_server_timeout": "Fehler beim Aktualisieren des Server-Timeouts",
47-
"failed_update_project_mcp": "Fehler beim Aktualisieren der Projekt-MCP-Server",
48-
"create_mcp_json": "Fehler beim Erstellen oder Öffnen von .roo/mcp.json: {{error}}",
4942
"hmr_not_running": "Der lokale Entwicklungsserver läuft nicht, HMR wird nicht funktionieren. Bitte führen Sie 'npm run dev' vor dem Start der Erweiterung aus, um HMR zu aktivieren.",
5043
"retrieve_current_mode": "Fehler beim Abrufen des aktuellen Modus aus dem Zustand.",
5144
"failed_delete_repo": "Fehler beim Löschen des zugehörigen Shadow-Repositorys oder -Zweigs: {{error}}",
@@ -71,10 +64,6 @@
7164
"no_changes": "Keine Änderungen gefunden.",
7265
"clipboard_copy": "Systemnachricht erfolgreich in die Zwischenablage kopiert",
7366
"history_cleanup": "{{count}} Aufgabe(n) mit fehlenden Dateien aus dem Verlauf bereinigt.",
74-
"mcp_server_restarting": "MCP-Server {{serverName}} wird neu gestartet...",
75-
"mcp_server_connected": "MCP-Server {{serverName}} verbunden",
76-
"mcp_server_deleted": "MCP-Server gelöscht: {{serverName}}",
77-
"mcp_server_not_found": "Server \"{{serverName}}\" nicht in der Konfiguration gefunden",
7867
"custom_storage_path_set": "Benutzerdefinierter Speicherpfad festgelegt: {{path}}",
7968
"default_storage_path": "Auf Standardspeicherpfad zurückgesetzt",
8069
"settings_imported": "Einstellungen erfolgreich importiert.",

src/i18n/locales/de/mcp.json

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
"errors": {
3+
"invalid_settings_format": "Ungültiges MCP-Einstellungen-JSON-Format. Bitte stelle sicher, dass deine Einstellungen dem korrekten JSON-Format entsprechen.",
4+
"invalid_settings_syntax": "Ungültiges MCP-Einstellungen-JSON-Format. Bitte überprüfe deine Einstellungsdatei auf Syntaxfehler.",
5+
"invalid_settings_validation": "Ungültiges MCP-Einstellungen-Format: {{errorMessages}}",
6+
"create_json": "Fehler beim Erstellen oder Öffnen von .roo/mcp.json: {{error}}",
7+
"failed_update_project": "Fehler beim Aktualisieren der Projekt-MCP-Server"
8+
},
9+
"info": {
10+
"server_restarting": "MCP-Server {{serverName}} wird neu gestartet...",
11+
"server_connected": "MCP-Server {{serverName}} verbunden",
12+
"server_deleted": "MCP-Server gelöscht: {{serverName}}",
13+
"server_not_found": "Server \"{{serverName}}\" nicht in der Konfiguration gefunden",
14+
"global_servers_active": "Aktive globale MCP-Server: {{mcpServers}}",
15+
"project_servers_active": "Aktive Projekt-MCP-Server: {{mcpServers}}",
16+
"already_refreshing": "MCP-Server werden bereits aktualisiert.",
17+
"refreshing_all": "Alle MCP-Server werden aktualisiert...",
18+
"all_refreshed": "Alle MCP-Server wurden aktualisiert.",
19+
"project_config_deleted": "Projekt-MCP-Konfigurationsdatei gelöscht. Alle Projekt-MCP-Server wurden getrennt."
20+
}
21+
}

src/i18n/locales/en/common.json

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,6 @@
2323
"this_and_subsequent": "This and all subsequent messages"
2424
},
2525
"errors": {
26-
"invalid_mcp_config": "Invalid project MCP configuration format",
27-
"invalid_mcp_settings_format": "Invalid MCP settings JSON format. Please ensure your settings follow the correct JSON format.",
28-
"invalid_mcp_settings_syntax": "Invalid MCP settings JSON format. Please check your settings file for syntax errors.",
29-
"invalid_mcp_settings_validation": "Invalid MCP settings format: {{errorMessages}}",
30-
"failed_initialize_project_mcp": "Failed to initialize project MCP server: {{error}}",
3126
"invalid_data_uri": "Invalid data URI format",
3227
"checkpoint_timeout": "Timed out when attempting to restore checkpoint.",
3328
"checkpoint_failed": "Failed to restore checkpoint.",
@@ -44,14 +39,12 @@
4439
"delete_api_config": "Failed to delete api configuration",
4540
"list_api_config": "Failed to get list api configuration",
4641
"update_server_timeout": "Failed to update server timeout",
47-
"create_mcp_json": "Failed to create or open .roo/mcp.json: {{error}}",
4842
"hmr_not_running": "Local development server is not running, HMR will not work. Please run 'npm run dev' before launching the extension to enable HMR.",
4943
"retrieve_current_mode": "Error: failed to retrieve current mode from state.",
5044
"failed_delete_repo": "Failed to delete associated shadow repository or branch: {{error}}",
5145
"failed_remove_directory": "Failed to remove task directory: {{error}}",
5246
"custom_storage_path_unusable": "Custom storage path \"{{path}}\" is unusable, will use default path",
5347
"cannot_access_path": "Cannot access path {{path}}: {{error}}",
54-
"failed_update_project_mcp": "Failed to update project MCP servers",
5548
"settings_import_failed": "Settings import failed: {{error}}.",
5649
"mistake_limit_guidance": "This may indicate a failure in the model's thought process or inability to use a tool properly, which can be mitigated with some user guidance (e.g. \"Try breaking down the task into smaller steps\").",
5750
"violated_organization_allowlist": "Failed to run task: the current profile violates your organization settings",
@@ -71,10 +64,6 @@
7164
"no_changes": "No changes found.",
7265
"clipboard_copy": "System prompt successfully copied to clipboard",
7366
"history_cleanup": "Cleaned up {{count}} task(s) with missing files from history.",
74-
"mcp_server_restarting": "Restarting {{serverName}} MCP server...",
75-
"mcp_server_connected": "{{serverName}} MCP server connected",
76-
"mcp_server_deleted": "Deleted MCP server: {{serverName}}",
77-
"mcp_server_not_found": "Server \"{{serverName}}\" not found in configuration",
7867
"custom_storage_path_set": "Custom storage path set: {{path}}",
7968
"default_storage_path": "Reverted to using default storage path",
8069
"settings_imported": "Settings imported successfully.",

src/i18n/locales/en/mcp.json

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
"errors": {
3+
"invalid_settings_format": "Invalid MCP settings JSON format. Please ensure your settings follow the correct JSON format.",
4+
"invalid_settings_syntax": "Invalid MCP settings JSON format. Please check your settings file for syntax errors.",
5+
"invalid_settings_validation": "Invalid MCP settings format: {{errorMessages}}",
6+
"create_json": "Failed to create or open .roo/mcp.json: {{error}}",
7+
"failed_update_project": "Failed to update project MCP servers"
8+
},
9+
"info": {
10+
"server_restarting": "Restarting {{serverName}} MCP server...",
11+
"server_connected": "{{serverName}} MCP server connected",
12+
"server_deleted": "Deleted MCP server: {{serverName}}",
13+
"server_not_found": "Server \"{{serverName}}\" not found in configuration",
14+
"global_servers_active": "Active Global MCP Servers: {{mcpServers}}",
15+
"project_servers_active": "Active Project MCP Servers: {{mcpServers}}",
16+
"already_refreshing": "MCP servers are already refreshing.",
17+
"refreshing_all": "Refreshing all MCP servers...",
18+
"all_refreshed": "All MCP servers have been refreshed.",
19+
"project_config_deleted": "Project MCP configuration file deleted. All project MCP servers have been disconnected."
20+
}
21+
}

src/i18n/locales/es/common.json

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,6 @@
2323
"this_and_subsequent": "Este y todos los mensajes posteriores"
2424
},
2525
"errors": {
26-
"invalid_mcp_config": "Formato de configuración MCP del proyecto no válido",
27-
"invalid_mcp_settings_format": "Formato JSON de la configuración MCP no válido. Asegúrate de que tus ajustes sigan el formato JSON correcto.",
28-
"invalid_mcp_settings_syntax": "Formato JSON de la configuración MCP no válido. Verifica si hay errores de sintaxis en tu archivo de configuración.",
29-
"invalid_mcp_settings_validation": "Formato de configuración MCP no válido: {{errorMessages}}",
30-
"failed_initialize_project_mcp": "Error al inicializar el servidor MCP del proyecto: {{error}}",
3126
"invalid_data_uri": "Formato de URI de datos no válido",
3227
"checkpoint_timeout": "Se agotó el tiempo al intentar restaurar el punto de control.",
3328
"checkpoint_failed": "Error al restaurar el punto de control.",
@@ -44,8 +39,6 @@
4439
"delete_api_config": "Error al eliminar la configuración de API",
4540
"list_api_config": "Error al obtener la lista de configuraciones de API",
4641
"update_server_timeout": "Error al actualizar el tiempo de espera del servidor",
47-
"failed_update_project_mcp": "Error al actualizar los servidores MCP del proyecto",
48-
"create_mcp_json": "Error al crear o abrir .roo/mcp.json: {{error}}",
4942
"hmr_not_running": "El servidor de desarrollo local no está en ejecución, HMR no funcionará. Por favor, ejecuta 'npm run dev' antes de lanzar la extensión para habilitar HMR.",
5043
"retrieve_current_mode": "Error al recuperar el modo actual del estado.",
5144
"failed_delete_repo": "Error al eliminar el repositorio o rama asociada: {{error}}",
@@ -71,10 +64,6 @@
7164
"no_changes": "No se encontraron cambios.",
7265
"clipboard_copy": "Mensaje del sistema copiado correctamente al portapapeles",
7366
"history_cleanup": "Se limpiaron {{count}} tarea(s) con archivos faltantes del historial.",
74-
"mcp_server_restarting": "Reiniciando el servidor MCP {{serverName}}...",
75-
"mcp_server_connected": "Servidor MCP {{serverName}} conectado",
76-
"mcp_server_deleted": "Servidor MCP eliminado: {{serverName}}",
77-
"mcp_server_not_found": "Servidor \"{{serverName}}\" no encontrado en la configuración",
7867
"custom_storage_path_set": "Ruta de almacenamiento personalizada establecida: {{path}}",
7968
"default_storage_path": "Se ha vuelto a usar la ruta de almacenamiento predeterminada",
8069
"settings_imported": "Configuración importada correctamente.",

src/i18n/locales/es/mcp.json

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
"errors": {
3+
"invalid_settings_format": "Formato JSON de la configuración MCP no válido. Asegúrate de que tus ajustes sigan el formato JSON correcto.",
4+
"invalid_settings_syntax": "Formato JSON de la configuración MCP no válido. Verifica si hay errores de sintaxis en tu archivo de configuración.",
5+
"invalid_settings_validation": "Formato de configuración MCP no válido: {{errorMessages}}",
6+
"create_json": "Error al crear o abrir .roo/mcp.json: {{error}}",
7+
"failed_update_project": "Error al actualizar los servidores MCP del proyecto"
8+
},
9+
"info": {
10+
"server_restarting": "Reiniciando el servidor MCP {{serverName}}...",
11+
"server_connected": "Servidor MCP {{serverName}} conectado",
12+
"server_deleted": "Servidor MCP eliminado: {{serverName}}",
13+
"server_not_found": "Servidor \"{{serverName}}\" no encontrado en la configuración",
14+
"global_servers_active": "Servidores MCP globales activos: {{mcpServers}}",
15+
"project_servers_active": "Servidores MCP del proyecto activos: {{mcpServers}}",
16+
"already_refreshing": "Los servidores MCP ya se están actualizando.",
17+
"refreshing_all": "Actualizando todos los servidores MCP...",
18+
"all_refreshed": "Todos los servidores MCP han sido actualizados.",
19+
"project_config_deleted": "Archivo de configuración MCP del proyecto eliminado. Todos los servidores MCP del proyecto han sido desconectados."
20+
}
21+
}

0 commit comments

Comments
 (0)