UltraFastServer

Struct UltraFastServer 

Source
pub struct UltraFastServer { /* private fields */ }
Expand description

MCP Server implementation

Implementations§

Source§

impl UltraFastServer

Source

pub fn new(info: ServerInfo, capabilities: ServerCapabilities) -> Self

Create a new UltraFastServer with the given info and capabilities

Source

pub async fn set_logging_config(&self, config: ServerLoggingConfig)

Configure server logging

Source

pub async fn get_logging_config(&self) -> ServerLoggingConfig

Get current server logging configuration

Source

pub fn with_timeout_config(self, config: TimeoutConfig) -> Self

Set timeout configuration

Source

pub fn get_timeout_config(&self) -> TimeoutConfig

Get current timeout configuration

Source

pub fn with_high_performance_timeouts(self) -> Self

Set timeout configuration for high-performance scenarios

Source

pub fn with_long_running_timeouts(self) -> Self

Set timeout configuration for long-running operations

Source

pub fn get_operation_timeout(&self, operation: &str) -> Duration

Get timeout for a specific operation

Source

pub fn validate_timeout_config(&self) -> Result<(), String>

Validate timeout configuration

Source

pub async fn set_log_level(&self, level: LogLevel) -> MCPResult<()>

Set the current log level

Source

pub async fn get_log_level(&self) -> LogLevel

Get the current log level

Source

pub fn with_monitoring_config(self, config: MonitoringConfig) -> Self

Enable monitoring with custom configuration

Source

pub fn with_monitoring(self) -> Self

Enable monitoring with default configuration

Source

pub fn with_health_checks(self) -> Self

Enable health checks with default configuration

Source

pub fn with_metrics(self) -> Self

Enable metrics collection with default configuration

Source

pub fn with_tracing(self) -> Self

Enable tracing with default configuration

Source

pub fn with_full_monitoring(self) -> Self

Enable all monitoring features (health checks, metrics, tracing)

Source

pub fn with_middleware(self) -> Self

Enable middleware support

Source

pub fn with_recovery(self) -> Self

Enable recovery mechanisms

Source

pub fn with_oauth(self) -> Self

Enable OAuth authentication

Source

pub fn with_authentication( self, _token_validator: (), _required_scopes: Vec<String>, ) -> Self

Enable authentication with custom configuration (feature removed)

Source

pub fn with_bearer_auth( self, _secret: String, _required_scopes: Vec<String>, ) -> Self

Enable Bearer token authentication (feature removed)

Source

pub fn with_api_key_auth(self) -> Self

Enable API key authentication

Source

pub fn with_basic_auth(self) -> Self

Enable Basic authentication

Source

pub fn with_rate_limiting(self, requests_per_minute: u32) -> Self

Enable rate limiting

Source

pub fn with_request_validation(self) -> Self

Enable request validation

Source

pub fn with_response_caching(self) -> Self

Enable response caching

Source

pub fn monitoring(&self) -> Option<Arc<MonitoringSystem>>

Get the monitoring system if available

Source

pub async fn create_context(&self) -> Context

Create a context with the current server logging configuration

Source

pub async fn create_context_with_ids( &self, request_id: String, session_id: Option<String>, ) -> Context

Create a context with custom request and session IDs

Source

pub async fn register_tool( &self, tool: Tool, ) -> Result<(), ToolRegistrationError>

Register a tool with validation

Source

pub async fn register_tools( &self, tools: Vec<Tool>, ) -> Result<(), ToolRegistrationError>

Register multiple tools

Source

pub async fn unregister_tool(&self, name: &str) -> bool

Unregister a tool by name

Source

pub async fn get_tool(&self, name: &str) -> Option<Tool>

Get a tool by name

Source

pub async fn list_tools(&self) -> Vec<Tool>

List all registered tools

Source

pub async fn has_tool(&self, name: &str) -> bool

Check if a tool exists

Source

pub async fn tool_count(&self) -> usize

Get tool count

Source

pub async fn clear_tools(&self)

Clear all tools

Source

pub async fn validate_tool_call( &self, tool_name: &str, arguments: &Value, ) -> Result<(), MCPError>

Validate tool call arguments against tool schema

Source

pub async fn execute_tool_call( &self, tool_name: &str, arguments: Value, ) -> Result<ToolResult, MCPError>

Execute a tool call with validation

Source

pub fn with_tool_handler(self, handler: Arc<dyn ToolHandler>) -> Self

Add a tool handler to the server

Source

pub fn with_resource_handler(self, handler: Arc<dyn ResourceHandler>) -> Self

Add a resource handler to the server

Source

