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

@ -31,9 +31,9 @@ var (
// ErrUnknown should be used for all non coded errors.
ErrUnknown = NewError(-32001, "unknown error")
// ErrServerClosing is returned for calls that arrive while the server is closing.
ErrServerClosing = NewError(-32006, "server is closing")
ErrServerClosing = NewError(-32004, "server is closing")
// ErrClientClosing is a dummy error returned for calls initiated while the client is closing.
ErrClientClosing = NewError(-32007, "client is closing")
ErrClientClosing = NewError(-32003, "client is closing")
// The following errors have special semantics for MCP transports
@ -45,8 +45,6 @@ var (
// should be returned to the caller to indicate that the specific request is
// invalid in the current context.
ErrRejected = NewError(-32005, "rejected by transport")
// ErrUnsupportedProtocolVersion is returned when a server does not support the protocol version.
ErrUnsupportedProtocolVersion = NewError(-32004, "unsupported protocol version")
)
const wireVersion = "2.0"