#[non_exhaustive]pub struct McpConfig {
pub enabled: bool,
pub oauth: bool,
pub path: String,
pub session_ttl: DurationStr,
pub allowed_origins: Vec<String>,
pub require_protocol_version_header: bool,
pub max_sessions: usize,
pub max_sessions_per_user: usize,
pub allow_unauthenticated_dcr: bool,
}Expand description
MCP server configuration.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.enabled: boolEnable MCP endpoint exposure.
oauth: boolEnable OAuth 2.1 Authorization Code + PKCE for MCP clients.
When true, Forge acts as an OAuth 2.1 Authorization Server so MCP
clients like Claude Code can auto-authenticate via browser login.
Requires auth.jwt_secret to be set.
path: StringMCP endpoint path under the gateway API namespace.
session_ttl: DurationStrSession TTL duration (e.g. “1h”, “30m”).
allowed_origins: Vec<String>Allowed origins for Origin header validation.
require_protocol_version_header: boolEnforce MCP-Protocol-Version header on post-initialize requests.
max_sessions: usizeMaximum total MCP sessions across all users.
max_sessions_per_user: usizeMaximum sessions a single authenticated user can hold.
allow_unauthenticated_dcr: boolAllow unauthenticated dynamic client registration (RFC 7591).
When false (default), POST /_api/oauth/register returns 403
to anonymous callers. This blocks anyone on the internet from
registering an OAuth client and being handed a client_id they
can use to drive the authorization flow.
Enable only if your trust model is “any caller may register a
client” (typical for public IDE integrations behind a per-IP rate
limit). Even when enabled, registrations remain capped by the
MAX_REGISTERED_CLIENTS limit and the per-IP rate window.
Implementations§
Trait Implementations§
Source§impl<'de> Deserialize<'de> for McpConfig
impl<'de> Deserialize<'de> for McpConfig
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 McpConfig
impl RefUnwindSafe for McpConfig
impl Send for McpConfig
impl Sync for McpConfig
impl Unpin for McpConfig
impl UnsafeUnpin for McpConfig
impl UnwindSafe for McpConfig
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