Support MCP extensions in open plugins (#9471)
Signed-off-by: Douwe M Osinga <douwe@sidewalklabs.com> Co-authored-by: Douwe M Osinga <douwe@sidewalklabs.com>
This commit is contained in:
@@ -1080,6 +1080,7 @@ fn configure_stdio_extension() -> anyhow::Result<()> {
|
||||
env_keys,
|
||||
description,
|
||||
timeout: Some(timeout),
|
||||
cwd: None,
|
||||
bundled: None,
|
||||
available_tools: Vec::new(),
|
||||
},
|
||||
|
||||
@@ -178,6 +178,7 @@ mod tests {
|
||||
envs: Envs::new(HashMap::new()),
|
||||
env_keys: vec!["SLACK_TOKEN".to_string()],
|
||||
timeout: None,
|
||||
cwd: None,
|
||||
description: "slack-mcp".to_string(),
|
||||
bundled: None,
|
||||
available_tools: Vec::new(),
|
||||
@@ -275,6 +276,7 @@ mod tests {
|
||||
envs: Envs::new(HashMap::new()),
|
||||
env_keys: vec!["API_KEY".to_string()], // Same original key, different extension
|
||||
timeout: None,
|
||||
cwd: None,
|
||||
description: "service-b".to_string(),
|
||||
bundled: None,
|
||||
available_tools: Vec::new(),
|
||||
|
||||
@@ -411,6 +411,7 @@ async fn collect_extension_configs(
|
||||
recipe: Option<&Recipe>,
|
||||
session_id: &str,
|
||||
) -> Result<Vec<ExtensionConfig>, ExtensionError> {
|
||||
let recipe_extensions = recipe.and_then(|r| r.extensions.as_deref());
|
||||
let configured_extensions: Vec<ExtensionConfig> = if session_config.resume {
|
||||
EnabledExtensionsState::for_session(
|
||||
&agent.config.session_manager,
|
||||
@@ -421,7 +422,7 @@ async fn collect_extension_configs(
|
||||
} else if session_config.no_profile {
|
||||
Vec::new()
|
||||
} else {
|
||||
resolve_extensions_for_new_session(recipe.and_then(|r| r.extensions.as_deref()), None)
|
||||
resolve_extensions_for_new_session(recipe_extensions, None)
|
||||
};
|
||||
|
||||
let cli_flag_extensions = parse_cli_flag_extensions(
|
||||
@@ -431,6 +432,12 @@ async fn collect_extension_configs(
|
||||
);
|
||||
|
||||
let mut all: Vec<ExtensionConfig> = configured_extensions;
|
||||
if !session_config.no_profile && !session_config.resume && recipe_extensions.is_none() {
|
||||
let project_root = std::env::current_dir().ok();
|
||||
all.extend(goose::plugins::mcp_servers::enabled_plugin_mcp_servers(
|
||||
project_root.as_deref(),
|
||||
));
|
||||
}
|
||||
all.extend(cli_flag_extensions.into_iter().map(|(_, cfg)| cfg));
|
||||
|
||||
Ok(all)
|
||||
|
||||
@@ -316,6 +316,7 @@ impl CliSession {
|
||||
env_keys: Vec::new(),
|
||||
description: goose::config::DEFAULT_EXTENSION_DESCRIPTION.to_string(),
|
||||
timeout: Some(goose::config::DEFAULT_EXTENSION_TIMEOUT),
|
||||
cwd: None,
|
||||
bundled: None,
|
||||
available_tools: Vec::new(),
|
||||
})
|
||||
@@ -2346,6 +2347,7 @@ mod tests {
|
||||
env_keys: vec![],
|
||||
description: goose::config::DEFAULT_EXTENSION_DESCRIPTION.to_string(),
|
||||
timeout: Some(goose::config::DEFAULT_EXTENSION_TIMEOUT),
|
||||
cwd: None,
|
||||
bundled: None,
|
||||
available_tools: vec![],
|
||||
}
|
||||
@@ -2361,6 +2363,7 @@ mod tests {
|
||||
env_keys: vec![],
|
||||
description: goose::config::DEFAULT_EXTENSION_DESCRIPTION.to_string(),
|
||||
timeout: Some(goose::config::DEFAULT_EXTENSION_TIMEOUT),
|
||||
cwd: None,
|
||||
bundled: None,
|
||||
available_tools: vec![],
|
||||
}
|
||||
@@ -2376,6 +2379,7 @@ mod tests {
|
||||
env_keys: vec![],
|
||||
description: goose::config::DEFAULT_EXTENSION_DESCRIPTION.to_string(),
|
||||
timeout: Some(goose::config::DEFAULT_EXTENSION_TIMEOUT),
|
||||
cwd: None,
|
||||
bundled: None,
|
||||
available_tools: vec![],
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user