Skip to content

feat(mcp): support MCP 2026-07-28 stateless protocol (MCP v2) #4292

Description

@Yeachan-Heo

Parent

Part of #4283. Coordinates with #4284 and #4291.

Owner directive

GJC's MCP client/runtime must support MCP v2, specifically the Model Context Protocol 2026-07-28 stateless specification.

References:

The implementation must verify behavior against the canonical specification and official SDK conformance material rather than treating the summary articles as the protocol authority.

Current gap

The current HTTP transport is visibly session-oriented: it performs initialization and persists/sends Mcp-Session-Id; tests assert session renewal/reconnect behavior. MCP 2026-07-28 removes the required initialize/initialized handshake, protocol session, and open-stream dependency from the core request path.

Required client/runtime contract

Protocol negotiation and compatibility

  • support MCP protocol version 2026-07-28 for remote Streamable HTTP servers;
  • preserve a bounded compatibility path for older sessionful Streamable HTTP servers during the specification's deprecation/migration window;
  • protocol selection/fallback must be deterministic, observable, and downgrade-safe—never silently reinterpret an auth/protocol/security failure as permission to downgrade;
  • expose effective protocol generation/version through safe diagnostics and /extensions/doctor integration.

Stateless requests

For v2 servers:

  • do not require initialize, initialized, Mcp-Session-Id, a sticky transport session, standalone SSE stream, or message replay for ordinary calls;
  • include the required per-request protocol version, client identity, and client capability context;
  • emit required Mcp-Method and Mcp-Name headers for Streamable HTTP requests where applicable;
  • support optional server/discover without making it a mandatory handshake;
  • preserve request cancellation, timeout, retry, auth refresh, redirects, SSRF/DNS policy, and connection cleanup without session-state assumptions.

Multi Round-Trip Requests / elicitation

  • recognize v2 input_required results;
  • convert the requested input into GJC's existing structured ask/workflow-gate surface without exposing private payloads;
  • retry the original operation with the accepted input under a stable correlation/idempotency contract;
  • handle rejection, cancellation, timeout, repeated input requests, resume/restart boundaries, and unavailable interactive UI explicitly;
  • do not fall back to legacy server-initiated elicitation/create over a held stream when operating in strict v2 mode.

Discovery caching and lifecycle

  • honor supported ttlMs and cacheScope hints for tools/prompts/resources catalogs without allowing stale authority or cross-server/cross-credential leakage;
  • keep deterministic tool ordering and invalidate caches on config/auth/protocol/server identity changes;
  • model Active/Deprecated/Removed protocol features in diagnostics so deprecated legacy SSE/session behaviors are visible rather than silently permanent.

Authorization

For v2 HTTP authorization support, implement or explicitly gate the applicable client responsibilities for:

  • pre-registered clients and Client ID Metadata Documents (CIMD);
  • DCR only as a deprecated compatibility fallback;
  • RFC 9207 authorization issuer (iss) verification;
  • RFC 8707 canonical MCP server resource audience on authorization/token requests;
  • no credential, metadata document, token, query secret, or auth header leakage in diagnostics/UI.

If the current auth subsystem cannot safely deliver the complete v2 authorization contract in one PR, split it into an explicitly linked blocking child before claiming full MCP v2 support; do not label transport-only support as complete protocol support.

Configuration/UI integration

  • project/global .gjc MCP entries must allow an explicit protocol preference such as auto, 2026-07-28, or bounded legacy mode using the final schema chosen by implementation;
  • /extensions (feat(customization): add /extensions UI with project/global .gjc management and Claude/Codex import #4291) must display configured preference, negotiated effective protocol, compatibility/deprecation status, and v2 capability/diagnostic state without secrets;
  • imported Claude Code/Codex MCP definitions should default to safe negotiation and preserve any representable protocol preference without inventing unsupported semantics.

Acceptance tests

  1. strict v2 server fixture completes tools/list and tools/call without initialize, Mcp-Session-Id, or open SSE and receives required protocol/method/name/client context.
  2. optional server/discover works and its absence does not block direct v2 calls.
  3. legacy sessionful fixture still works under explicit/auto compatibility, with downgrade decisions and deprecation status observable.
  4. auth/protocol/security failures do not cause unsafe automatic downgrade.
  5. input_required produces a structured GJC question, accepted input retries the original request exactly once under correlation/idempotency fencing, and cancel/timeout/repeat/restart cases are covered.
  6. ttlMs/cacheScope tests prove bounded caching and invalidation across server URL, credentials, config, protocol, and process/session boundaries.
  7. RFC 9207 issuer mismatch and RFC 8707 audience mismatch fail closed; secrets remain redacted.
  8. plugin-bundle MCPs, native project/global .gjc MCPs, exact-file config, ACP-supplied MCPs, and subagent inheritance share the same protocol implementation without duplicate ownership/leaks.
  9. /extensions and customization doctor consume one authoritative protocol/status observation model.
  10. focused transport/auth tests, aggregate coding-agent checks, package/build checks, and an official/conformance-compatible v2 server integration test pass.

Non-goals

  • implementing an MCP server in GJC merely to prove client support;
  • removing legacy support before its compatibility window and repository policy allow it;
  • treating all v2 extensions (Apps, Tasks, enterprise-managed auth) as core support unless separately scoped;
  • weakening existing SSRF, redirect, DNS rebinding, stdio, credential, or plugin confinement policy.


[repo owner's gaebal-gajae (clawdbot) 🦞]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions