mcp: reject calls to methodDiscover for <20260728 requests (#1084)
This PR adds a gate for requests towards methodDiscover if it is coming from a client that does not support the 20260728 protocol version
This commit is contained in:
parent
8f54783331
commit
7fde7d3452
1 changed files with 6 additions and 0 deletions
|
|
@ -1883,6 +1883,12 @@ func (ss *ServerSession) handle(ctx context.Context, req *jsonrpc.Request) (any,
|
|||
// In case of methodDiscover call the state.initializeParams is populated
|
||||
// within the discover handle function to make sure the method is supported
|
||||
// when the user is probing a pre-2026-07-28 server.
|
||||
if !validatedMeta.usesNewProtocol {
|
||||
return nil, &jsonrpc.Error{
|
||||
Code: jsonrpc.CodeMethodNotFound,
|
||||
Message: fmt.Sprintf("%q is only supported in protocol version >= %s", req.Method, protocolVersion20260728),
|
||||
}
|
||||
}
|
||||
default:
|
||||
if !initialized && !validatedMeta.usesNewProtocol {
|
||||
ss.server.opts.Logger.Error("method invalid during initialization", "method", req.Method)
|
||||
|
|
|
|||
Loading…
Reference in a new issue