@@ -150,7 +150,8 @@ def __init__(
150150## Protocol
151151
152152This server implements the Model Context Protocol (MCP) specification for statistical analysis tools.
153- All requests after initialization must include the `MCP-Protocol-Version: 2025-06-18` header.
153+ All requests after initialization must include the `MCP-Protocol-Version` header. Use `2025-11-25`
154+ for the latest spec (preferred); `2025-06-18` remains supported for compatibility.
154155 """ .strip (),
155156 contact = {
156157 "name" : "RMCP Project" ,
@@ -218,16 +219,29 @@ def _validate_origin(self, request: Request) -> None:
218219 def _validate_protocol_version (self , request : Request , method : str ) -> None :
219220 """Validate MCP-Protocol-Version header according to MCP specification."""
220221 protocol_version = request .headers .get ("mcp-protocol-version" )
221- supported_versions = ("2025-06-18" ,)
222+ supported_versions = ("2025-11-25" , "2025-06-18" )
223+ preferred_version = supported_versions [0 ]
222224
223225 if method == "initialize" :
224226 # Initialize requests don't require the header (it's set after negotiation)
225- if protocol_version and protocol_version not in supported_versions :
227+ if not protocol_version :
228+ # Default to the latest version when the client doesn't specify one
229+ request .state .protocol_version = preferred_version
230+ return
231+ if protocol_version not in supported_versions :
226232 raise HTTPException (
227233 400 ,
228234 f"Unsupported protocol version: { protocol_version } . "
229235 f"Supported versions: { ', ' .join (supported_versions )} " ,
230236 )
237+ if protocol_version != preferred_version :
238+ logger .info (
239+ "Client requested older MCP protocol version %s; "
240+ "preferring %s for responses" ,
241+ protocol_version ,
242+ preferred_version ,
243+ )
244+ request .state .protocol_version = protocol_version
231245 else :
232246 # All non-initialize requests MUST include the MCP-Protocol-Version header
233247 if not protocol_version :
@@ -281,7 +295,8 @@ def _setup_routes(self) -> None:
281295
282296 **Required Headers:**
283297 - `Content-Type: application/json`
284- - `MCP-Protocol-Version: 2025-06-18` (after initialization)
298+ - `MCP-Protocol-Version: 2025-11-25` (preferred after initialization; `2025-06-18`
299+ remains supported)
285300
286301 **Session Management:**
287302 Sessions must be initialized before other operations.
@@ -501,8 +516,8 @@ async def landing_page() -> Response:
501516 <pre style="background: #f4f4f4; padding: 15px; border-radius: 4px; overflow-x: auto;">
502517curl -X POST https://rmcp-server-394229601724.us-central1.run.app/mcp \\
503518 -H "Content-Type: application/json" \\
504- -H "MCP-Protocol-Version: 2025-06-18 " \\
505- -d '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2025-06-18 ","capabilities":{},"clientInfo":{"name":"test-client","version":"1.0"}}}'</pre>
519+ -H "MCP-Protocol-Version: 2025-11-25 " \\
520+ -d '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2025-11-25 ","capabilities":{},"clientInfo":{"name":"test-client","version":"1.0"}}}'</pre>
506521
507522 <div class="footer">
508523 <p>RMCP v0.5.1 | MIT License | <a href="https://github.com/finite-sample/rmcp">GitHub</a></p>
0 commit comments