Skip to main content

ActixServerOptions

Struct ActixServerOptions 

Source
pub struct ActixServerOptions {
Show 23 fields pub host: String, pub port: u16, pub session_id_generator: Option<Arc<dyn IdGenerator<SessionId>>>, pub custom_streamable_http_endpoint: Option<String>, pub transport_options: Arc<TransportOptions>, pub event_store: Option<Arc<dyn EventStore>>, pub task_store: Option<Arc<ServerTaskStore>>, pub client_task_store: Option<Arc<ClientTaskStore>>, pub enable_json_response: Option<bool>, pub ping_interval: Duration, pub sse_support: bool, pub custom_sse_endpoint: Option<String>, pub custom_messages_endpoint: Option<String>, pub auth: Option<Arc<dyn AuthProvider>>, pub health_endpoint: Option<String>, pub health_handler: Option<Arc<dyn HealthHandler>>, pub message_observer: Option<Arc<dyn McpObserver<ClientMessage, ServerMessage>>>, pub max_request_body_size: Option<usize>, pub dns_rebinding: DnsRebindingOptions, pub session_store: Option<Arc<dyn SessionStore>>, pub enable_ssl: bool, pub ssl_cert_path: Option<String>, pub ssl_key_path: Option<String>,
}
Expand description

Configuration for the Actix MCP server.

Used to configure the turnkey server created via create_actix_server().

Fields§

§host: String

Hostname or IP address the server will bind to (default: "127.0.0.1")

§port: u16

TCP port (default: 8080)

§session_id_generator: Option<Arc<dyn IdGenerator<SessionId>>>

Optional session ID generator

§custom_streamable_http_endpoint: Option<String>

Custom Streamable HTTP endpoint path (default: /mcp)

§transport_options: Arc<TransportOptions>

Shared transport configuration

§event_store: Option<Arc<dyn EventStore>>

Event store for resumability support

§task_store: Option<Arc<ServerTaskStore>>

Task store for server-side tasks

§client_task_store: Option<Arc<ClientTaskStore>>

Task store for client-side tasks

§enable_json_response: Option<bool>

If true, return JSON instead of SSE stream

§ping_interval: Duration

Interval between keep-alive pings

§sse_support: bool

Enable SSE transport support (default: true)

§custom_sse_endpoint: Option<String>

Custom SSE endpoint path (default: /sse)

§custom_messages_endpoint: Option<String>

Custom SSE messages endpoint path (default: /messages)

§auth: Option<Arc<dyn AuthProvider>>

Optional authentication provider

§health_endpoint: Option<String>

Health check endpoint path (None disables)

§health_handler: Option<Arc<dyn HealthHandler>>

Custom health check handler

§message_observer: Option<Arc<dyn McpObserver<ClientMessage, ServerMessage>>>

Optional message observer for telemetry

§max_request_body_size: Option<usize>

Maximum request body size in bytes. Defaults to 4 MiB when None.

§dns_rebinding: DnsRebindingOptions

DNS rebinding protection configuration (enabled by default).

When dns_rebinding_protection is true and no allowed_hosts or allowed_origins are configured, allowed_hosts is auto-derived from host:port unless the bind address is a wildcard.

§session_store: Option<Arc<dyn SessionStore>>

Optional session store implementation. Defaults to a bounded InMemorySessionStore (10k max sessions, no idle TTL) when None. Pass your own SessionStore implementation to use Redis, custom limits, or any other session backend.

§enable_ssl: bool

Enable TLS/SSL (requires ssl feature, default: false)

§ssl_cert_path: Option<String>

Path to TLS certificate PEM file

§ssl_key_path: Option<String>

Path to TLS private key PEM file

Implementations§

Source§

impl ActixServerOptions

Source

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

Validates the server configuration.

Source

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

Resolves the SocketAddr from host and port.

Source

pub fn base_url(&self) -> String

Source

pub fn streamable_http_url(&self) -> String

Source

pub fn sse_url(&self) -> String

Source

pub fn sse_message_url(&self) -> String

Source

pub fn sse_endpoint(&self) -> &str

Source

pub fn sse_messages_endpoint(&self) -> &str

Source

pub fn streamable_http_endpoint(&self) -> &str

Source

pub fn max_request_body_size(&self) -> usize

Maximum incoming HTTP request body size in bytes, falling back to the default (4 MiB) when not configured.

Source

pub fn resolve_mount_options(&self) -> McpMountOptions

Resolves mount options from this server configuration.

Trait Implementations§

Source§

impl Default for ActixServerOptions

Source§

fn default() -> Self

Returns the “default value” for a type. 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> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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: Sized + 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: Sized + 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, 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<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