Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 34 additions & 3 deletions crates/goose-cli/src/commands/acp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@ use agent_client_protocol::{
ToolCallContent,
};
use anyhow::Result;
use goose::agents::{Agent, SessionConfig};
use goose::config::{get_all_extensions, Config};
use goose::agents::extension::Envs;
use goose::agents::{Agent, ExtensionConfig, SessionConfig};
use goose::config::{get_all_extensions, set_extension, Config, ExtensionEntry};
use goose::conversation::message::{Message, MessageContent};
use goose::conversation::Conversation;
use goose::mcp_utils::ToolResult;
Expand Down Expand Up @@ -608,9 +609,39 @@ impl acp::Agent for GooseAcpAgent {
) -> Result<acp::NewSessionResponse, acp::Error> {
info!("ACP: Received new session request {:?}", args);

for server in args.mcp_servers {
if let acp::McpServer::Stdio {
name,
command,
args,
env,
} = server
{
let envs = env
.into_iter()
.map(|e| (e.name, e.value))
.collect::<HashMap<_, _>>();

set_extension(ExtensionEntry {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I dont think we want to do this; this changes the global mcp setup and enables the mcp for all

enabled: true,
config: ExtensionConfig::Stdio {
name,
description: String::new(),
cmd: command.display().to_string(),
args,
envs: Envs::new(envs),
env_keys: Vec::new(),
timeout: None,
bundled: None,
available_tools: Vec::new(),
},
});
}
}

let goose_session = SessionManager::create_session(
std::env::current_dir().unwrap_or_default(),
"ACP Session".to_string(), // just an initial name - may be replaced by maybe_update_name
"ACP Session".to_string(),
SessionType::User,
)
.await?;
Expand Down
Loading