MCPcopy Create free account
hub / github.com/ChrisFeldmeier/OpenCodeRust / connect_http

Method connect_http

crates/opencode-mcp/src/client.rs:246–268  ·  view source on GitHub ↗
(
        &self,
        url: String,
        headers: Option<HashMap<String, String>>,
    )

Source from the content-addressed store, hash-verified

244 Ok(())
245 }
246 pub async fn connect_http(
247 &self,
248 url: String,
249 headers: Option<HashMap<String, String>>,
250 ) -> Result<(), McpClientError> {
251 let result = self.connect_http_inner(url, headers).await;
252 match &result {
253 Ok(()) => self.set_status(McpStatus::Connected).await,
254 Err(McpClientError::Unauthorized) => {
255 self.set_status(McpStatus::NeedsAuth).await;
256 }
257 Err(e) => {
258 let msg = e.to_string();
259 if msg.contains("registration") || msg.contains("client_id") {
260 self.set_status(McpStatus::NeedsClientRegistration { error: msg })
261 .await;
262 } else {
263 self.set_status(McpStatus::Failed { error: msg }).await;
264 }
265 }
266 }
267 result
268 }
269
270 async fn connect_http_inner(
271 &self,

Callers 2

httpMethod · 0.80
add_httpMethod · 0.80

Calls 3

connect_http_innerMethod · 0.80
containsMethod · 0.80
set_statusMethod · 0.45

Tested by

no test coverage detected