agent: Fix issue where unconfigured MCP extensions would not start server (#33365)
Release Notes: - agent: Fix an issue where MCP servers that were provided by extensions would sometimes not start up
This commit is contained in:
parent
108162423d
commit
1c6b4712a3
4 changed files with 13 additions and 9 deletions
|
@ -295,10 +295,7 @@ impl ConfigureContextServerModal {
|
||||||
ContextServerDescriptorRegistry::default_global(cx)
|
ContextServerDescriptorRegistry::default_global(cx)
|
||||||
.read(cx)
|
.read(cx)
|
||||||
.context_server_descriptor(&server_id.0)
|
.context_server_descriptor(&server_id.0)
|
||||||
.map(|_| ContextServerSettings::Extension {
|
.map(|_| ContextServerSettings::default_extension())
|
||||||
enabled: true,
|
|
||||||
settings: serde_json::json!({}),
|
|
||||||
})
|
|
||||||
})
|
})
|
||||||
else {
|
else {
|
||||||
return Task::ready(Err(anyhow::anyhow!("Context server not found")));
|
return Task::ready(Err(anyhow::anyhow!("Context server not found")));
|
||||||
|
|
|
@ -945,7 +945,10 @@ impl ExtensionImports for WasmState {
|
||||||
.get(key.as_str())
|
.get(key.as_str())
|
||||||
})
|
})
|
||||||
.cloned()
|
.cloned()
|
||||||
.context("Failed to get context server configuration")?;
|
.unwrap_or_else(|| {
|
||||||
|
project::project_settings::ContextServerSettings::default_extension(
|
||||||
|
)
|
||||||
|
});
|
||||||
|
|
||||||
match settings {
|
match settings {
|
||||||
project::project_settings::ContextServerSettings::Custom {
|
project::project_settings::ContextServerSettings::Custom {
|
||||||
|
|
|
@ -505,10 +505,7 @@ impl ContextServerStore {
|
||||||
{
|
{
|
||||||
configured_servers
|
configured_servers
|
||||||
.entry(id)
|
.entry(id)
|
||||||
.or_insert(ContextServerSettings::Extension {
|
.or_insert(ContextServerSettings::default_extension());
|
||||||
enabled: true,
|
|
||||||
settings: serde_json::json!({}),
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
let (enabled_servers, disabled_servers): (HashMap<_, _>, HashMap<_, _>) =
|
let (enabled_servers, disabled_servers): (HashMap<_, _>, HashMap<_, _>) =
|
||||||
|
|
|
@ -111,6 +111,13 @@ pub enum ContextServerSettings {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ContextServerSettings {
|
impl ContextServerSettings {
|
||||||
|
pub fn default_extension() -> Self {
|
||||||
|
Self::Extension {
|
||||||
|
enabled: true,
|
||||||
|
settings: serde_json::json!({}),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pub fn enabled(&self) -> bool {
|
pub fn enabled(&self) -> bool {
|
||||||
match self {
|
match self {
|
||||||
ContextServerSettings::Custom { enabled, .. } => *enabled,
|
ContextServerSettings::Custom { enabled, .. } => *enabled,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue