(
&self,
url: String,
headers: Option<HashMap<String, String>>,
)
| 299 | Ok(()) |
| 300 | } |
| 301 | pub async fn connect_sse( |
| 302 | &self, |
| 303 | url: String, |
| 304 | headers: Option<HashMap<String, String>>, |
| 305 | ) -> Result<(), McpClientError> { |
| 306 | let result = self.connect_sse_inner(url, headers).await; |
| 307 | match &result { |
| 308 | Ok(()) => self.set_status(McpStatus::Connected).await, |
| 309 | Err(McpClientError::Unauthorized) => { |
| 310 | self.set_status(McpStatus::NeedsAuth).await; |
| 311 | } |
| 312 | Err(e) => { |
| 313 | let msg = e.to_string(); |
| 314 | if msg.contains("registration") || msg.contains("client_id") { |
| 315 | self.set_status(McpStatus::NeedsClientRegistration { error: msg }) |
| 316 | .await; |
| 317 | } else { |
| 318 | self.set_status(McpStatus::Failed { error: msg }).await; |
| 319 | } |
| 320 | } |
| 321 | } |
| 322 | result |
| 323 | } |
| 324 | |
| 325 | async fn connect_sse_inner( |
| 326 | &self, |
no test coverage detected