diff --git a/bin/fxt/src/mcp/server.rs b/bin/fxt/src/mcp/server.rs index 23150a1d2..2d7eb10e1 100644 --- a/bin/fxt/src/mcp/server.rs +++ b/bin/fxt/src/mcp/server.rs @@ -1620,13 +1620,11 @@ mod tests { /// Tests only exercise protocol handling; actual gRPC calls will return /// transport errors which are surfaced as `isError` tool results. async fn make_server() -> McpServer { - // Ensure the token storage directory exists so FileTokenStorage::new() - // does not fail during tests. - let config_dir = dirs::config_dir() - .unwrap_or_else(|| std::path::PathBuf::from("/tmp")) - .join("foxhunt-tli") - .join("tokens"); - let _ = std::fs::create_dir_all(&config_dir); + // Point XDG_CONFIG_HOME to a writable temp dir so FileTokenStorage::new() + // works even on CI containers where $HOME may be unwritable (e.g. /root/ as uid 1000). + let tmp = std::env::temp_dir().join("fxt-test-config"); + std::fs::create_dir_all(&tmp).unwrap(); + std::env::set_var("XDG_CONFIG_HOME", &tmp); let client = FoxhuntClient::connect("http://localhost:9090") .await