Skip to content

Commit d20af91

Browse files
authored
Add 2025-11-25 spec version to all transports (#1025)
Signed-off-by: Dariusz Jędrzejczyk <2554306+chemicL@users.noreply.github.com>
1 parent c42d313 commit d20af91

5 files changed

Lines changed: 16 additions & 15 deletions

File tree

MIGRATION-2.0.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,18 @@ The deprecated `Builder.customizeRequest(Consumer<HttpRequest.Builder>)` method
215215

216216
**Action:** Use `requestBuilder(HttpRequest.Builder)` for static request setup, or `httpRequestCustomizer(McpSyncHttpClientRequestCustomizer)` for per-request customization.
217217

218+
### `protocolVersions()` default now advertises all known versions
219+
220+
The default implementation of `protocolVersions()` on `McpTransport` and `McpServerTransportProviderBase` previously returned only `["2024-11-05"]`. It now returns all four versions the SDK understands:
221+
222+
```
223+
["2024-11-05", "2025-03-26", "2025-06-18", "2025-11-25"]
224+
```
225+
226+
**Impact for transport implementors:** If your custom `McpClientTransport` or `McpServerTransportProvider` did not override `protocolVersions()`, it will now advertise all four versions during protocol negotiation instead of just `2024-11-05`. This is the intended upgrade path for most transports, but if you need to restrict your transport to a specific set of versions, override `protocolVersions()` explicitly and return the desired list.
227+
228+
**Impact for users of built-in transports:** No action is required. `StdioClientTransport`, `StdioServerTransportProvider`, and `HttpServletStreamableServerTransportProvider` all advertise the full version list.
229+
218230
### SSE transports are deprecated
219231

220232
The HTTP+SSE client and server transports (and their supporting validator/exception types) are deprecated in favour of Streamable HTTP — `HttpClientStreamableHttpTransport` on the client, and `HttpServletStreamableServerTransportProvider` on the server. They still work; plan a move to Streamable HTTP.

mcp-core/src/main/java/io/modelcontextprotocol/server/transport/HttpServletStreamableServerTransportProvider.java

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727
import io.modelcontextprotocol.spec.McpStreamableServerSession;
2828
import io.modelcontextprotocol.spec.McpStreamableServerTransport;
2929
import io.modelcontextprotocol.spec.McpStreamableServerTransportProvider;
30-
import io.modelcontextprotocol.spec.ProtocolVersions;
3130
import io.modelcontextprotocol.util.Assert;
3231
import io.modelcontextprotocol.json.McpJsonDefaults;
3332
import io.modelcontextprotocol.json.McpJsonMapper;
@@ -166,12 +165,6 @@ private HttpServletStreamableServerTransportProvider(McpJsonMapper jsonMapper, S
166165

167166
}
168167

169-
@Override
170-
public List<String> protocolVersions() {
171-
return List.of(ProtocolVersions.MCP_2024_11_05, ProtocolVersions.MCP_2025_03_26,
172-
ProtocolVersions.MCP_2025_06_18, ProtocolVersions.MCP_2025_11_25);
173-
}
174-
175168
@Override
176169
public void setSessionFactory(McpStreamableServerSession.Factory sessionFactory) {
177170
this.sessionFactory = sessionFactory;

mcp-core/src/main/java/io/modelcontextprotocol/server/transport/StdioServerTransportProvider.java

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
import io.modelcontextprotocol.spec.McpServerSession;
2323
import io.modelcontextprotocol.spec.McpServerTransport;
2424
import io.modelcontextprotocol.spec.McpServerTransportProvider;
25-
import io.modelcontextprotocol.spec.ProtocolVersions;
2625
import io.modelcontextprotocol.util.Assert;
2726
import io.modelcontextprotocol.json.McpJsonMapper;
2827
import org.slf4j.Logger;
@@ -82,11 +81,6 @@ public StdioServerTransportProvider(McpJsonMapper jsonMapper, InputStream inputS
8281
this.outputStream = outputStream;
8382
}
8483

85-
@Override
86-
public List<String> protocolVersions() {
87-
return List.of(ProtocolVersions.MCP_2024_11_05);
88-
}
89-
9084
@Override
9185
public void setSessionFactory(McpServerSession.Factory sessionFactory) {
9286
// Create a single session for the stdio connection

mcp-core/src/main/java/io/modelcontextprotocol/spec/McpServerTransportProviderBase.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,8 @@ default void close() {
8282
* @return the protocol version as a string
8383
*/
8484
default List<String> protocolVersions() {
85-
return List.of(ProtocolVersions.MCP_2024_11_05);
85+
return List.of(ProtocolVersions.MCP_2024_11_05, ProtocolVersions.MCP_2025_03_26,
86+
ProtocolVersions.MCP_2025_06_18, ProtocolVersions.MCP_2025_11_25);
8687
}
8788

8889
}

mcp-core/src/main/java/io/modelcontextprotocol/spec/McpTransport.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,8 @@ static boolean isPeerClosed(Throwable t) {
101101
<T> T unmarshalFrom(Object data, TypeRef<T> typeRef);
102102

103103
default List<String> protocolVersions() {
104-
return List.of(ProtocolVersions.MCP_2024_11_05);
104+
return List.of(ProtocolVersions.MCP_2024_11_05, ProtocolVersions.MCP_2025_03_26,
105+
ProtocolVersions.MCP_2025_06_18, ProtocolVersions.MCP_2025_11_25);
105106
}
106107

107108
}

0 commit comments

Comments
 (0)