pub fn with_prompt_handler(self, handler: Arc<dyn PromptHandler>) -> Self

Add a prompt handler to the server

Source

pub fn with_sampling_handler(self, handler: Arc<dyn SamplingHandler>) -> Self

Add a sampling handler to the server

Source

pub fn with_completion_handler( self, handler: Arc<dyn CompletionHandler>, ) -> Self

Add a completion handler to the server

Source

pub fn with_roots_handler(self, handler: Arc<dyn RootsHandler>) -> Self

Add a roots handler to the server

Source

pub fn with_elicitation_handler( self, handler: Arc<dyn ElicitationHandler>, ) -> Self

Add an elicitation handler to the server

Source

pub fn with_subscription_handler( self, handler: Arc<dyn ResourceSubscriptionHandler>, ) -> Self

Add a subscription handler to the server

Source

pub fn with_logging_config(self, config: ServerLoggingConfig) -> Self

Configure logging with a custom configuration

Source

pub async fn run_stdio(&self) -> MCPResult<()>

Run the server with stdio transport

Source

pub async fn run_with_transport( &self, transport: Box<dyn Transport>, ) -> MCPResult<()>

Run the server with a custom transport

Source

pub async fn run_streamable_http(&self, host: &str, port: u16) -> MCPResult<()>

Run the server with Streamable HTTP transport

Source

pub async fn run_http(&self, config: HttpTransportConfig) -> MCPResult<()>

Run the server with HTTP transport

Source

pub async fn run_streamable_http_with_config( &self, config: HttpTransportConfig, ) -> MCPResult<()>

Run the server with custom Streamable HTTP transport configuration This provides clearer naming for advanced Streamable HTTP configuration

Source

pub fn info(&self) -> &ServerInfo

Get server info

Source

pub fn cancellation_manager(&self) -> Arc<CancellationManager>

Get cancellation manager

Source

pub fn ping_manager(&self) -> Arc<PingManager>

Get ping manager

Source

pub async fn start_ping_monitoring( &self, ping_interval: Duration, ) -> MCPResult<()>

Start periodic ping monitoring (optional, for connection health) This method should be called after the server is running with a transport

Source

pub async fn stop_ping_monitoring(&self) -> MCPResult<()>

Stop ping monitoring

Source

pub async fn get_state(&self) -> ServerState

Get current server state

Source

pub async fn can_operate(&self) -> bool

Check if server can accept operations

Source

pub async fn notify_tools_changed( &self, transport: &mut Box<dyn Transport>, ) -> MCPResult<()>

Send tools list changed notification

Source

pub async fn notify_resources_changed( &self, transport: &mut Box<dyn Transport>, ) -> MCPResult<()>

Send resources list changed notification

Source

pub async fn notify_prompts_changed( &self, transport: &mut Box<dyn Transport>, ) -> MCPResult<()>

Send prompts list changed notification

Source

pub async fn notify_resource_updated( &self, uri: String, transport: &mut Box<dyn Transport>, ) -> MCPResult<()>

Send resource updated notification

Source

pub async fn notify_progress( &self, progress_token: Value, progress: f64, total: Option<f64>, message: Option<String>, transport: &mut Box<dyn Transport>, ) -> MCPResult<()>

Send progress notification

Source

pub async fn notify_logging_message( &self, level: LogLevel, data: Value, logger: Option<String>, transport: &mut Box<dyn Transport>, ) -> MCPResult<()>

Send logging message notification

Source

pub async fn notify_cancelled( &self, request_id: Value, reason: Option<String>, transport: &mut Box<dyn Transport>, ) -> MCPResult<()>

Send cancellation notification

Source

pub async fn notify_roots_changed( &self, transport: &mut Box<dyn Transport>, ) -> MCPResult<()>

Send roots list changed notification

Source

pub fn with_advanced_sampling_handler( self, handler: Arc<dyn AdvancedSamplingHandler>, ) -> Self

Set the advanced sampling handler for context collection and human-in-the-loop features

Source

pub fn with_default_advanced_sampling(self) -> Self

Set the advanced sampling handler with default implementation

Source

pub async fn handle_set_roots( &self, roots: Vec<Root>, transport: &mut Box<dyn Transport>, ) -> SetRootsResponse

Handle a roots/set request

Trait Implementations§

Source§

impl Clone for UltraFastServer

Source§

fn clone(&self) -> UltraFastServer

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for UltraFastServer

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> FromRef<T> for T
where T: Clone,

Source§

fn from_ref(input: &T) -> T

Converts to this type from a reference to the input type.
Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> ErasedDestructor for T
where T: 'static,