Some checks failed
CI / Format (push) Successful in 3s
CI / Clippy (push) Successful in 4m3s
CI / Security Audit (push) Successful in 1m38s
CI / Tests (push) Successful in 4m44s
CI / Detect Changes (push) Successful in 2s
CI / Deploy Agent (push) Successful in 2s
CI / Deploy Dashboard (push) Successful in 2s
CI / Deploy Docs (push) Has been skipped
CI / Deploy MCP (push) Failing after 2s
70 lines
2.1 KiB
Rust
70 lines
2.1 KiB
Rust
use chrono::{DateTime, Utc};
|
|
use serde::{Deserialize, Serialize};
|
|
|
|
/// Transport mode for MCP server
|
|
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
|
|
#[serde(rename_all = "snake_case")]
|
|
pub enum McpTransport {
|
|
Stdio,
|
|
Http,
|
|
}
|
|
|
|
impl std::fmt::Display for McpTransport {
|
|
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
|
match self {
|
|
Self::Stdio => write!(f, "stdio"),
|
|
Self::Http => write!(f, "http"),
|
|
}
|
|
}
|
|
}
|
|
|
|
/// Status of a running MCP server
|
|
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
|
|
#[serde(rename_all = "snake_case")]
|
|
pub enum McpServerStatus {
|
|
Running,
|
|
Stopped,
|
|
Error,
|
|
}
|
|
|
|
impl std::fmt::Display for McpServerStatus {
|
|
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
|
match self {
|
|
Self::Running => write!(f, "running"),
|
|
Self::Stopped => write!(f, "stopped"),
|
|
Self::Error => write!(f, "error"),
|
|
}
|
|
}
|
|
}
|
|
|
|
/// Configuration for a registered MCP server instance
|
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
|
pub struct McpServerConfig {
|
|
#[serde(rename = "_id", skip_serializing_if = "Option::is_none")]
|
|
pub id: Option<bson::oid::ObjectId>,
|
|
/// Display name for this MCP server
|
|
pub name: String,
|
|
/// Endpoint URL (e.g. https://mcp.example.com/mcp)
|
|
pub endpoint_url: String,
|
|
/// Transport type
|
|
pub transport: McpTransport,
|
|
/// Port number (for HTTP transport)
|
|
pub port: Option<u16>,
|
|
/// Current status
|
|
pub status: McpServerStatus,
|
|
/// Bearer access token for authentication
|
|
pub access_token: String,
|
|
/// Which tools are enabled on this server
|
|
pub tools_enabled: Vec<String>,
|
|
/// Optional description / notes
|
|
pub description: Option<String>,
|
|
/// MongoDB URI this server connects to
|
|
pub mongodb_uri: Option<String>,
|
|
/// Database name
|
|
pub mongodb_database: Option<String>,
|
|
#[serde(with = "super::serde_helpers::bson_datetime")]
|
|
pub created_at: DateTime<Utc>,
|
|
#[serde(with = "super::serde_helpers::bson_datetime")]
|
|
pub updated_at: DateTime<Utc>,
|
|
}
|