mco: update JSON-RPC error codes to align with updated MCP specification (#1016)

This PR updates the error codes to align with the updated specifications
in
https://github.com/modelcontextprotocol/modelcontextprotocol/pull/2907

ErrServerClosing and ErrClientClosing are reverted to their 1.6.0
version codes, as they do not overlap anymore with the newly introduced
error codes.
This commit is contained in:
Guglielmo Colombo 2026-06-22 10:27:31 +02:00 • committed by GitHub
commit 3486f6bcaf
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -955,7 +955,8 @@ func (s *stream) release() {
//
// Per SEP-2575:
// - MethodNotFound (-32601) MUST return HTTP 404.
// - InvalidParams (-32602) and UnsupportedProtocolVersion (-32004) MUST
// - InvalidParams (-32602), UnsupportedProtocolVersion (-32022) and
// CodeMissingRequiredClientCapabilities (-32021) MUST
// return HTTP 400.
func extractErrorStatus(ctx context.Context, msg jsonrpc.Message) int {
if protocolVersionFromContext(ctx) < protocolVersion20260728 {