StreamableHttpServerTransport class

MCP 2025-03-26 StreamableHTTP Server Transport Implementation Supports both JSON responses and SSE streaming according to MCP standard

Implemented types

Constructors

StreamableHttpServerTransport({required StreamableHttpServerConfig config, @Deprecated('sessionId parameter is ignored. StreamableHTTP now manages multiple sessions internally.') String? sessionId})

Properties

config StreamableHttpServerConfig
final
hashCode int
The hash code for this object.
no setterinherited
onClose Future<void>
Future that completes when the transport is closed
no setteroverride
onMessage Stream
Stream of incoming messages
no setteroverride
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
sessionId String
Get session ID - deprecated Returns empty string as this transport now manages multiple sessions
no setter

Methods

close() → void
Close the transport
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
send(dynamic message) → void
Send a message through the transport
override
setProtectedResourceMetadataProvider(Map<String, dynamic>? provider()) → void
Register a callback the transport will invoke to populate the .well-known/oauth-protected-resource document. Returning null from the callback causes the route to respond with 404.
start() Future<void>
Start the HTTP server
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited