Skip to content

Add SEP-2575 conformance tests #266

@Yuan325

Description

@Yuan325

Add conformance tests for SEP-2575 to validate the stateless-MCP behavior. This includes conformance tests for both MCP server and client.

Server

  1. Per-request _meta
    • Rejects request with missing _meta → -32602 Invalid params.
    • Rejects request with _meta missing io.modelcontextprotocol/protocolVersion.
    • Rejects request with _meta missing io.modelcontextprotocol/clientInfo.
    • Rejects request with _meta missing io.modelcontextprotocol/clientCapabilities.
  2. server/discover
    • Responds to server/discover
    • Response includes required fields: supportedVersions (non-empty), capabilities, serverInfo
    • capabilities matches what the server honors on real RPC calls
  3. Version negotiation
    • For a _meta.protocolVersion the server does not support, returns UnsupportedProtocolVersionError (not Invalid params and not silent rejection).
    • UnsupportedProtocolVersionError carries non-empty data.supportedVersions matching the set advertised by server/discover (no drift).
    • server/discover's supportedVersions matches the set the server actually accepts on real RPC calls (no drift).
    • Returns the error even when the unsupported version is on the server/discover request itself (and still advertises supportedVersions so the client can recover).
    • [HTTP] UnsupportedProtocolVersionError → HTTP 400 Bad Request.
    • [HTTP] Rejects request when MCP-Protocol-Version header is absent or does not match _meta.protocolVersion (HTTP 400).
  4. Errors
    • MissingRequiredClientCapabilityError (-32003) carries data.requiredCapabilities listing missing keys.
    • All error responses carry the request's JSON-RPC id.
  5. Removed RPCs
    • ping → -32601.
    • logging/setLevel → -32601.
    • resources/subscribe → -32601.
    • resources/unsubscribe → -32601.
  6. HTTP transport
    • Unknown method → HTTP 404 Not Found + JSON-RPC -32601.
    • MissingRequiredClientCapabilityError → HTTP 400 Bad Request.

Client

  1. Per-request _meta
    • Populates _meta on every request with all three required fields.
    • Accurately reports clientCapabilities per request (does not claim unsupported features).
  2. server/discover
    • Should be able to call
  3. Version negotiation
    • Does version negotiation correctly
    • Includes io.modelcontextprotocol/protocolVersion in _meta on every request.
    • Sends a consistent protocolVersion once chosen (does not flip between versions request-to-request).
    • [HTTP] Sends MCP-Protocol-Version header on every request, equal to _meta.protocolVersion.
  4. Cancellation
    • [HTTP] Cancels by closing the stream (request).
    • [STDIO] Cancels by sending notifications/cancelled with the request id.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions