Enable MCP response streaming for your AgentCore gateway
MCP response streaming enables your AgentCore gateway to deliver real-time Server-Sent Events (SSE) to clients during tool execution. Instead of waiting for the entire tool call to complete before returning a response, the gateway streams events as they occur — including progress notifications, log messages, elicitation requests, and sampling requests.
Benefits of response streaming
- Real-time feedback
-
Clients receive progress updates and log messages as they happen, rather than waiting for the full tool response.
- Enables interactive MCP features
-
Response streaming is a prerequisite for elicitation, sampling, progress notifications, and logging messages. These features require an open SSE connection to deliver server-initiated events during tool execution.
- Better user experience for long-running tools
-
For tools that take seconds or minutes to complete, streaming keeps the client informed and responsive.
Enable response streaming
To enable response streaming, set streamingConfiguration.enableResponseStreaming to true in the protocolConfiguration.mcp field when creating or updating your gateway:
{ "protocolConfiguration": { "mcp": { "streamingConfiguration": { "enableResponseStreaming": true } } } }
Note
Enabling response streaming introduces a change to the response interceptor input contract. If you use response interceptors, review your interceptor logic to ensure compatibility with streaming responses. See Response interceptors with streaming enabled for details.
How response streaming works
When response streaming is enabled and the client sends a request with Accept: text/event-stream, the gateway returns an SSE stream instead of a single JSON response. Events are delivered as they are received from the MCP server target.
The SSE stream can include the following event types:
| Event type | Description |
|---|---|
|
|
Progress updates from the target during tool execution. See Receive progress notifications. |
|
|
Log messages from the target. See Receive logging messages. |
|
|
Elicitation requests from the target asking for user input. See Use elicitation. |
|
|
Sampling requests from the target asking for an LLM completion. See Use sampling. |
|
Final result |
The tool call result, delivered as the last event before the stream closes. |
If the client does not send Accept: text/event-stream, the gateway buffers the response and returns a single JSON response after the tool call completes. Intermediate events (progress, logging) are not delivered in this case.
Client requirements
To receive streaming responses, clients must:
-
Send the
Accept: text/event-streamheader in their requests. -
Handle SSE events as they arrive, parsing each
data:line as a JSON-RPC message. -
Keep the connection open until the final result event is received.