Skip to main content

McpConfig

Struct McpConfig 

Source
pub struct McpConfig {
    pub host: String,
    pub port: u16,
    pub server_name: String,
    pub no_auth: bool,
    pub trusted_gateway: bool,
    pub conformance_fixtures: bool,
    pub api_token: Option<String>,
    pub static_token_write: bool,
    pub allowed_hosts: Vec<String>,
    pub allowed_origins: Vec<String>,
    pub trace_headers: TraceHeaderMode,
    pub auth: AuthConfig,
}
Expand description

MCP HTTP server configuration.

Fields§

§host: String

Bind host (SOMA_MCP_HOST). Default: 127.0.0.1 (loopback). Set to 0.0.0.0 to listen on all interfaces — requires auth configured.

§port: u16

Bind port (SOMA_MCP_PORT). Default: 40060.

§server_name: String

MCP server name advertised to clients (SOMA_MCP_SERVER_NAME).

§no_auth: bool

Disable auth entirely — only safe when bound to loopback (SOMA_MCP_NO_AUTH).

§trusted_gateway: bool

Allow unauthenticated access on non-loopback when behind a trusted reverse proxy that enforces its own auth (SOMA_NOAUTH). Loaded here so it participates in typed config rather than being a raw env read at call sites.

§conformance_fixtures: bool

Advertise official MCP conformance reference fixtures.

This is a test harness switch, not part of Soma’s production surface. Keep it false for real derived servers.

§api_token: Option<String>

Static bearer token for simple auth (SOMA_MCP_TOKEN).

§static_token_write: bool

Grant the static bearer token soma:write in addition to the default soma:read (SOMA_MCP_STATIC_TOKEN_WRITE). Off by default so a leaked static token cannot perform write actions unless the operator explicitly opted in (pattern ported from cortex’s static_token_is_admin).

§allowed_hosts: Vec<String>

Additional allowed Host header values (comma-separated in env).

§allowed_origins: Vec<String>

Additional allowed CORS origins (comma-separated in env).

§trace_headers: TraceHeaderMode

Trusted HTTP trace-header extraction mode (SOMA_MCP_TRACE_HEADERS). Only meaningful when the resolved auth policy is a real trust boundary (loopback bind or a trusted gateway) — see soma_runtime::server::resolve_auth_policy_kind.

§auth: AuthConfig

OAuth sub-config (nested under [mcp.auth] in config.toml).

Implementations§

Source§

impl McpConfig

Source

pub fn bind_addr(&self) -> String

Source

pub fn is_loopback(&self) -> bool

Return true if the configured bind host resolves to a loopback address.

Uses IpAddr::is_loopback() for numeric addresses. Accepts “localhost” as a canonical loopback hostname. Any other hostname or parse failure is treated as non-loopback — callers must not assume safety in that case.

Trait Implementations§

Source§

impl Clone for McpConfig

Source§

fn clone(&self) -> McpConfig

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for McpConfig

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Default for McpConfig

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for McpConfig

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for McpConfig

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. 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> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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> 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<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,