agent: Improve the UX around interacting with MCP servers (#32622)

Still a work in progress! Todos before merging:

- [x] Allow to delete (not just turn off) an MCP server from the panel's
settings view
- [x] Also uninstall the extension upon deleting the server (check if
the extension just provides MCPs)
- [x] Resolve repository URL again
- [x] Add a button to open the configuration modal from the panel's
settings view
- [x] Improve modal UX to install and configure a non-extension MCP

Release Notes:

- N/A

---------

Co-authored-by: Bennet Bo Fenner <bennetbo@gmx.de>
Co-authored-by: Ben Brandt <benjamin.j.brandt@gmail.com>
This commit is contained in:
Danilo Leal 2025-06-18 19:52:40 -03:00 committed by GitHub
parent 526faf287d
commit 804b91aa8c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
16 changed files with 926 additions and 728 deletions

View file

@ -1496,25 +1496,24 @@ fn replace_value_in_json_text(
if between_comma_and_key.trim().is_empty() {
removal_start = comma_pos;
}
} else {
// No preceding comma, check for trailing comma
if let Some(remaining_text) = text.get(existing_value_range.end..) {
let mut chars = remaining_text.char_indices();
while let Some((offset, ch)) = chars.next() {
if ch == ',' {
removal_end = existing_value_range.end + offset + 1;
// Also consume whitespace after the comma
while let Some((_, next_ch)) = chars.next() {
if next_ch.is_whitespace() {
removal_end += next_ch.len_utf8();
} else {
break;
}
}
if let Some(remaining_text) = text.get(existing_value_range.end..) {
let mut chars = remaining_text.char_indices();
while let Some((offset, ch)) = chars.next() {
if ch == ',' {
removal_end = existing_value_range.end + offset + 1;
// Also consume whitespace after the comma
while let Some((_, next_ch)) = chars.next() {
if next_ch.is_whitespace() {
removal_end += next_ch.len_utf8();
} else {
break;
}
break;
} else if !ch.is_whitespace() {
break;
}
break;
} else if !ch.is_whitespace() {
break;
}
}
}