pub struct HttpServerConfig {
pub listen: SocketAddr,
pub extra_origins: Vec<String>,
pub require_bearer: bool,
pub max_body_bytes: usize,
pub shared: Arc<SharedServerConfig>,
}Expand description
Configuration for crate::Server. All fields are public so adopters
can use struct-literal construction; Default::default() returns
loopback 127.0.0.1:0 with anonymous-mode bearer policy (matches the
Celia http_server.rs precedent in celia-cli/src/http_server.rs:114-130).
Fields§
§listen: SocketAddrAddress the listener binds to. SP-streamable-http §4.6 mandates
loopback default — fail-closed against DNS rebinding per MCP
Security Warning. Use 127.0.0.1:0 in tests to let the kernel
pick a free port.
extra_origins: Vec<String>Origin patterns added to the default allow-list
(http://127.0.0.1*, http://localhost*, https://127.0.0.1*,
https://localhost*, tauri://*). Matched against the request’s
Origin header verbatim — full string equality, not prefix.
Operators surface this from the --allow-origin CLI flag,
repeatable.
require_bearer: boolWhen true, requests without Authorization: Bearer … are
rejected with HTTP 401 / JSON-RPC -32002. When false (default),
bearer-less requests fall through to anonymous mode with empty
CapabilitySet — matching celia-cli/src/http_server.rs:295-306
Tier-0 trust. Bearer-bearing requests are always validated
regardless of this flag.
max_body_bytes: usizeBody-size cap for POST /mcp. Larger requests rejected with HTTP
413. Defaults to DEFAULT_MAX_BODY_BYTES (10 MiB) to match the
atd-protocol::wire::MAX_FRAME_BYTES cap.
Shared dispatch-side configuration. Adopters who run UDS + HTTP
from the same process build one SharedServerConfig, wrap it in
Arc, and pass clones to both transports so they share the audit
sink, token broker, capability allow-list, and server identity by
reference.