Skip to content

Commit df10fd4

Browse files
committed
Standard last-event-id request header name
1 parent 2c3905a commit df10fd4

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

mcp-spring/mcp-spring-webflux/src/main/java/io/modelcontextprotocol/client/transport/WebClientStreamableHttpTransport.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
import java.util.function.Function;
3636
import java.util.function.Supplier;
3737

38+
import static io.modelcontextprotocol.spec.McpSchema.Headers.LAST_EVENT_ID;
3839
import static io.modelcontextprotocol.spec.McpSchema.Headers.MCP_SESSION_ID;
3940

4041
/**
@@ -190,7 +191,7 @@ private Mono<Disposable> reconnect(McpTransportStream<Disposable> stream) {
190191
.headers(httpHeaders -> {
191192
transportSession.sessionId().ifPresent(id -> httpHeaders.add(MCP_SESSION_ID, id));
192193
if (stream != null) {
193-
stream.lastId().ifPresent(id -> httpHeaders.add("last-event-id", id));
194+
stream.lastId().ifPresent(id -> httpHeaders.add(LAST_EVENT_ID, id));
194195
}
195196
})
196197
.exchangeToFlux(response -> {

mcp/src/main/java/io/modelcontextprotocol/spec/McpSchema.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,8 +142,18 @@ public static final class ErrorCodes {
142142
*/
143143
public static final class Headers {
144144

145+
/**
146+
* The Model Context Protocol (MCP) session ID header name.
147+
*/
145148
public static final String MCP_SESSION_ID = "Mcp-Session-Id";
146149

150+
/**
151+
* The Last-Event-ID HTTP request header reports an EventSource object's last
152+
* event ID string to the server when the user agent is to reestablish the
153+
* connection.
154+
*/
155+
public static final String LAST_EVENT_ID = "Last-Event-ID";
156+
147157
}
148158

149159
public sealed interface Request permits InitializeRequest, CallToolRequest, CreateMessageRequest, ElicitRequest,

0 commit comments

Comments
 (0)