diff --git a/crates/goose-acp/src/server.rs b/crates/goose-acp/src/server.rs index 47908231727c..197fcc929cea 100644 --- a/crates/goose-acp/src/server.rs +++ b/crates/goose-acp/src/server.rs @@ -1,7 +1,7 @@ use anyhow::Result; use fs_err as fs; use goose::agents::extension::{Envs, PLATFORM_EXTENSIONS}; -use goose::agents::{Agent, AgentConfig, ExtensionConfig, SessionConfig}; +use goose::agents::{Agent, AgentConfig, ExtensionConfig, GoosePlatform, SessionConfig}; use goose::builtin_extension::register_builtin_extensions; use goose::config::base::CONFIG_YAML_NAME; use goose::config::extensions::get_enabled_extensions_with_config; @@ -325,6 +325,7 @@ impl GooseAcpAgent { None, self.goose_mode, self.disable_session_naming, + GoosePlatform::GooseCli, )); let agent = Arc::new(agent); diff --git a/crates/goose-cli/src/scenario_tests/scenario_runner.rs b/crates/goose-cli/src/scenario_tests/scenario_runner.rs index 431626a4303c..e872c84bbd12 100644 --- a/crates/goose-cli/src/scenario_tests/scenario_runner.rs +++ b/crates/goose-cli/src/scenario_tests/scenario_runner.rs @@ -6,7 +6,7 @@ use crate::scenario_tests::mock_client::weather_client; use crate::scenario_tests::provider_configs::{get_provider_configs, ProviderConfig}; use crate::session::CliSession; use anyhow::Result; -use goose::agents::{Agent, AgentConfig}; +use goose::agents::{Agent, AgentConfig, GoosePlatform}; use goose::config::permission::PermissionManager; use goose::config::GooseMode; use goose::model::ModelConfig; @@ -214,6 +214,7 @@ where None, GooseMode::Auto, true, + GoosePlatform::GooseCli, ); let agent = Agent::with_config(agent_config); agent diff --git a/crates/goose/src/agents/agent.rs b/crates/goose/src/agents/agent.rs index 71fcb7931359..20023a0b30ff 100644 --- a/crates/goose/src/agents/agent.rs +++ b/crates/goose/src/agents/agent.rs @@ -1,4 +1,5 @@ use std::collections::HashMap; +use std::fmt; use std::future::Future; use std::pin::Pin; use std::sync::Arc; @@ -14,7 +15,9 @@ use super::platform_tools; use super::tool_execution::{ToolCallResult, CHAT_MODE_TOOL_SKIPPED_RESPONSE, DECLINED_RESPONSE}; use crate::action_required_manager::ActionRequiredManager; use crate::agents::extension::{ExtensionConfig, ExtensionResult, ToolInfo}; -use crate::agents::extension_manager::{get_parameter_names, ExtensionManager}; +use crate::agents::extension_manager::{ + get_parameter_names, ExtensionManager, ExtensionManagerCapabilities, +}; use crate::agents::final_output_tool::{FINAL_OUTPUT_CONTINUATION_MESSAGE, FINAL_OUTPUT_TOOL_NAME}; use crate::agents::platform_extensions::MANAGE_EXTENSIONS_TOOL_NAME_COMPLETE; use crate::agents::platform_tools::PLATFORM_MANAGE_SCHEDULE_TOOL_NAME; @@ -84,6 +87,21 @@ pub struct ExtensionLoadResult { pub error: Option, } +#[derive(Clone, Debug)] +pub enum GoosePlatform { + GooseDesktop, + GooseCli, +} + +impl fmt::Display for GoosePlatform { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + match self { + GoosePlatform::GooseCli => write!(f, "goose-cli"), + GoosePlatform::GooseDesktop => write!(f, "goose-desktop"), + } + } +} + #[derive(Clone)] pub struct AgentConfig { pub session_manager: Arc, @@ -91,6 +109,7 @@ pub struct AgentConfig { pub scheduler_service: Option>, pub goose_mode: GooseMode, pub disable_session_naming: bool, + pub goose_platform: GoosePlatform, } impl AgentConfig { @@ -100,6 +119,7 @@ impl AgentConfig { scheduler_service: Option>, goose_mode: GooseMode, disable_session_naming: bool, + goose_platform: GoosePlatform, ) -> Self { Self { session_manager, @@ -107,6 +127,7 @@ impl AgentConfig { scheduler_service, goose_mode, disable_session_naming, + goose_platform, } } } @@ -190,6 +211,7 @@ impl Agent { Config::global() .get_goose_disable_session_naming() .unwrap_or(false), + GoosePlatform::GooseCli, )) } @@ -199,12 +221,22 @@ impl Agent { let (tool_tx, tool_rx) = mpsc::channel(32); let provider = Arc::new(Mutex::new(None)); + let goose_platform = config.goose_platform.clone(); + let capabilities = match config.goose_platform { + GoosePlatform::GooseDesktop => ExtensionManagerCapabilities { mcpui: true }, + GoosePlatform::GooseCli => ExtensionManagerCapabilities { mcpui: false }, + }; let session_manager = Arc::clone(&config.session_manager); let permission_manager = Arc::clone(&config.permission_manager); Self { provider: provider.clone(), config, - extension_manager: Arc::new(ExtensionManager::new(provider.clone(), session_manager)), + extension_manager: Arc::new(ExtensionManager::new( + provider.clone(), + session_manager, + goose_platform.to_string(), + capabilities, + )), final_output_tool: Arc::new(Mutex::new(None)), frontend_tools: Mutex::new(HashMap::new()), frontend_instructions: Mutex::new(None), diff --git a/crates/goose/src/agents/extension_manager.rs b/crates/goose/src/agents/extension_manager.rs index 456bc9697e6d..57f5a784a48e 100644 --- a/crates/goose/src/agents/extension_manager.rs +++ b/crates/goose/src/agents/extension_manager.rs @@ -34,7 +34,7 @@ use super::tool_execution::ToolCallResult; use super::types::SharedProvider; use crate::agents::extension::{Envs, ProcessExit}; use crate::agents::extension_malware_check; -use crate::agents::mcp_client::{McpClient, McpClientTrait}; +use crate::agents::mcp_client::{GooseMcpClientCapabilities, McpClient, McpClientTrait}; use crate::builtin_extension::get_builtin_extension; use crate::config::extensions::name_to_key; use crate::config::search_path::SearchPaths; @@ -99,6 +99,10 @@ impl Extension { } } +pub struct ExtensionManagerCapabilities { + pub mcpui: bool, +} + /// Manages goose extensions / MCP clients and their interactions pub struct ExtensionManager { extensions: Mutex>, @@ -106,6 +110,8 @@ pub struct ExtensionManager { provider: SharedProvider, tools_cache: Mutex>>>, tools_cache_version: AtomicU64, + client_name: String, + capabilities: ExtensionManagerCapabilities, } /// A flattened representation of a resource used by the agent to prepare inference @@ -221,6 +227,8 @@ async fn child_process_client( provider: SharedProvider, working_dir: Option<&PathBuf>, docker_container: Option, + client_name: String, + capabilities: GooseMcpClientCapabilities, ) -> ExtensionResult { configure_subprocess(&mut command); @@ -258,6 +266,8 @@ async fn child_process_client( Duration::from_secs(timeout.unwrap_or(crate::config::DEFAULT_EXTENSION_TIMEOUT)), provider, docker_container, + client_name, + capabilities, ) .await; @@ -384,6 +394,8 @@ async fn create_streamable_http_client( headers: &HashMap, name: &str, provider: SharedProvider, + client_name: String, + capabilities: GooseMcpClientCapabilities, ) -> ExtensionResult> { let mut default_headers = HeaderMap::new(); @@ -415,7 +427,14 @@ async fn create_streamable_http_client( let timeout_duration = Duration::from_secs(timeout.unwrap_or(crate::config::DEFAULT_EXTENSION_TIMEOUT)); - let client_res = McpClient::connect(transport, timeout_duration, provider.clone()).await; + let client_res = McpClient::connect( + transport, + timeout_duration, + provider.clone(), + client_name.clone(), + capabilities.clone(), + ) + .await; if extract_auth_error(&client_res).is_some() { let auth_manager = oauth_flow(&uri.to_string(), &name.to_string()) @@ -438,7 +457,14 @@ async fn create_streamable_http_client( }, ); Ok(Box::new( - McpClient::connect(transport, timeout_duration, provider).await?, + McpClient::connect( + transport, + timeout_duration, + provider, + client_name, + capabilities, + ) + .await?, )) } else { Ok(Box::new(client_res?)) @@ -449,6 +475,8 @@ impl ExtensionManager { pub fn new( provider: SharedProvider, session_manager: Arc, + client_name: String, + capabilities: ExtensionManagerCapabilities, ) -> Self { Self { extensions: Mutex::new(HashMap::new()), @@ -459,13 +487,20 @@ impl ExtensionManager { provider, tools_cache: Mutex::new(None), tools_cache_version: AtomicU64::new(0), + client_name, + capabilities, } } #[cfg(test)] pub fn new_without_provider(data_dir: std::path::PathBuf) -> Self { let session_manager = Arc::new(crate::session::SessionManager::new(data_dir)); - Self::new(Arc::new(Mutex::new(None)), session_manager) + Self::new( + Arc::new(Mutex::new(None)), + session_manager, + "goose-cli".to_string(), + ExtensionManagerCapabilities { mcpui: false }, + ) } pub fn get_context(&self) -> &PlatformExtensionContext { @@ -527,12 +562,18 @@ impl ExtensionManager { .iter() .map(|(k, v)| (k.clone(), substitute_env_vars(v, &all_envs))) .collect(); + let capability = GooseMcpClientCapabilities { + mcpui: self.capabilities.mcpui, + }; + create_streamable_http_client( uri, *timeout, &resolved_headers, name, self.provider.clone(), + self.client_name.clone(), + capability, ) .await? } @@ -578,12 +619,17 @@ impl ExtensionManager { }) }; + let capabilities = GooseMcpClientCapabilities { + mcpui: self.capabilities.mcpui, + }; let client = child_process_client( command, timeout, self.provider.clone(), Some(&effective_working_dir), container.map(|c| c.id().to_string()), + self.client_name.clone(), + capabilities, ) .await?; Box::new(client) @@ -614,12 +660,17 @@ impl ExtensionManager { .arg(&normalized_name); }); + let capabilities = GooseMcpClientCapabilities { + mcpui: self.capabilities.mcpui, + }; let client = child_process_client( command, timeout, self.provider.clone(), Some(&effective_working_dir), Some(container_id.to_string()), + self.client_name.clone(), + capabilities, ) .await?; Box::new(client) @@ -627,11 +678,16 @@ impl ExtensionManager { let (server_read, client_write) = tokio::io::duplex(65536); let (client_read, server_write) = tokio::io::duplex(65536); extension_fn(server_read, server_write); + let capabilities = GooseMcpClientCapabilities { + mcpui: self.capabilities.mcpui, + }; Box::new( McpClient::connect( (client_read, client_write), timeout_duration, self.provider.clone(), + self.client_name.clone(), + capabilities, ) .await?, ) @@ -668,12 +724,18 @@ impl ExtensionManager { command.arg("python").arg(file_path.to_str().unwrap()); }); + let capabilities = GooseMcpClientCapabilities { + mcpui: self.capabilities.mcpui, + }; + let client = child_process_client( command, timeout, self.provider.clone(), Some(&effective_working_dir), container.map(|c| c.id().to_string()), + self.client_name.clone(), + capabilities, ) .await?; diff --git a/crates/goose/src/agents/mcp_client.rs b/crates/goose/src/agents/mcp_client.rs index 89c963da88c3..fb585c2b8bb4 100644 --- a/crates/goose/src/agents/mcp_client.rs +++ b/crates/goose/src/agents/mcp_client.rs @@ -33,6 +33,7 @@ use tokio::sync::{ Mutex, }; use tokio_util::sync::CancellationToken; + pub type BoxError = Box; pub type Error = rmcp::ServiceError; @@ -110,17 +111,23 @@ pub struct GooseClient { /// that don't include the session_id in their MCP extensions metadata. /// Set once on first request; never cleared (the id is invariant per McpClient). session_id: Mutex>, + client_name: String, + capabilities: GooseMcpClientCapabilities, } impl GooseClient { pub fn new( handlers: Arc>>>, provider: SharedProvider, + client_name: String, + capabilities: GooseMcpClientCapabilities, ) -> Self { GooseClient { notification_handlers: handlers, provider, session_id: Mutex::new(None), + client_name, + capabilities, } } @@ -320,19 +327,21 @@ impl ClientHandler for GooseClient { } fn get_info(&self) -> ClientInfo { - // Build MCP Apps UI extension capability - // See: https://github.com/modelcontextprotocol/ext-apps/blob/main/specification/2026-01-26/apps.mdx - let mut ui_extension_settings = JsonObject::new(); - ui_extension_settings.insert( - "mimeTypes".to_string(), - serde_json::json!(["text/html;profile=mcp-app"]), - ); - let mut extensions = ExtensionCapabilities::new(); - extensions.insert( - "io.modelcontextprotocol/ui".to_string(), - ui_extension_settings, - ); + + if self.capabilities.mcpui { + // Build MCP Apps UI extension capability + // See: https://github.com/modelcontextprotocol/ext-apps/blob/main/specification/2026-01-26/apps.mdx + let mut ui_extension_settings = JsonObject::new(); + ui_extension_settings.insert( + "mimeTypes".to_string(), + serde_json::json!(["text/html;profile=mcp-app"]), + ); + extensions.insert( + "io.modelcontextprotocol/ui".to_string(), + ui_extension_settings, + ); + } ClientInfo { meta: None, @@ -343,7 +352,7 @@ impl ClientHandler for GooseClient { .enable_elicitation() .build(), client_info: Implementation { - name: "goose".to_string(), + name: self.client_name.clone(), version: std::env::var("GOOSE_MCP_CLIENT_VERSION") .unwrap_or(env!("CARGO_PKG_VERSION").to_owned()), icons: None, @@ -355,6 +364,11 @@ impl ClientHandler for GooseClient { } } +#[derive(Debug, Clone)] +pub struct GooseMcpClientCapabilities { + pub mcpui: bool, +} + /// The MCP client is the interface for MCP operations. pub struct McpClient { client: Mutex>, @@ -369,12 +383,22 @@ impl McpClient { transport: T, timeout: std::time::Duration, provider: SharedProvider, + client_name: String, + capabilities: GooseMcpClientCapabilities, ) -> Result where T: IntoTransport, E: std::error::Error + From + Send + Sync + 'static, { - Self::connect_with_container(transport, timeout, provider, None).await + Self::connect_with_container( + transport, + timeout, + provider, + None, + client_name, + capabilities, + ) + .await } pub async fn connect_with_container( @@ -382,6 +406,8 @@ impl McpClient { timeout: std::time::Duration, provider: SharedProvider, docker_container: Option, + client_name: String, + capabilities: GooseMcpClientCapabilities, ) -> Result where T: IntoTransport, @@ -390,7 +416,12 @@ impl McpClient { let notification_subscribers = Arc::new(Mutex::new(Vec::>::new())); - let client = GooseClient::new(notification_subscribers.clone(), provider); + let client = GooseClient::new( + notification_subscribers.clone(), + provider, + client_name.clone(), + capabilities.clone(), + ); let client: rmcp::service::RunningService = client.serve(transport).await?; let server_info = client.peer_info().cloned(); @@ -728,11 +759,22 @@ fn inject_session_context_into_request( #[cfg(test)] mod tests { use super::*; + use crate::agents::GoosePlatform; use serde_json::json; use test_case::test_case; - fn new_client() -> GooseClient { - GooseClient::new(Arc::new(Mutex::new(Vec::new())), Arc::new(Mutex::new(None))) + fn new_client(platform: GoosePlatform) -> GooseClient { + let capabilities = match platform { + GoosePlatform::GooseDesktop => GooseMcpClientCapabilities { mcpui: true }, + GoosePlatform::GooseCli => GooseMcpClientCapabilities { mcpui: false }, + }; + + GooseClient::new( + Arc::new(Mutex::new(Vec::new())), + Arc::new(Mutex::new(None)), + platform.to_string(), + capabilities, + ) } fn request_extensions(request: &ClientRequest) -> Option<&Extensions> { @@ -841,7 +883,7 @@ mod tests { ) { let runtime = tokio::runtime::Runtime::new().unwrap(); runtime.block_on(async { - let client = new_client(); + let client = new_client(GoosePlatform::GooseCli); if let Some(session_id) = current_session { client.set_session_id(session_id).await; } @@ -954,7 +996,7 @@ mod tests { #[test] fn test_client_info_advertises_mcp_apps_ui_extension() { - let client = new_client(); + let client = new_client(GoosePlatform::GooseDesktop); let info = ClientHandler::get_info(&client); // Verify the client advertises the MCP Apps UI extension capability diff --git a/crates/goose/src/agents/mod.rs b/crates/goose/src/agents/mod.rs index 268bfe29031f..588f70e3e398 100644 --- a/crates/goose/src/agents/mod.rs +++ b/crates/goose/src/agents/mod.rs @@ -21,7 +21,7 @@ pub(crate) mod subagent_task_config; mod tool_execution; pub mod types; -pub use agent::{Agent, AgentConfig, AgentEvent, ExtensionLoadResult}; +pub use agent::{Agent, AgentConfig, AgentEvent, ExtensionLoadResult, GoosePlatform}; pub use container::Container; pub use execute_commands::COMPACT_TRIGGERS; pub use extension::{ExtensionConfig, ExtensionError}; diff --git a/crates/goose/src/agents/platform_extensions/summon.rs b/crates/goose/src/agents/platform_extensions/summon.rs index 05b207b59329..fcde00beeba0 100644 --- a/crates/goose/src/agents/platform_extensions/summon.rs +++ b/crates/goose/src/agents/platform_extensions/summon.rs @@ -1039,6 +1039,7 @@ impl SummonClient { None, crate::config::GooseMode::Auto, true, // disable session naming for subagents + crate::agents::GoosePlatform::GooseCli, ); let subagent_session = self @@ -1470,6 +1471,7 @@ impl SummonClient { None, crate::config::GooseMode::Auto, true, // disable session naming for subagents + crate::agents::GoosePlatform::GooseCli, ); let subagent_session = self diff --git a/crates/goose/src/execution/manager.rs b/crates/goose/src/execution/manager.rs index 7043d257db38..6de1aece8175 100644 --- a/crates/goose/src/execution/manager.rs +++ b/crates/goose/src/execution/manager.rs @@ -1,4 +1,4 @@ -use crate::agents::{Agent, AgentConfig}; +use crate::agents::{Agent, AgentConfig, GoosePlatform}; use crate::config::paths::Paths; use crate::config::permission::PermissionManager; use crate::config::{Config, GooseMode}; @@ -92,6 +92,7 @@ impl AgentManager { Config::global() .get_goose_disable_session_naming() .unwrap_or(false), + GoosePlatform::GooseDesktop, ); let agent = Arc::new(Agent::with_config(config)); if let Some(provider) = &*self.default_provider.read().await { diff --git a/crates/goose/tests/agent.rs b/crates/goose/tests/agent.rs index a6817a3cc5e4..26f82f548bf0 100644 --- a/crates/goose/tests/agent.rs +++ b/crates/goose/tests/agent.rs @@ -2,7 +2,7 @@ use std::sync::Arc; use anyhow::Result; use futures::StreamExt; -use goose::agents::{Agent, AgentEvent}; +use goose::agents::{Agent, AgentEvent, GoosePlatform}; use goose::config::extensions::{set_extension, ExtensionEntry}; #[cfg(test)] @@ -129,6 +129,7 @@ mod tests { Some(mock_scheduler), GooseMode::Auto, false, + GoosePlatform::GooseCli, ); let agent = Agent::with_config(config); @@ -170,6 +171,7 @@ mod tests { Some(mock_scheduler), GooseMode::Auto, false, + GoosePlatform::GooseCli, ); let agent = Agent::with_config(config); @@ -224,6 +226,7 @@ mod tests { Some(mock_scheduler), GooseMode::Auto, false, + GoosePlatform::GooseCli, ); let agent = Agent::with_config(config); @@ -546,6 +549,7 @@ mod tests { None, GooseMode::Auto, false, + GoosePlatform::GooseCli, ); let agent = Agent::with_config(config); diff --git a/crates/goose/tests/mcp_integration_test.rs b/crates/goose/tests/mcp_integration_test.rs index b5343b6d818a..0281ce528d6d 100644 --- a/crates/goose/tests/mcp_integration_test.rs +++ b/crates/goose/tests/mcp_integration_test.rs @@ -11,7 +11,8 @@ use rmcp::object; use tokio_util::sync::CancellationToken; use goose::agents::extension::{Envs, ExtensionConfig}; -use goose::agents::extension_manager::ExtensionManager; +use goose::agents::extension_manager::{ExtensionManager, ExtensionManagerCapabilities}; +use goose::agents::GoosePlatform; use goose::model::ModelConfig; use test_case::test_case; @@ -254,7 +255,12 @@ async fn test_replayed_session( let session_manager = Arc::new(goose::session::SessionManager::new( temp_dir.path().to_path_buf(), )); - let extension_manager = Arc::new(ExtensionManager::new(provider, session_manager)); + let extension_manager = Arc::new(ExtensionManager::new( + provider, + session_manager, + GoosePlatform::GooseDesktop.to_string(), + ExtensionManagerCapabilities { mcpui: true }, + )); #[allow(clippy::redundant_closure_call)] let result = (async || -> Result<(), Box> { diff --git a/crates/goose/tests/mcp_replays/github-mcp-serverstdio b/crates/goose/tests/mcp_replays/github-mcp-serverstdio index de8866fe8c29..475cd405ba00 100644 --- a/crates/goose/tests/mcp_replays/github-mcp-serverstdio +++ b/crates/goose/tests/mcp_replays/github-mcp-serverstdio @@ -1,4 +1,4 @@ -STDIN: {"jsonrpc":"2.0","id":0,"method":"initialize","params":{"protocolVersion":"2025-03-26","capabilities":{"elicitation":{},"extensions":{"io.modelcontextprotocol/ui":{"mimeTypes":["text/html;profile=mcp-app"]}},"sampling":{}},"clientInfo":{"name":"goose","version":"0.0.0"}}} +STDIN: {"jsonrpc":"2.0","id":0,"method":"initialize","params":{"protocolVersion":"2025-03-26","capabilities":{"elicitation":{},"extensions":{"io.modelcontextprotocol/ui":{"mimeTypes":["text/html;profile=mcp-app"]}},"sampling":{}},"clientInfo":{"name":"goose-desktop","version":"0.0.0"}}} STDERR: time=2025-12-11T17:58:47.636-05:00 level=INFO msg="starting server" version=0.24.1 host="" dynamicToolsets=false readOnly=false lockdownEnabled=false STDERR: GitHub MCP Server running on stdio STDERR: time=2025-12-11T17:58:47.640-05:00 level=INFO msg="server run start" diff --git a/crates/goose/tests/mcp_replays/npx-y@modelcontextprotocol_server-everything@2026.1.14 b/crates/goose/tests/mcp_replays/npx-y@modelcontextprotocol_server-everything@2026.1.14 index b5602b4b1ffb..0624c4ebed97 100644 --- a/crates/goose/tests/mcp_replays/npx-y@modelcontextprotocol_server-everything@2026.1.14 +++ b/crates/goose/tests/mcp_replays/npx-y@modelcontextprotocol_server-everything@2026.1.14 @@ -1,4 +1,4 @@ -STDIN: {"jsonrpc":"2.0","id":0,"method":"initialize","params":{"protocolVersion":"2025-03-26","capabilities":{"elicitation":{},"extensions":{"io.modelcontextprotocol/ui":{"mimeTypes":["text/html;profile=mcp-app"]}},"sampling":{}},"clientInfo":{"name":"goose","version":"0.0.0"}}} +STDIN: {"jsonrpc":"2.0","id":0,"method":"initialize","params":{"protocolVersion":"2025-03-26","capabilities":{"elicitation":{},"extensions":{"io.modelcontextprotocol/ui":{"mimeTypes":["text/html;profile=mcp-app"]}},"sampling":{}},"clientInfo":{"name":"goose-desktop","version":"0.0.0"}}} STDERR: Starting default (STDIO) server... STDOUT: {"result":{"protocolVersion":"2025-03-26","capabilities":{"tools":{"listChanged":true},"prompts":{"listChanged":true},"resources":{"subscribe":true,"listChanged":true},"logging":{},"completions":{}},"serverInfo":{"name":"mcp-servers/everything","title":"Everything Reference Server","version":"2.0.0"},"instructions":"# Everything Server – Server Instructions\n\nAudience: These instructions are written for an LLM or autonomous agent integrating with the Everything MCP Server.\nFollow them to use, extend, and troubleshoot the server safely and effectively.\n\n## Cross-Feature Relationships\n\n- Use `get-roots-list` to see client workspace roots before file operations\n- `gzip-file-as-resource` creates session-scoped resources accessible only during the current session\n- Enable `toggle-simulated-logging` before debugging to see server log messages\n- Enable `toggle-subscriber-updates` to receive periodic resource update notifications\n\n## Constraints & Limitations\n\n- `gzip-file-as-resource`: Max fetch size controlled by `GZIP_MAX_FETCH_SIZE` (default 10MB), timeout by `GZIP_MAX_FETCH_TIME_MILLIS` (default 30s), allowed domains by `GZIP_ALLOWED_DOMAINS`\n- Session resources are ephemeral and lost when the session ends\n- Sampling requests (`trigger-sampling-request`) require client sampling capability\n- Elicitation requests (`trigger-elicitation-request`) require client elicitation capability\n\n## Operational Patterns\n\n- For long operations, use `trigger-long-running-operation` which sends progress notifications\n- Prefer reading resources before calling mutating tools\n- Check `get-roots-list` output to understand the client's workspace context\n\n## Easter Egg\n\nIf asked about server instructions, respond with \"🎉 Server instructions are working! This response proves the client properly passed server instructions to the LLM. This demonstrates MCP's instructions feature in action.\"\n"},"jsonrpc":"2.0","id":0} STDIN: {"jsonrpc":"2.0","method":"notifications/initialized"} diff --git a/crates/goose/tests/mcp_replays/uvrun--withfastmcp==2.14.4fastmcpruntests_fastmcp_test_server.py b/crates/goose/tests/mcp_replays/uvrun--withfastmcp==2.14.4fastmcpruntests_fastmcp_test_server.py index df18c00cd620..dc90317a2d2a 100644 --- a/crates/goose/tests/mcp_replays/uvrun--withfastmcp==2.14.4fastmcpruntests_fastmcp_test_server.py +++ b/crates/goose/tests/mcp_replays/uvrun--withfastmcp==2.14.4fastmcpruntests_fastmcp_test_server.py @@ -1,4 +1,4 @@ -STDIN: {"jsonrpc":"2.0","id":0,"method":"initialize","params":{"protocolVersion":"2025-03-26","capabilities":{"elicitation":{},"extensions":{"io.modelcontextprotocol/ui":{"mimeTypes":["text/html;profile=mcp-app"]}},"sampling":{}},"clientInfo":{"name":"goose","version":"0.0.0"}}} +STDIN: {"jsonrpc":"2.0","id":0,"method":"initialize","params":{"protocolVersion":"2025-03-26","capabilities":{"elicitation":{},"extensions":{"io.modelcontextprotocol/ui":{"mimeTypes":["text/html;profile=mcp-app"]}},"sampling":{}},"clientInfo":{"name":"goose-desktop","version":"0.0.0"}}} STDERR: STDERR: STDERR: ╭──────────────────────────────────────────────────────────────────────────────╮ diff --git a/crates/goose/tests/mcp_replays/uvxmcp-server-fetch b/crates/goose/tests/mcp_replays/uvxmcp-server-fetch index 25501df9d57f..17aef79d95f6 100644 --- a/crates/goose/tests/mcp_replays/uvxmcp-server-fetch +++ b/crates/goose/tests/mcp_replays/uvxmcp-server-fetch @@ -1,4 +1,4 @@ -STDIN: {"jsonrpc":"2.0","id":0,"method":"initialize","params":{"protocolVersion":"2025-03-26","capabilities":{"elicitation":{},"extensions":{"io.modelcontextprotocol/ui":{"mimeTypes":["text/html;profile=mcp-app"]}},"sampling":{}},"clientInfo":{"name":"goose","version":"0.0.0"}}} +STDIN: {"jsonrpc":"2.0","id":0,"method":"initialize","params":{"protocolVersion":"2025-03-26","capabilities":{"elicitation":{},"extensions":{"io.modelcontextprotocol/ui":{"mimeTypes":["text/html;profile=mcp-app"]}},"sampling":{}},"clientInfo":{"name":"goose-desktop","version":"0.0.0"}}} STDOUT: {"jsonrpc":"2.0","id":0,"result":{"protocolVersion":"2025-03-26","capabilities":{"experimental":{},"prompts":{"listChanged":false},"tools":{"listChanged":false}},"serverInfo":{"name":"mcp-fetch","version":"1.25.0"}}} STDIN: {"jsonrpc":"2.0","method":"notifications/initialized"} STDIN: {"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"_meta":{"agent-session-id":"test-session-id","progressToken":0},"name":"fetch","arguments":{"url":"https://example.com"}}} diff --git a/crates/goose/tests/providers.rs b/crates/goose/tests/providers.rs index 68e81de4bccc..ba4cbe473619 100644 --- a/crates/goose/tests/providers.rs +++ b/crates/goose/tests/providers.rs @@ -1,6 +1,7 @@ use anyhow::Result; use dotenvy::dotenv; -use goose::agents::{ExtensionManager, PromptManager}; +use goose::agents::extension_manager::ExtensionManagerCapabilities; +use goose::agents::{ExtensionManager, GoosePlatform, PromptManager}; use goose::config::ExtensionConfig; use goose::conversation::message::{Message, MessageContent}; use goose::providers::anthropic::ANTHROPIC_DEFAULT_MODEL; @@ -474,7 +475,12 @@ async fn test_provider( let temp_dir = tempfile::tempdir()?; let shared_provider = Arc::new(tokio::sync::Mutex::new(Some(provider.clone()))); let session_manager = Arc::new(SessionManager::new(temp_dir.path().to_path_buf())); - let extension_manager = Arc::new(ExtensionManager::new(shared_provider, session_manager)); + let extension_manager = Arc::new(ExtensionManager::new( + shared_provider, + session_manager, + GoosePlatform::GooseCli.to_string(), + ExtensionManagerCapabilities { mcpui: false }, + )); extension_manager .add_extension(mcp_extension, None, None, None) .await