StreamableHttpServerConfig constructor

const StreamableHttpServerConfig({
  1. String endpoint = '/mcp',
  2. String host = 'localhost',
  3. int port = 8080,
  4. List<int> fallbackPorts = const [8081, 8082, 8083],
  5. CorsConfig corsConfig = const CorsConfig(),
  6. int maxRequestSize = 4 * 1024 * 1024,
  7. Duration requestTimeout = const Duration(seconds: 30),
  8. bool isJsonResponseEnabled = false,
  9. String jsonResponseMode = 'sync',
  10. String? authToken,
  11. bool enableGetStream = true,
})

Implementation

const StreamableHttpServerConfig({
  this.endpoint = '/mcp',
  this.host = 'localhost',
  this.port = 8080,
  this.fallbackPorts = const [8081, 8082, 8083],
  this.corsConfig = const CorsConfig(),
  this.maxRequestSize = 4 * 1024 * 1024, // 4MB
  this.requestTimeout = const Duration(seconds: 30),
  this.isJsonResponseEnabled = false, // StreamableHTTP uses SSE by default
  this.jsonResponseMode = 'sync', // Default to synchronous JSON responses
  this.authToken, // Optional Bearer token for authentication
  this.enableGetStream = true, // Default: enabled per MCP 2025-03-26
});