cxxmcp 1.1.6
C++ MCP SDK
Loading...
Searching...
No Matches
mcp::server::HttpTransportOptions Struct Reference

Configuration for HttpTransport. More...

#include <http_transport.hpp>

Public Attributes

std::string listen_host = "127.0.0.1"
 Interface address passed to the underlying HTTP server.
 
int listen_port = 0
 TCP port to listen on. Must be in the range 1..65535.
 
std::string path = "/mcp"
 HTTP path for POST, GET/SSE, and DELETE session requests.
 
std::optional< std::chrono::milliseconds > sse_retry
 Optional SSE retry interval hint for the priming event.
 
bool enable_sse_polling = false
 Enable SEP-1699 SSE polling: always send a priming event with id on SSE streams and allow server-initiated disconnect via disconnect_session_sse().
 
std::chrono::milliseconds sse_disconnect_retry {5000}
 Retry hint (ms) sent to the client before a server-initiated SSE disconnect.
 
std::vector< std::string > allowed_origins
 Optional Origin allow-list. Empty means Origin is not restricted.
 
std::vector< std::string > allowed_hosts = {"localhost", "127.0.0.1", "::1"}
 Host allow-list used to reject DNS-rebinding attempts.
 
std::size_t max_pending_sse_events = 1024
 Maximum server-to-client events waiting for an SSE stream.
 
std::size_t max_pending_sse_bytes = 4 * 1024 * 1024
 Maximum serialized bytes waiting for an SSE stream.
 
std::size_t max_sse_replay_events = 256
 Number of delivered SSE events retained for Last-Event-ID replay.
 
std::chrono::milliseconds request_timeout {30000}
 Maximum time to wait for a client response to a server-to-client request.
 
std::size_t max_request_body_bytes = 10 * 1024 * 1024
 Maximum HTTP request body size accepted by the underlying server.
 
std::chrono::milliseconds read_timeout {30000}
 Socket read timeout for HTTP request handling.
 
std::chrono::milliseconds write_timeout {30000}
 Socket write timeout for HTTP response handling.
 
std::size_t max_sessions = 1024
 Maximum active HTTP sessions accepted by this transport.
 
bool stateless = false
 Enable stateless MCP mode (SEP-2575).
 
std::string auth_challenge = std::string(DefaultAuthChallenge)
 HTTP WWW-Authenticate challenge emitted when authentication fails.
 
AuthChallengeConfig auth_challenge_config
 Structured auth challenge configuration.
 
ProtectedResourceMetadataConfig protected_resource_metadata
 RFC 9728 Protected Resource Metadata.
 

Detailed Description

Configuration for HttpTransport.

Member Data Documentation

◆ allowed_hosts

std::vector<std::string> mcp::server::HttpTransportOptions::allowed_hosts = {"localhost", "127.0.0.1", "::1"}

Host allow-list used to reject DNS-rebinding attempts.

Empty disables Host validation. Entries may be hostnames/IP literals or host:port authorities.

◆ auth_challenge

std::string mcp::server::HttpTransportOptions::auth_challenge = std::string(DefaultAuthChallenge)

HTTP WWW-Authenticate challenge emitted when authentication fails.

Empty disables the header for custom deployments that emit challenges through another layer. This is a legacy field; prefer auth_challenge_config for resource_metadata and scope support.

◆ auth_challenge_config

AuthChallengeConfig mcp::server::HttpTransportOptions::auth_challenge_config

Structured auth challenge configuration.

When resource_metadata_url or scope is set, the WWW-Authenticate header includes those parameters. If auth_challenge_config.scheme is non-empty, it overrides auth_challenge.

◆ max_request_body_bytes

std::size_t mcp::server::HttpTransportOptions::max_request_body_bytes = 10 * 1024 * 1024

Maximum HTTP request body size accepted by the underlying server.

Set to zero to disable the limit.

◆ max_sessions

std::size_t mcp::server::HttpTransportOptions::max_sessions = 1024

Maximum active HTTP sessions accepted by this transport.

Set to zero to disable the limit.

◆ protected_resource_metadata

ProtectedResourceMetadataConfig mcp::server::HttpTransportOptions::protected_resource_metadata

RFC 9728 Protected Resource Metadata.

When resource is non-empty, the transport serves the metadata at /.well-known/oauth-protected-resource.

◆ request_timeout

std::chrono::milliseconds mcp::server::HttpTransportOptions::request_timeout {30000}

Maximum time to wait for a client response to a server-to-client request.

Set to zero or a negative duration to wait indefinitely.

◆ sse_disconnect_retry

std::chrono::milliseconds mcp::server::HttpTransportOptions::sse_disconnect_retry {5000}

Retry hint (ms) sent to the client before a server-initiated SSE disconnect.

Only used when enable_sse_polling is true.

◆ stateless

bool mcp::server::HttpTransportOptions::stateless = false

Enable stateless MCP mode (SEP-2575).

When true, the transport does not require initialize handshake or Mcp-Session-Id headers. Requests proceed without session tracking.


The documentation for this struct was generated from the following file: