pub struct McpServer {
pub id: Uuid,
pub name: String,
pub info: ServerInfo,
pub capabilities: ServerCapabilities,
/* private fields */
}Expand description
Concrete MCP server implementation
Fields§
§id: UuidServer ID
name: StringServer name
info: ServerInfoServer information
capabilities: ServerCapabilitiesServer capabilities
Implementations§
Source§impl McpServer
impl McpServer
Sourcepub fn new(
name: impl Into<String>,
info: ServerInfo,
capabilities: ServerCapabilities,
transport: Arc<dyn Transport>,
) -> Self
pub fn new( name: impl Into<String>, info: ServerInfo, capabilities: ServerCapabilities, transport: Arc<dyn Transport>, ) -> Self
Create a new MCP server
Sourcepub async fn set_status(&self, status: ServerStatus)
pub async fn set_status(&self, status: ServerStatus)
Update server status
Sourcepub async fn record_success(&self, response_time_ms: f64)
pub async fn record_success(&self, response_time_ms: f64)
Record a successful request
Sourcepub async fn record_error(&self)
pub async fn record_error(&self)
Record an error
Sourcepub fn uptime_secs(&self) -> u64
pub fn uptime_secs(&self) -> u64
Get uptime in seconds
Trait Implementations§
Source§impl McpServerTrait for McpServer
impl McpServerTrait for McpServer
Source§fn server_info<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = ServerInfo> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn server_info<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = ServerInfo> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Get server information
Source§fn capabilities<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = ServerCapabilities> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn capabilities<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = ServerCapabilities> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Get server capabilities
Source§fn initialize<'life0, 'async_trait>(
&'life0 mut self,
params: Value,
) -> Pin<Box<dyn Future<Output = Result<Value>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn initialize<'life0, 'async_trait>(
&'life0 mut self,
params: Value,
) -> Pin<Box<dyn Future<Output = Result<Value>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Initialize the server
Source§fn shutdown<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn shutdown<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Shutdown the server
Source§fn send_request<'life0, 'async_trait>(
&'life0 self,
request: McpRequest,
) -> Pin<Box<dyn Future<Output = Result<McpResponse>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn send_request<'life0, 'async_trait>(
&'life0 self,
request: McpRequest,
) -> Pin<Box<dyn Future<Output = Result<McpResponse>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Send a request to the server
Source§fn send_notification<'life0, 'async_trait>(
&'life0 self,
notification: McpNotification,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn send_notification<'life0, 'async_trait>(
&'life0 self,
notification: McpNotification,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Send a notification to the server (no response expected)
Source§fn status<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = ServerStatus> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn status<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = ServerStatus> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Get current server status
Source§fn metrics<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = ServerMetrics> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn metrics<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = ServerMetrics> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Get server metrics
Source§fn health_check<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn health_check<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Perform a health check
Source§fn list_tools<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Vec<Tool>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn list_tools<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Vec<Tool>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
List available tools
Auto Trait Implementations§
impl Freeze for McpServer
impl !RefUnwindSafe for McpServer
impl Send for McpServer
impl Sync for McpServer
impl Unpin for McpServer
impl !UnwindSafe for McpServer
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more