1use serde::{Deserialize, Serialize};
2
3#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
4pub enum McpServerStatus {
5 Connected { tool_count: usize },
6 Failed { error: String },
7 NeedsOAuth,
8}
9
10#[derive(Debug, Clone, Copy, Serialize, Deserialize, PartialEq, Eq, Default)]
11pub enum McpServerAuthCapability {
12 #[default]
13 Unavailable,
14 OAuth,
15}
16
17#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
18pub struct McpServerStatusEntry {
19 pub name: String,
20 pub status: McpServerStatus,
21 pub auth_capability: McpServerAuthCapability,
22}
23
24impl McpServerStatusEntry {
25 pub fn new(name: impl Into<String>, status: McpServerStatus) -> Self {
26 Self { name: name.into(), status, auth_capability: McpServerAuthCapability::Unavailable }
27 }
28
29 pub fn with_auth_capability(mut self, auth: McpServerAuthCapability) -> Self {
30 self.auth_capability = auth;
31 self
32 }
33
34 pub fn can_authenticate(&self) -> bool {
35 self.auth_capability == McpServerAuthCapability::OAuth
36 }
37}