Skip to content

Add test suite for MCP conformance #6630

Closed

Description

@lloydrichards

Building on top of what @IMax153 did in #6610 I want to propose a more complete test suite for MCP spec across the various topics as well as how this will fit with something like #6617 where we might need a full suite to be able to test the same specifications against differently build McpServers.

While looking into this I found the Mcp has its own CLI for this conformance which I'm testing in parallel but gives an amazing list of scenario and specs in yaml which can be fairly quickly converted into vitest descriptions.

Following the Lifecycle.test.ts I would propose the following initial suite:

Full Suite
✓ McpServer (222)
  ✓ 2025-06-18 (222)

    ✓ Lifecycle (10)
      ✓ Lifecycle Phases (9)
        ✓ Initialization (5)
          ✓ MUST requires initialize to be the first request
          ✓ MUST rejects initialized notifications before initialize
          ✓ SCHEMA requires protocolVersion, capabilities, and clientInfo
          ✓ SCHEMA returns server capabilities and implementation information
          ✓ MUST accepts initialized after a successful initialize response
        ✓ Version Negotiation (2)
          ✓ MUST echoes every requested version supported by the server
          ✓ MUST negotiates an unsupported requested version to the latest supported version
        ✓ Capability Negotiation (1)
          ✓ SCHEMA advertises the capabilities provided by the server
      ✓ Operation (1)
        ✓ MUST continues to use the version negotiated during initialization
      ✓ Error Handling (1)
        ✓ SCENARIO handles protocol version mismatch through version negotiation

    ↓ Base Protocol (18)
      ↓ Messages (17)
        ↓ Requests (6)
          ↓ SCHEMA accepts JSON-RPC 2.0 requests with string identifiers
          ↓ SCHEMA accepts JSON-RPC 2.0 requests with numeric identifiers
          ↓ MUST rejects requests with an invalid JSON-RPC version
          ↓ MUST rejects requests without an identifier
          ↓ MUST returns method not found for unknown request methods
          ↓ MUST returns invalid params for request payloads that do not match the method schema
        ↓ Responses (5)
          ↓ MUST returns exactly one result response for a successful request
          ↓ MUST returns exactly one error response for a failed request
          ↓ SCHEMA preserves the request identifier in result responses
          ↓ SCHEMA preserves the request identifier in error responses
          ↓ MUST does not include both result and error in a response
        ↓ Notifications (3)
          ↓ MUST accepts notifications without an identifier
          ↓ MUST does not send a JSON-RPC response for a notification
          ↓ MUST rejects notification messages that include an identifier
        ↓ MUST does not accept JSON-RPC batch messages
        ↓ MUST returns a parse error for malformed JSON
        ↓ MUST returns an invalid request error for malformed JSON-RPC messages
      ↓ General fields (1)
        ↓ SCHEMA preserves additional metadata fields

    ↓ Transports (39)
      ↓ stdio (8)
        ↓ MUST reads UTF-8 JSON-RPC messages from stdin
        ↓ MUST writes UTF-8 JSON-RPC messages to stdout
        ↓ MUST delimits messages with newlines
        ↓ MUST does not emit embedded newlines inside a message
        ↓ MUST does not write non-MCP output to stdout
        ↓ MAY may write diagnostic output to stderr without corrupting the protocol stream
        ↓ SCENARIO processes consecutive messages independently
        ↓ MUST shuts down when the client closes stdin
      ↓ Streamable HTTP (31)
        ↓ Sending Messages to the Server (9)
          ↓ MUST accepts JSON-RPC requests through POST on the MCP endpoint
          ↓ MUST accepts JSON-RPC notifications through POST on the MCP endpoint
          ↓ MUST accepts JSON-RPC responses through POST on the MCP endpoint
          ↓ MUST requires the application/json content type for POST requests
          ↓ MUST requires clients to accept application/json and text/event-stream
          ↓ MUST returns application/json for a single JSON-RPC response
          ↓ MUST returns text/event-stream when streaming multiple messages
          ↓ MUST returns an empty 202 response for accepted notifications and responses
          ↓ MUST rejects unsupported HTTP methods with method not allowed
        ↓ Listening for Messages from the Server (4)
          ↓ MAY allows a client to open an SSE stream with GET
          ↓ MUST returns method not allowed for GET when the server does not offer an SSE stream
          ↓ MUST sends only JSON-RPC requests and notifications on the SSE stream
          ↓ MAY allows a client to close an SSE stream without closing its session
        ↓ Multiple Connections (3)
          ↓ MAY supports multiple simultaneous SSE streams for one session
          ↓ SCENARIO routes each server message to only one connected stream
          ↓ SCENARIO keeps messages from different sessions isolated
        ↓ Resumability and Redelivery (3)
          ↓ MAY assigns an event identifier to resumable SSE events
          ↓ MAY resumes after the last received event identifier
          ↓ MUST does not replay messages from a different stream
        ↓ Session Management (6)
          ↓ MUST returns an MCP session identifier during initialization
          ↓ MUST uses a globally unique and cryptographically secure session identifier
          ↓ MUST requires the session identifier on subsequent HTTP requests
          ↓ MUST rejects an unknown session identifier with not found
          ↓ MUST allows the client to terminate a session with DELETE
          ↓ MUST rejects requests for a terminated session
        ↓ Protocol Version Header (4)
          ↓ MUST requires the negotiated protocol version on subsequent HTTP requests
          ↓ MUST accepts a protocol version supported by the negotiated session
          ↓ MUST rejects an unsupported protocol version with bad request
          ↓ MUST returns the negotiated protocol version on responses
        ↓ Security (2)
          ↓ MUST validates the Origin header to prevent DNS rebinding attacks
          ↓ SHOULD binds local servers to localhost instead of all network interfaces by default

    ↓ Utilities (20)
      ↓ Ping (3)
        ↓ MUST responds to a client ping with an empty result
        ↓ MAY can send a ping to an initialized client
        ↓ SCENARIO keeps ping failures isolated to the unresponsive peer
      ↓ Cancellation (9)
        ↓ MUST accepts a cancellation notification for an in-flight request
        ↓ MUST uses the original request identifier in a cancellation notification
        ↓ MUST does not send a response to a cancellation notification
        ↓ SHOULD stops work on the cancelled request
        ↓ MUST does not return a successful response after cancellation
        ↓ MUST ignores cancellation for an unknown request identifier
        ↓ MUST ignores cancellation for an already completed request
        ↓ SCENARIO does not cancel unrelated concurrent requests
        ↓ MUST does not send cancellation notifications for initialize
      ↓ Progress (8)
        ↓ MUST accepts string progress tokens
        ↓ MUST accepts numeric progress tokens
        ↓ MUST echoes the requested token in progress notifications
        ↓ MUST associates progress notifications with only the originating request
        ↓ MUST does not emit progress when the request omitted a progress token
        ↓ MUST reports non-decreasing progress values
        ↓ SCHEMA preserves the optional total and message
        ↓ MUST does not reuse an active progress token for another request

    ↓ Tools (25)
      ↓ Capabilities (3)
        ↓ MUST advertises the tools capability when tools are registered
        ↓ MUST does not advertise the tools capability when no tools are registered
        ↓ MUST advertises listChanged only when tool list change notifications are supported
      ↓ Listing Tools (5)
        ↓ MUST lists every tool visible to the initialized client
        ↓ MUST returns an empty list when no tools are registered
        ↓ SCHEMA preserves tool names, titles, descriptions, annotations, and metadata
        ↓ MUST returns each tool input schema
        ↓ MUST returns each declared tool output schema
      ↓ Calling Tools (15)
        ↓ MUST calls a registered tool with valid arguments
        ↓ MUST rejects an unknown tool name
        ↓ MUST rejects arguments that do not match the input schema
        ↓ MUST does not invoke a tool handler when argument validation fails
        ↓ SCHEMA returns text content
        ↓ SCHEMA returns image content
        ↓ SCHEMA returns audio content
        ↓ SCHEMA returns resource links
        ↓ SCHEMA returns embedded resources
        ↓ MUST returns multiple content items in order
        ↓ SCHEMA returns structured content
        ↓ SCHEMA validates structured content against the output schema
        ↓ MUST returns tool execution failures with isError
        ↓ MUST keeps tool execution errors distinct from protocol errors
        ↓ SHOULD does not expose defects or internal error details
      ↓ List Changed Notification (2)
        ↓ SHOULD sends a tool list changed notification when the advertised list changes
        ↓ SHOULD does not send tool list changed notifications when listChanged is not advertised

    ↓ Resources (26)
      ↓ Capabilities (4)
        ↓ MUST advertises resources when resources or templates are registered
        ↓ MUST does not advertise resources when no resources or templates are registered
        ↓ MUST advertises subscribe only when resource subscriptions are supported
        ↓ MUST advertises listChanged only when resource list change notifications are supported
      ↓ Listing Resources (3)
        ↓ MUST lists every resource visible to the initialized client
        ↓ MUST returns an empty list when no resources are registered
        ↓ SCHEMA preserves resource URI, name, title, description, MIME type, size, annotations, and metadata
      ↓ Reading Resources (6)
        ↓ MUST reads text resource contents
        ↓ MUST reads binary resource contents as base64
        ↓ SCHEMA preserves the resource URI and MIME type in returned contents
        ↓ MUST returns multiple resource contents in order
        ↓ MUST returns the specified error for an unknown resource URI
        ↓ MUST does not return an empty contents array for a missing resource
      ↓ Resource Templates (5)
        ↓ MUST lists every registered resource template
        ↓ SCHEMA preserves template URI, name, title, description, MIME type and annotations
        ↓ MUST matches a concrete URI against its resource template
        ↓ MUST decodes template parameters before invoking the handler
        ↓ MUST does not invoke the handler when template parameter decoding fails
      ↓ List Changed Notification (2)
        ↓ SHOULD sends a resource list changed notification when the advertised list changes
        ↓ SHOULD does not send resource list changed notifications when listChanged is not advertised
      ↓ Subscriptions (6)
        ↓ MUST subscribes to updates for a resource URI when subscriptions are advertised
        ↓ MUST sends resource updated notifications only for subscribed resources
        ↓ MUST includes the updated resource URI in each notification
        ↓ MUST unsubscribes from updates for a resource URI
        ↓ MUST does not send updates after a resource is unsubscribed
        ↓ MUST rejects resource subscriptions when subscribe is not advertised

    ↓ Prompts (20)
      ↓ Capabilities (3)
        ↓ MUST advertises prompts when prompts are registered
        ↓ MUST does not advertise prompts when no prompts are registered
        ↓ MUST advertises listChanged only when prompt list change notifications are supported
      ↓ Listing Prompts (4)
        ↓ MUST lists every prompt visible to the initialized client
        ↓ MUST returns an empty list when no prompts are registered
        ↓ SCHEMA preserves prompt names, titles, descriptions, arguments, and metadata
        ↓ MUST marks required and optional prompt arguments correctly
      ↓ Getting Prompts (11)
        ↓ MUST gets a registered prompt without arguments
        ↓ MUST gets a registered prompt with valid arguments
        ↓ MUST rejects an unknown prompt name
        ↓ MUST rejects missing required prompt arguments
        ↓ MUST rejects prompt arguments with invalid values
        ↓ MUST does not invoke the prompt handler when argument validation fails
        ↓ SCHEMA preserves the prompt description and message order
        ↓ MUST returns text message content
        ↓ MUST returns image message content
        ↓ MUST returns audio message content
        ↓ MUST returns embedded resource message content
      ↓ List Changed Notification (2)
        ↓ SHOULD sends a prompt list changed notification when the advertised list changes
        ↓ SHOULD does not send prompt list changed notifications when listChanged is not advertised

    ↓ Completion (12)
      ↓ Capabilities (2)
        ↓ MUST advertises completions when argument completion is supported
        ↓ MUST does not advertise completions when argument completion is unsupported
      ↓ Requesting Completions (10)
        ↓ MUST completes a prompt argument
        ↓ MUST completes a resource template argument
        ↓ MUST passes previously resolved argument context to the completion handler
        ↓ MUST rejects an unknown prompt reference
        ↓ MUST rejects an unknown resource template reference
        ↓ MUST rejects an unknown argument name
        ↓ MUST returns completion values in order
        ↓ MUST returns the total number of available completion values
        ↓ MUST reports when additional completion values are available
        ↓ MUST returns at most one hundred completion values

    ↓ Logging (11)
      ↓ Capabilities (2)
        ↓ MUST advertises logging when log notifications are supported
        ↓ MUST does not advertise logging when log notifications are unsupported
      ↓ Setting Log Level (5)
        ↓ MUST accepts every specified log level
        ↓ MUST rejects an unknown log level
        ↓ SHOULD updates the minimum level for subsequent log notifications
        ↓ SHOULD sends notifications at the selected level and higher
        ↓ MUST does not send notifications below the selected level
      ↓ Log Message Notifications (4)
        ↓ SCHEMA preserves the log level, logger name, and data
        ↓ MUST allows arbitrary JSON-compatible log data
        ↓ MUST does not send a response for a log message notification
        ↓ SCENARIO does not corrupt the stdio protocol stream with log output

    ↓ Pagination (11)
      ↓ Pagination Model (7)
        ↓ MUST treats cursors as opaque strings
        ↓ MUST starts from the first page when the request omits a cursor
        ↓ MUST returns a next cursor when another page is available
        ↓ MUST uses the next cursor to retrieve the following page
        ↓ MUST omits the next cursor after the final page
        ↓ SCENARIO does not duplicate or omit items while traversing pages
        ↓ MUST returns an appropriate error for an invalid cursor
      ↓ Paginated Operations (4)
        ↓ MUST paginates tools/list
        ↓ MUST paginates resources/list
        ↓ MUST paginates resources/templates/list
        ↓ MUST paginates prompts/list

    ↓ Roots (11)
      ↓ Capabilities (3)
        ↓ MUST sends roots requests only when the client advertises roots
        ↓ MUST does not send roots requests when the client omits the roots capability
        ↓ MUST observes whether the client advertises roots list changes
      ↓ Listing Roots (5)
        ↓ MUST requests the client's roots
        ↓ MUST accepts roots with file URIs
        ↓ MAY preserves optional root names
        ↓ MAY accepts an empty roots list
        ↓ MUST surfaces client errors returned by roots/list
      ↓ Root List Changes (3)
        ↓ SHOULD accepts roots list changed notifications from capable clients
        ↓ SHOULD refreshes roots after a roots list changed notification
        ↓ MUST does not rely on roots as an authorization boundary

    ↓ Sampling (10)
      ↓ Capabilities (2)
        ↓ MUST sends sampling requests only when the client advertises sampling
        ↓ MUST does not send sampling requests when the client omits the sampling capability
      ↓ Creating Messages (8)
        ↓ MUST sends the requested message history in order
        ↓ SCHEMA preserves the system prompt and model preferences
        ↓ SCHEMA preserves maximum tokens, stop sequences, metadata, and context inclusion
        ↓ MUST accepts text sampling content
        ↓ MUST accepts image sampling content
        ↓ MUST accepts audio sampling content
        ↓ MUST decodes the selected model, role, content, and stop reason
        ↓ MUST surfaces sampling errors returned by the client

    ↓ Elicitation (9)
      ↓ Capabilities (2)
        ↓ MUST sends elicitation requests only when the client advertises elicitation
        ↓ MUST does not send elicitation requests when the client omits the elicitation capability
      ↓ Form Mode (6)
        ↓ MUST sends a message and requested schema
        ↓ SCHEMA limits requested schemas to supported primitive form fields
        ↓ MUST decodes accepted content against the requested schema
        ↓ MUST returns a typed failure when the user declines
        ↓ MUST interrupts the operation when the user cancels
        ↓ MUST rejects accepted content that does not match the requested schema
      ↓ Security (1)
        ↓ MUST does not request sensitive information through form mode

 Test Files  13 (1 implemented | 12 skipped)
      Tests  222 (10 implemented | 212 skipped)

At the moment this is only for 2025-06-18 and the ones added for the Lifecycle are for 2025-11-25 so what we might need to do is move a lot of these into a shared suite which can then be run based on the ProtocolAdaptor:

export const suite = (
  protocol: McpProtocol.ProtocolAdapter
) => {
  const serverLayer = makeServerLayer({
    name: "McpServerTest",
    protocols: [protocol]
  })

  const makeHarness = makeRawHttpHarness(serverLayer)

  describe(`McpServer (${protocol.protocolVersion})`, () => {
    describe("Lifecycle", () => {
      // Shared lifecycle tests
    })

    describe("Base Protocol", () => {
      // Shared JSON-RPC tests
    })
  })
}

McpServerTest.suite(McpProtocol.v2025_06_18)
// McpServerTest.suite(McpProtocol.v2025_11_25)
// McpServerTest.suite(McpProtocol.v2026_07_28)

But this will be easier to split up once the other protocol is implemented (#6157) in a composable way.

For now if anything looks off about the test suite for 2025-06-18 at a high level it would be good to make changes now before writing all 200 tests 😬


Comformance Todos

Gaps

  • fix: Normalize JSON-RPC envelope errors
  • fix: Return protocol errors for invalid MCP requests
  • fix: Redact internal tool defects
  • fix: Enforce initialization lifecycle responses
  • fix: Validate Streamable HTTP requests
  • fix: Apply revision-specific batch and header behavior
  • fix: Complete logging capability and filtering
  • fix: Validate resource-template parameters before invocation
  • fix: Complete completion context and limits
  • fix: Project sampling requests and results faithfully
  • fix: Suppress responses after cancellation

Enhancements

  • feat: Add resource subscriptions
  • feat: Expose tool output schemas
  • feat: Refresh roots after client root changes

Activity

  1. IMax153 commented on Jul 25, 2026

    @IMax153
    Member

    This looks good to me - the only thing I would suggest that you consider is how to handle changes in the specification between protocol versions (i.e. things that would not make sense as part of a shared suite)

  2. lloydrichards commented on Jul 25, 2026

    @lloydrichards
    ContributorAuthor

    If I do the same way I've tried in #6555 then it would end up with some file structure like:

    packages/effect/test/unstable/ai/
    ├── McpConformance/
    │   ├── utils.ts
    │   ├── v2025-06-18.test.ts    <- run test suite + specific
    │   ├── v2025-11-25.test.ts    <- run test suite + specific
    │   ├── McpConformanceTest.ts  <- shared test suite
    │   ╰── base/
    │       ├── LifecycleTest.ts
    │       ├── TransportsTest.ts
    │       ╰── ...
    ╰── McpServer.test.ts

    Kind of depends how much can be shared between the suites and how much is unique. Ideally the tests should be behavioral and not implementation so as long as the spec expects the same thing then the suite can just swap out the harness

  3. IMax153 commented on Jul 25, 2026

    @IMax153
    Member

    Yea that is fine, my point is that the suite helper here may become thinner and thinner over time if different spec versions deviate significantly from one another, but again I don't know how much really changes in a breaking way between MCP spec versions.

  4. lloydrichards commented on Jul 27, 2026

    @lloydrichards
    ContributorAuthor

    I set sol up last night on a loop to implement all the tests after adapting the test harness:

    Mcp Conformance suite implementation
     → classify each test
       ├─ → shared suite
       ├─ → version v entrypoint
       ├┄ ⇢ conditional test
       └┄ ⇢ unsupported / exclude
     → implement
     → validate: types ∩ lint ∩ runtime
       ├─ pass → report covered requirements
       └─ fail ⇢ implementation gap → FIX comment + skip
     ↺ next section
    

    And it spat back 4k loc across 208 tests -> 167 passing, 22 skipped, and 19 which would need attention:

    Full Vitest
    ✓  effect  test/unstable/ai/McpServer/v2025_06_18.test.ts (167 tests | 41 skipped) 150ms
       ✓ Mcp Conformance (2025-06-18) (10)
         ✓ Lifecycle (10)
           ✓ Lifecycle Phases (9)
             ✓ Initialization (5)
               ✓ MUST requires initialize to be the first request 6ms
               ✓ MUST rejects initialized notifications before initialize 0ms
               ✓ SCHEMA requires protocolVersion, capabilities, and clientInfo 5ms
               ✓ SCHEMA returns server capabilities and implementation information 2ms
               ✓ MUST accepts initialized after a successful initialize response 1ms
             ✓ Version Negotiation (2)
               ✓ MUST echoes a requested version supported by the server 1ms
               ✓ MUST negotiates an unsupported requested version to a supported version 1ms
             ✓ Capability Negotiation (1)
               ✓ SCHEMA advertises the capabilities provided by the server 7ms
             ✓ Operation (1)
               ✓ MUST continues to use the version negotiated during initialization 1ms
           ✓ Error Handling (1)
             ✓ SCENARIO handles protocol version mismatch through version negotiation 1ms
       ✓ Mcp Conformance (2025-06-18) (14)
         ✓ Base Protocol (14)
           ✓ Messages (13)
             ✓ Requests (5)
               ✓ SCHEMA accepts JSON-RPC 2.0 requests with string identifiers 4ms
               ✓ SCHEMA accepts JSON-RPC 2.0 requests with numeric identifiers 1ms
               ↓ MUST rejects requests with an invalid JSON-RPC version
               ↓ MUST returns method not found for unknown request methods
               ↓ MUST returns invalid params for request payloads that do not match the method schema
             ✓ Responses (5)
               ✓ MUST returns exactly one result response for a successful request 1ms
               ✓ MUST returns exactly one error response for a failed request 1ms
               ✓ SCHEMA preserves the request identifier in result responses 1ms
               ✓ SCHEMA preserves the request identifier in error responses 1ms
               ✓ MUST does not include both result and error in a response 1ms
             ✓ Notifications (1)
               ✓ MUST accepts notifications without an identifier and sends no response 0ms
             ↓ MUST returns a parse error for malformed JSON
             ↓ MUST returns an invalid request error for malformed JSON-RPC messages
           ✓ General fields (1)
             ✓ SCHEMA preserves additional result metadata fields 0ms
       ✓ Mcp Conformance (2025-06-18) (25)
         ✓ Transports (25)
           ✓ stdio (4)
             ✓ MUST exchange compact UTF-8 newline-delimited JSON-RPC records 2ms
             ✓ SCENARIO processes consecutive stdio messages independently 2ms
             ✓ SCENARIO applies the revision-specific stdio batch policy 1ms
             ✓ MUST shut down when the client closes stdin 0ms
           ✓ Streamable HTTP (21)
             ✓ Sending Messages to the Server (8)
               ✓ MUST accept JSON-RPC requests through POST on the MCP endpoint 1ms
               ✓ MUST accept JSON-RPC notifications through POST on the MCP endpoint 1ms
               ✓ MUST accept JSON-RPC responses through POST on the MCP endpoint 1ms
               ✓ MUST require the application/json content type for POST requests 1ms
               ✓ MUST require clients to accept application/json and text/event-stream 1ms
               ✓ MUST return application/json for a single JSON-RPC response 0ms
               ✓ MUST return an empty 202 response for accepted notifications and responses 1ms
               ✓ MUST reject unsupported HTTP methods with method not allowed 0ms
             ✓ Listening for Messages from the Server (1)
               ✓ MUST return method not allowed when GET SSE is not offered 0ms
             ✓ Session Management (7)
               ✓ MAY return an MCP session identifier during initialization 0ms
               ✓ SHOULD use distinct cryptographically generated UUID session identifiers 1ms
               ✓ MUST require the returned session identifier on subsequent HTTP requests 0ms
               ✓ MUST reject an unknown session identifier with not found 0ms
               ✓ MAY decline client session termination without invalidating the session 1ms
               ✓ MUST reject initialize requests carrying a session identifier 0ms
               ✓ SCENARIO keeps two distinct POST sessions live 1ms
             ✓ Protocol Version Header (4)
               ✓ MUST apply the revision-specific protocol header requirement 0ms
               ✓ MUST accept the negotiated protocol version 1ms
               ✓ MUST reject an unsupported protocol version with bad request 0ms
               ✓ SCENARIO replays the selected protocol version on HTTP responses 1ms
             ✓ Security (1)
               ✓ MUST validate the Origin header before every MCP route 1ms
       ✓ Mcp Conformance (2025-06-18) (9)
         ✓ Utilities (9)
           ✓ Ping (1)
             ✓ MUST responds to a client ping with an empty result 2ms
           ✓ Cancellation (5)
             ✓ MUST does not send a response to a cancellation notification 1ms
             ↓ SHOULD stops work on the cancelled request
             ↓ SHOULD does not return a response after cancellation
             ✓ SHOULD ignores cancellation for an unknown request identifier 1ms
             ✓ SHOULD ignores cancellation for an already completed request identifier 1ms
           ✓ Progress (3)
             ✓ MUST accepts string progress tokens 1ms
             ✓ MUST accepts numeric progress tokens 1ms
             ✓ SCHEMA accepts the optional total 0ms
       ✓ Mcp Conformance (2025-06-18) (24)
         ✓ Tools (24)
           ✓ Capabilities (3)
             ✓ MUST advertise the tools capability when tools are registered 4ms
             ✓ MUST NOT advertise the tools capability when tools are not supported 1ms
             ✓ MUST advertise listChanged when tool list change notifications are supported 0ms
           ✓ Listing Tools (4)
             ✓ MUST list every tool visible to the initialized client 2ms
             ✓ SCHEMA preserves tool names and descriptions 1ms
             ✓ MUST return each tool input schema 1ms
             ↓ MUST return each declared tool output schema
           ✓ Calling Tools (15)
             ✓ MUST call a registered tool with valid arguments 3ms
             ✓ MUST reject an unknown tool name with a protocol error 1ms
             ↓ MUST reject arguments that do not match the input schema with a protocol error
             ✓ MUST not invoke a tool handler when argument validation fails 1ms
             ✓ SCHEMA returns text content 1ms
             ✓ SCHEMA returns image content 1ms
             ✓ SCHEMA returns audio content 1ms
             ✓ SCHEMA returns resource links 1ms
             ✓ SCHEMA returns embedded resources 1ms
             ✓ MUST return multiple content items in order 1ms
             ✓ SCHEMA returns structured content 1ms
             ✓ SCHEMA validates structured content against the output schema 1ms
             ✓ MUST return tool execution failures with isError 1ms
             ✓ MUST keep tool execution errors distinct from protocol errors 1ms
             ↓ SHOULD not expose defects or internal error details
           ↓ List Changed Notification (2)
             ↓ SHOULD sends a tool list changed notification when the advertised list changes
             ↓ SHOULD does not send tool list changed notifications when listChanged is not advertised
       ✓ Mcp Conformance (2025-06-18) (22)
         ✓ Resources (22)
           ✓ Capabilities (4)
             ✓ MUST advertise resources when resources are registered 2ms
             ✓ MUST NOT advertise resources when resources are not supported 1ms
             ✓ MUST NOT advertise resource subscriptions when they are unsupported 0ms
             ✓ MUST advertise listChanged when resource list change notifications are supported 0ms
           ✓ Listing Resources (2)
             ✓ MUST list every resource visible to the initialized client 1ms
             ✓ SCHEMA preserves resource URI, name, description, and MIME type 1ms
           ✓ Reading Resources (5)
             ✓ MUST read text resource contents 1ms
             ✓ MUST read binary resource contents as base64 1ms
             ✓ SCHEMA preserves the resource URI and MIME type in returned contents 1ms
             ✓ MUST return multiple resource contents in order 1ms
             ↓ SHOULD return resource not found for an unknown resource URI
           ✓ Resource Templates (3)
             ✓ MUST list every registered resource template 1ms
             ✓ MUST match and decode a concrete resource-template URI 1ms
             ↓ MUST not invoke the handler when template parameter decoding fails
           ↓ List Changed Notification (2)
             ↓ SHOULD sends a resource list changed notification when the advertised list changes
             ↓ SHOULD does not send resource list changed notifications when listChanged is not advertised
           ↓ Subscriptions (6)
             ↓ MUST subscribes to updates for a resource URI when subscriptions are advertised
             ↓ MUST sends resource updated notifications only for subscribed resources
             ↓ MUST includes the updated resource URI in each notification
             ↓ MUST unsubscribes from updates for a resource URI
             ↓ MUST does not send updates after a resource is unsubscribed
             ↓ MUST reject resource subscriptions when subscribe is not advertised
       ✓ Mcp Conformance (2025-06-18) (19)
         ✓ Prompts (19)
           ✓ Capabilities (3)
             ✓ MUST advertise prompts when prompts are registered 4ms
             ✓ MUST NOT advertise prompts when prompts are not supported 1ms
             ✓ MUST advertise listChanged when prompt list change notifications are supported 1ms
           ✓ Listing Prompts (3)
             ✓ MUST list every prompt visible to the initialized client 2ms
             ✓ SCHEMA preserves prompt names, descriptions, and arguments 1ms
             ✓ MUST mark required and optional prompt arguments correctly 1ms
           ✓ Getting Prompts (11)
             ✓ MUST get a registered prompt without arguments 1ms
             ✓ MUST get a registered prompt with valid arguments 1ms
             ✓ SHOULD reject an unknown prompt name with Invalid Params 1ms
             ✓ SHOULD reject missing required prompt arguments with Invalid Params 1ms
             ↓ SHOULD reject prompt arguments with invalid values
             ✓ MUST not invoke the prompt handler when argument validation fails 1ms
             ✓ SCHEMA preserves the prompt description and message order 1ms
             ✓ MUST return text message content 1ms
             ✓ MUST return image message content 1ms
             ✓ MUST return audio message content 1ms
             ✓ MUST return embedded resource message content 1ms
           ↓ List Changed Notification (2)
             ↓ SHOULD sends a prompt list changed notification when the advertised list changes
             ↓ SHOULD does not send prompt list changed notifications when listChanged is not advertised
       ✓ Mcp Conformance (2025-06-18) (9)
         ✓ Completion (9)
           ✓ Capabilities (1)
             ✓ MUST advertise completions when argument completion is supported 2ms
           ✓ Requesting Completions (8)
             ✓ MUST complete a prompt argument 1ms
             ✓ MUST complete a resource template argument 1ms
             ↓ MUST pass previously resolved argument context to the completion handler
             ↓ SHOULD reject an unknown prompt reference with Invalid Params
             ↓ MUST reject an unknown argument name
             ✓ MUST return completion values in order 1ms
             ✓ SCHEMA returns the total and additional-results indicator 1ms
             ✓ MUST return at most one hundred completion values 1ms
       ✓ Mcp Conformance (2025-06-18) (10)
         ✓ Logging (10)
           ↓ Capabilities (1)
             ↓ MUST advertise logging when log notifications are supported
           ✓ Setting Log Level (5)
             ✓ MUST accept every specified log level 6ms
             ↓ MUST reject an unknown log level
             ✓ SHOULD update the minimum level for subsequent operations 3ms
             ↓ SHOULD sends notifications at the selected level and higher
             ↓ MUST does not send notifications below the selected level
           ✓ Log Message Notifications (4)
             ✓ SCHEMA preserves the log level, logger name, and data 0ms
             ✓ MUST allow arbitrary JSON-compatible log data 0ms
             ↓ MUST does not send a response for a log message notification
             ↓ SCENARIO does not corrupt the stdio protocol stream with log output
       ✓ Mcp Conformance (2025-06-18) (8)
         ✓ Roots (8)
           ✓ Capabilities (3)
             ✓ MUST send roots requests when the client advertises roots 1ms
             ✓ MUST NOT send roots requests when the client omits the roots capability 0ms
             ✓ MUST accept roots requests when the client advertises list changes 0ms
           ✓ Listing Roots (3)
             ✓ MUST accept roots with file URIs and preserve optional names 0ms
             ✓ MAY accept an empty roots list 0ms
             ✓ MUST surface client errors returned by roots/list 0ms
           ↓ Root List Changes (2)
             ↓ SHOULD accepts roots list changed notifications from capable clients
             ↓ SHOULD refreshes roots after a roots list changed notification
       ✓ Mcp Conformance (2025-06-18) (7)
         ✓ Sampling (7)
           ✓ Capabilities (2)
             ✓ MUST send sampling requests when the client advertises sampling 1ms
             ✓ MUST NOT send sampling requests when the client omits the sampling capability 0ms
           ✓ Creating Messages (5)
             ↓ MUST preserve message order and sampling request options
             ✓ MUST accept and decode text sampling content 0ms
             ✓ MUST accept image sampling content 1ms
             ✓ MUST accept audio sampling content 1ms
             ✓ MUST surface sampling errors returned by the client 1ms
       ✓ Mcp Conformance (2025-06-18) (7)
         ✓ Elicitation (7)
           ✓ Capabilities (2)
             ✓ MUST send elicitation requests when the client advertises elicitation 1ms
             ✓ MUST NOT send elicitation requests when the client omits the elicitation capability 0ms
           ✓ Form Mode (5)
             ✓ MUST send the message and requested primitive form schema 0ms
             ↓ MUST decode accepted content against the requested schema
             ↓ MUST return a typed failure when the user declines
             ↓ MUST interrupt the operation when the user cancels
             ↓ MUST reject accepted content that does not match the requested schema
       ✓ Mcp Conformance (2025-06-18) (3)
         ✓ Utilities (1)
           ✓ Progress (1)
             ✓ SCHEMA accepts the optional progress message 1ms
         ✓ Transport-specific behavior (2)
           ✓ MUST reject JSON-RPC batches 0ms
           ✓ MUST require the negotiated protocol-version header after initialization 0ms
    
     Test Files  1 passed (1)
          Tests  126 passed | 41 skipped (167)
       Start at  08:36:03
       Duration  1.21s (transform 748ms, setup 526ms, import 443ms, tests 150ms, environment 0ms)

    I still need to independently go through all this and check the implementation and cross check the issues but there might be some real issues that can be addressed in tandum:

    Test Observed behavior Expected behavior
    Base protocol: MUST reject requests with an invalid JSON-RPC version Accepts jsonrpc: "1.0" and successfully handles ping. Reject the request as Invalid Request -32600.
    Base protocol: MUST return Method Not Found for unknown request methods Unknown methods return error code 0. Return Method Not Found -32601.
    Base protocol: MUST return Invalid Params for payloads that do not match the method schema Invalid method parameters return error code 0. Return Invalid Params -32602.
    Base protocol: MUST return a parse error for malformed JSON Malformed JSON becomes Internal Error -32603. Return Parse Error -32700 with a null identifier.
    Base protocol: MUST return Invalid Request for malformed JSON-RPC messages A JSON-RPC object without method receives an empty response. Return Invalid Request -32600.
    Tools: MUST reject arguments that do not match the input schema with a protocol error Tool argument-schema failures return a successful result with isError: true. Reject invalid invocation parameters with JSON-RPC -32602.
    Prompts: SHOULD reject prompt arguments with invalid values Invalid prompt argument values return error code 0. Return Invalid Params -32602.
    Logging: MUST reject an unknown log level An unknown log level returns error code 0. Return Invalid Params -32602.
    Tools: SHOULD not expose defects or internal error details Handler defects are included verbatim in the JSON-RPC error message and data. Return a sanitized internal failure without defect details.
    Resources: SHOULD return Resource Not Found for an unknown resource URI Unknown resource URIs return generic Invalid Params -32602. Return the resource-specific Resource Not Found error -32002.
    Resources: MUST not invoke the handler when template parameter decoding fails A resource-template handler runs even when a URI parameter cannot be decoded. Reject before invoking user code.
    Resources: MUST reject subscriptions when subscribe is not advertised resources/subscribe succeeds even though subscriptions are not advertised. Reject operations for an unadvertised capability.
    Completion: SHOULD reject an unknown prompt reference with Invalid Params An unknown prompt reference produces a successful empty completion. Reject the unknown reference with Invalid Params.
    Completion: MUST reject an unknown argument name An unknown argument name produces a successful empty completion. Reject the unknown argument.
    Logging: MUST advertise logging when log notifications are supported logging/setLevel is implemented but logging is absent from server capabilities. Advertise logging support when the operation is available.
    Tools: MUST return each declared tool output schema Structured tool success schemas are not projected to outputSchema. Return each declared output schema in tools/list.
    Completion: MUST pass previously resolved argument context to the completion handler The handler receives only the current value; context.arguments is dropped. Pass previously resolved arguments to the handler.
    Sampling: MUST preserve message order and sampling request options Dated adapters reject canonical requests containing the specified optional sampling fields. Project message order, model preferences, prompt, context, stop sequences, and metadata.
    Elicitation: MUST decode accepted content against the requested schema McpServer.elicit generates additionalProperties: false, which the June adapter rejects before sending. Represent the generated form schema and decode accepted content.
    Elicitation: MUST return a typed failure when the user declines The request is rejected before the client can decline it. Convert a client decline response into the typed elicitation failure.
    Elicitation: MUST interrupt the operation when the user cancels The request is rejected before the client can cancel it. Interrupt the server operation after a client cancel response.
    Elicitation: MUST reject accepted content that does not match the requested schema The request is rejected before mismatched accepted content can be validated. Reject accepted content that fails the caller-provided schema.

    after I clean up the slop, I can add this as a draft pr for you to check and see if this feels good

  5. IMax153 commented on Jul 27, 2026

    @IMax153
    Member

    Sick! Yea that sounds good to me - thanks for working on this, going to make it much easier to be sure we're covering our bases in the spec.

  6. lloydrichards commented on Jul 27, 2026

    @lloydrichards
    ContributorAuthor

    Since this stacks on top of #6625, I have the draft pr in my open_effect repo: lloydrichards#1 so its easier to isolate (can create another PR later)

    There is a lot of llm written code in here but also a decent amount of review looking and validating assumptions so I'm not sure how best to present this for review. I could setup some loop to go through breaking the tests through production code changes to validate failures (next trust a test you haven't seen fail) and present this with the PR or it might be better for the reviewer to do something similar with their own coding harness to challenge and validate.

    open to suggestions/preferences

  7. lloydrichards commented on Jul 28, 2026

    @lloydrichards
    ContributorAuthor

    What I've been able to pull out from the Conformance suite is 14 areas/issues that are currently missing and where the suite currently skips the checks. I'll add all the detail below and then if you want to make individual issues to be tackled separately then it should be easy.

    Focused suite baseline: 112 passed, 45 skipped. Each item below groups tests that appear to have one coherent user-facing outcome.

    fix: Normalize JSON-RPC envelope errors

    Problem

    Malformed JSON-RPC messages, invalid JSON-RPC versions, and unknown methods do not consistently produce the required JSON-RPC error code and response shape.

    Failing test

    Base Protocol > Messages > Requests > MUST reject requests with an invalid JSON-RPC version
    Base Protocol > Messages > Requests > MUST return method not found for unknown request methods
    Base Protocol > Messages > Requests > MUST return invalid params for request payloads that do not match the method schema
    Base Protocol > Messages > MUST return a parse error for malformed JSON
    Base Protocol > Messages > MUST return an invalid request error for malformed JSON-RPC messages
    

    Proposed solution

    Make the protocol boundary consistently recognize malformed envelopes and map them to the standard JSON-RPC parse, invalid-request, method-not-found, and invalid-params errors.

    fix: Return protocol errors for invalid MCP requests

    Problem

    Invalid tool, prompt, completion, resource, and logging requests are often represented as success, a tool result, or an error with code 0 rather than their MCP/JSON-RPC error.

    Failing test

    Completion > Requesting Completions > SHOULD reject an unknown prompt reference with Invalid Params
    Completion > Requesting Completions > MUST reject an unknown argument name
    Logging > Setting Log Level > MUST reject an unknown log level
    Prompts > Getting Prompts > SHOULD reject an unknown prompt name with Invalid Params
    Prompts > Getting Prompts > SHOULD reject missing required prompt arguments with Invalid Params
    Prompts > Getting Prompts > SHOULD reject prompt arguments with invalid values
    Resources > Reading Resources > SHOULD return resource not found for an unknown resource URI
    Tools > Calling Tools > MUST reject an unknown tool name with a protocol error
    Tools > Calling Tools > MUST reject arguments that do not match the input schema with a protocol error
    Tools > Errors > MUST keep tool execution errors distinct from protocol errors
    

    Proposed solution

    Map invalid request inputs and unknown registered names to the appropriate protocol errors, while retaining ordinary tool execution failures as tool results.

    fix: Redact internal tool defects

    Problem

    Unhandled tool defects currently expose internal details through the JSON-RPC error message and data.

    Failing test

    Tools > Errors > SHOULD not expose defects or internal error details
    

    Proposed solution

    Return a stable public protocol error for defects without exposing implementation details.

    fix: Enforce initialization lifecycle responses

    Problem

    Requests and initialized notifications sent before initialization currently receive a missing-session 404 instead of the required pre-initialization rejection.

    Failing test

    Lifecycle > Lifecycle Phases > Initialization > MUST reject non-ping requests before initialize
    Lifecycle > Lifecycle Phases > Initialization > MUST reject initialized notifications before initialize
    

    Proposed solution

    Handle the pre-initialization state explicitly so unsupported messages receive the required lifecycle response.

    fix: Validate Streamable HTTP requests

    Problem

    The Streamable HTTP route does not yet enforce required content negotiation, session lifecycle, negotiated-version, or Origin validation rules.

    Failing test

    Transports > Streamable HTTP > Sending Messages to the Server > MUST require the application/json content type for POST requests
    Transports > Streamable HTTP > Sending Messages to the Server > MUST require clients to accept application/json and text/event-stream
    Transports > Streamable HTTP > Session Management > MUST require the returned session identifier on subsequent HTTP requests
    Transports > Streamable HTTP > Session Management > MUST reject initialize requests carrying a session identifier
    Transports > Streamable HTTP > Protocol Version Header > MUST apply the revision-specific protocol header requirement
    Transports > Streamable HTTP > Security > MUST validate the Origin header before every MCP route
    

    Proposed solution

    Apply the MCP HTTP validation rules consistently before dispatching requests.

    fix: Apply revision-specific batch and header behavior

    Problem

    The June 2025 protocol revision removed JSON-RPC batches and requires the negotiated protocol-version header after initialization; both remain accepted today.

    Failing test

    Transports > stdio > SCENARIO applies the revision-specific stdio batch policy
    Transport-specific behavior > MUST reject JSON-RPC batches
    Transport-specific behavior > MUST require the negotiated protocol-version header after initialization
    

    Proposed solution

    Keep batch and protocol-header rules owned by the selected protocol revision and enforce the June behavior at its transport boundary.

    fix: Complete logging capability and filtering

    Problem

    The server can emit log notifications, but does not advertise logging, returns an invalid set-level result shape, and does not filter emitted logs by the client-selected threshold.

    Failing test

    Logging > Capabilities > MUST advertise logging when log notifications are supported
    Logging > Setting Log Level > MUST accept every specified log level
    Logging > Setting Log Level > SHOULD send notifications at the selected level and higher
    Logging > Setting Log Level > MUST not send notifications below the selected level
    

    Proposed solution

    Advertise logging when available and make logging/setLevel control the visible notifications for that client.

    feat: Add resource subscriptions

    Problem

    Resource subscriptions are deliberately unsupported: adapters advertise subscribe: false, there is no session-scoped subscription state, and updates are broadcast rather than filtered by URI.

    Failing test

    Resources > Subscriptions > MUST subscribe to a resource when subscriptions are advertised
    Resources > Subscriptions > MUST send update notifications only for subscribed resources
    Resources > Subscriptions > MUST unsubscribe from resource updates
    Resources > Subscriptions > MUST not send updates after a resource is unsubscribed
    

    Proposed solution

    Introduce explicit per-session resource subscription state, subscribe/unsubscribe operations, and URI-filtered update delivery; advertise the capability only when that behavior is present.

    fix: Validate resource-template parameters before invocation

    Problem

    An invalid resource-template path parameter reaches the registered handler instead of being rejected during decoding.

    Failing test

    Resources > Resource Templates > MUST not invoke the handler when template parameter decoding fails
    

    Proposed solution

    Decode and validate template parameters before invoking the resource handler.

    feat: Expose tool output schemas

    Problem

    Tool registration and Toolkit integration expose structured tool results but not the corresponding MCP outputSchema.

    Failing test

    Tools > Listing Tools > MUST return each declared tool output schema
    

    Proposed solution

    Derive and project compatible object-shaped Toolkit success schemas as MCP tool output schemas.

    fix: Complete completion context and limits

    Problem

    The completion handler does not receive the resolved argument context, and completion results can exceed the protocol’s one-hundred-value limit.

    Failing test

    Completion > Requesting Completions > MUST pass previously resolved argument context to the completion handler
    Completion > Requesting Completions > MUST return at most one hundred completion values
    

    Proposed solution

    Preserve the protocol completion context at the public handler boundary and enforce the result-size limit.

    fix: Project sampling requests and results faithfully

    Problem

    Sampling rejects valid optional model preferences and loses required role/content fields while decoding text, image, and audio responses.

    Failing test

    Sampling > Creating Messages > MUST preserve message order and sampling request options
    Sampling > Creating Messages > MUST accept and decode text sampling content
    Sampling > Creating Messages > MUST accept image sampling content
    Sampling > Creating Messages > MUST accept audio sampling content
    

    Proposed solution

    Align sampling request composition and response projection with the MCP sampling schema for all supported content types.

    fix: Suppress responses after cancellation

    Problem

    Cancellation interrupts the handler but the server still emits a response for the cancelled request.

    Failing test

    Utilities > Cancellation > SHOULD stop work and suppress the response after cancellation
    

    Proposed solution

    Treat cancellation as terminal for the request’s response path once interruption has been observed.

    feat: Refresh roots after client root changes

    Problem

    The server has no observable refresh or invalidation behavior when a capable client reports that its root list changed.

    Failing test

    Roots > List Changed > SHOULD refresh roots after a capable client reports a list change
    

    Proposed solution

    Define one observable roots-refresh policy and apply it after the client’s list-change notification.

  8. IMax153 commented on Jul 28, 2026

    @IMax153
    Member

    Let's just make a TODO list in this issue with these remaining items that we need to address and tackle them in the linked PR as individual commits if that works for you.

  9. lloydrichards commented on Jul 28, 2026

    @lloydrichards
    ContributorAuthor

    do you want me to touch McpSchema to fix these? just cause the PR is already 4k+ loc and want to make the fixes as easy as possible to review. Github can turn the Todos (added to description) into issues quickly if it can be addressed seperately

  10. IMax153 commented on Jul 28, 2026

    @IMax153
    Member

    As long as each TODO is a separate commit, I can review relatively easily - the diff is only so long because of all the new test suites, which is fine.

  11. lloydrichards commented on Jul 28, 2026

    @lloydrichards
    ContributorAuthor

    Just waiting for codeRabbit now but I managed to get 100% conformance (by my test suites at least) for the current 'McpSchema'

    Should be ready to review unless I get any wacky comments back from ci

  12. IMax153 commented on Jul 28, 2026

    @IMax153
    Member

    Just waiting for codeRabbit now

    Looks like CodeRabbit had a lot to say lol - I'll let you look over its feedback and either implement fixes or respond, and then feel free to ping me for a review on the PR itself 👍

  13. lloydrichards commented on Jul 29, 2026

    @lloydrichards
    ContributorAuthor

    there were a few valid nit picks and a few red herrings, but i've managed to keep it happy. There is a blocker on the missing pagination tests, but i've added the explanation on their removal in the comment. Should be ready for review now 🤞

    edit: what a picky rabbit 😵

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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