pub struct ServerConfig {
pub port: u16,
pub stdio: bool,
pub max_connections: usize,
pub request_timeout_secs: u64,
}Expand description
Server configuration controlling network and connection settings
§Security Implications
The server configuration affects the attack surface and resource consumption:
- Lower connection limits prevent resource exhaustion attacks
- Shorter timeouts reduce the window for slow loris attacks
- stdio mode is more secure than network modes (no network exposure)
Fields§
§port: u16Port to listen on (for HTTP transport)
Default: 8080 Security: Use non-standard ports to reduce automated scanning. Consider using a reverse proxy for production deployments. Range: 1-65535 (ports < 1024 require root/admin privileges)
stdio: boolEnable stdio transport (default for MCP)
Default: true (secure by default) Security: stdio is the most secure transport as it doesn’t expose a network interface. Recommended for local integrations. Trade-off: Limited to local process communication only
max_connections: usizeMaximum concurrent connections
Default: 100 Security: Prevents resource exhaustion attacks. Lower values are more secure but may impact legitimate high-traffic scenarios. Range: 1-10000 (recommend 10-500 for most deployments) Warning: Values > 1000 may cause memory issues under attack
request_timeout_secs: u64Request timeout in seconds
Default: 30 seconds Security: Shorter timeouts prevent slow loris and resource holding attacks. Longer timeouts may be needed for complex operations. Range: 1-300 (recommend 10-60 for most use cases) Trade-off: Too short may interrupt legitimate long operations
Trait Implementations§
Source§impl Clone for ServerConfig
impl Clone for ServerConfig
Source§fn clone(&self) -> ServerConfig
fn clone(&self) -> ServerConfig
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ServerConfig
impl Debug for ServerConfig
Source§impl Default for ServerConfig
impl Default for ServerConfig
Source§impl<'de> Deserialize<'de> for ServerConfig
impl<'de> Deserialize<'de> for ServerConfig
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Auto Trait Implementations§
impl Freeze for ServerConfig
impl RefUnwindSafe for ServerConfig
impl Send for ServerConfig
impl Sync for ServerConfig
impl Unpin for ServerConfig
impl UnwindSafe for ServerConfig
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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>
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>
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