Skip to content

MCP: Test protocol and OAuth behavior over HTTP #2626

Open

Description

@erichare

Prove that the packaged service follows the agreed MCP and OAuth contracts by testing HTTP requests and responses directly. This catches mistakes that a shared client and server library could hide. It is required for the launch in #2408.

Cover valid first requests, tool listing and calls, rejected protocol versions, malformed requests, and authorization failures. Also prove that an unauthenticated client can retrieve the metadata needed to begin OAuth sign-in. The MCP endpoint's GET restriction must leave metadata GET available.

This ticket is done when the checks pass against the packaged artifact and can be reused against the public deployment in #2634. The default smoke path should require no database writes. Implementation belongs to #2625 and #2642. Full client sign-in is tested in #2633.

Status on October 23, 2026

PR #2644 merged with the first raw HTTP test. PR #2659 grows McpProtocolTest to 33 protocol tests that check the 2026-07-28 wire contract over raw HTTP. With the framework set back to 2.0.3, 17 of them fail, so they depend on the upgrade in the same PR. Its unit suite passed 3,648 tests locally, and CI is still running the DSE and HCD suites. PRs #2648 and #2649 add HTTP coverage for logging and tool hints in the MCP stack, and draft PR #2657 covers Origin checks for #2630. The OAuth admission tests still depend on #2642.

Implementation requirements and source references

Tracking issue: #2408. Depends on #2624, #2625 and #2642.

Tracking correspondence: L2 packaged verification, H1/H6 protected-resource failures. Implementation owners are #2625 and #2642. Shared requirement IDs remain stable across the delivery plan and #2408.

Outcome

Test raw HTTP so a shared mistake in the framework client and server cannot hide a protocol failure. Scope is the existing tool surface under MCP 2026-07-28 minimum and OAuth-only authentication. Optional features stay unadvertised unless implemented.

Required matrix

  • Valid server/discover, tools/list and tools/call as the first RPC, without initialize or a session. Discovery advertises exactly the allowed revisions and implemented capabilities. Check all pagination pages and deterministic tool order.
  • Required _meta keys io.modelcontextprotocol/protocolVersion and io.modelcontextprotocol/clientCapabilities. Omitted clientInfo works, malformed clientInfo fails. Verify optional/null tool arguments and serverInfo on results.
  • Required MCP-Protocol-Version and Mcp-Method, plus Mcp-Name for tools/call. Check header names case-insensitively, values with the specified comparison/encoding. Missing/malformed required headers or header/body mismatches produce HTTP 400 and -32020.
  • Older revisions and unknown future revisions produce HTTP 400 and -32022 with requested/supported revisions. Unknown RPC methods with otherwise valid modern requests produce HTTP 404 and -32601. Do not use obsolete draft codes -32001/-32003/-32004 for the new standardized errors.
  • Malformed JSON, absent body metadata, invalid arguments and unknown tools follow their distinct transport/schema/tools error contracts. Isolate one failure per test to avoid asserting an invented precedence between auth and parsing failures.
  • All completed result objects have resultType complete, including tool errors with isError. JSON-RPC error envelopes are not result objects. Complete discovery and list results include ttlMs >= 0 and cacheScope. Verify private caching, page consistency and no cross-authorization leakage.
  • GET/DELETE on the MCP RPC endpoint return the selected policy 405. Metadata GET remains available without credentials. No usable old HTTP+SSE/session route. Valid modern requests carrying obsolete Mcp-Session-Id or Last-Event-ID are processed without session creation or replay, as the detailed spec recommends. No SSE event IDs or resumability.
  • A correctly formed initialize request is unsupported. An old initialize request with absent/old metadata may fail earlier at header/version validation. No legacy fallback is allowed.
  • Missing/invalid/expired OAuth tokens produce 401. Insufficient scope or permission produces 403. Test wrong issuer, audience and tenant, an ID token, AstraCS bearer value and old Token/token/X-Cassandra-Token headers. Discovery metadata must still bootstrap authorization. Verify the protected-resource contract implemented in MCP: Add OAuth authentication and discovery #2642.
  • MCP-disabled behavior exposes no protected catalog or execution. Feature-flag precedence remains explicit.
  • Assert no advertised optional extension or removed methods, no unsolicited protocol log messages, and no server-initiated requests. If a capability is enabled later, add its positive and negative conformance cases.

Done when

Raw status, headers and JSON assertions pass against the packaged artifact and can be replayed through the edge in #2634. Tests reference the normative transport, discovery, caching and authorization sections. Include a fractional schema fixture and schema-reference/resource-bound checks where the implementation processes those constructs.

Reuse suitable work from #2591 and #2343. #2633 proves independent SDK/host interoperability. No database writes are required for the default smoke path.

Changelog traceability

Normative detail: Streamable HTTP, authorization, caching.

Resource discovery checks

Assert the metadata response, resource identity, issuer list and challenge URL implemented in #2642 against the packaged artifact. Test unauthenticated metadata GET separately from the MCP RPC endpoint's GET/DELETE 405 behavior. Export these cases for the deployed verification in #2634.

Use RFC 9728 and the MCP discovery requirements for the assertions. #2633 owns client fallback sequences and rejection of mismatched metadata.

Activity

  1. changed the title [-]Add raw HTTP contract tests for MCP 2026-07-28[/-] [+]MCP: Add raw HTTP contract tests for 2026-07-28[/+] on Oct 12, 2026
  2. changed the title [-]MCP: Add raw HTTP contract tests for 2026-07-28[/-] [+]MCP: Verify the upgraded HTTP protocol[/+] on Oct 12, 2026
  3. added
    MCP upgradeRequired work to deliver the MCP package upgrade.
    MCP launch requiredRelease gate for the OAuth and modern-protocol MCP launch
    MCP protocolModern MCP wire contract and conformance
    and removed
    MCP upgradeRequired work to deliver the MCP package upgrade.
    on Oct 12, 2026
  4. changed the title [-]MCP: Verify the upgraded HTTP protocol[/-] [+]MCP: Verify packaged HTTP protocol and auth conformance[/+] on Oct 12, 2026
  5. changed the title [-]MCP: Verify packaged HTTP protocol and auth conformance[/-] [+]MCP: Test protocol and OAuth behavior over HTTP[/+] on Oct 19, 2026
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

    MCP launch requiredRelease gate for the OAuth and modern-protocol MCP launchMCP protocolModern MCP wire contract and conformance

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions