Skip to content

Feature/issue 24 wire alignment - #37

Open
jpsiddharth2008 wants to merge 2 commits into
nitrocloudofficial:mainfrom
jpsiddharth2008:feature/issue-24-wire-alignment
Open

jpsiddharth2008 wants to merge 2 commits into
nitrocloudofficial:mainfrom
jpsiddharth2008:feature/issue-24-wire-alignment

Conversation

@jpsiddharth2008

Copy link
Copy Markdown

Closes #24
Builds on #34 (#22) and #36 (#23) — this branch is stacked on top of feature/issue-23-http-factory, since neither has merged to develop yet. Please merge those first.

Summary

  • After [mcp-2026] Remove JSON-RPC sidecar; one /mcp owner (official mcp 2.x) #22 removed the JSON-RPC sidecar, several 2026-07-28 wire behaviors were left half-finished — written assuming the sidecar would enforce them, and silently dead once it was gone.
  • ping is retired for auto/modern (only legacy keeps it) — the official mcp SDK answers ping by default on every era unless explicitly told not to; NitroStack now opts out via NitroStackMcpServer.set_protocol_era().
  • Added -32021 (MISSING_REQUIRED_CLIENT_CAPABILITY) to JsonRpcErrorCode — unused until the Tasks issue wires a live path for it, per [mcp-2026] Align 2026 wire: drop ping, add -32021, discover _meta, MUST headers #24's own acceptance criteria.
  • server/discover's result _meta now carries serverInfo, in addition to the existing top-level copy (kept for auto/legacy back-compat).
  • resultType is now stamped on tools/list, tools/call, resources/list, resources/templates/list, resources/read, prompts/list, prompts/get — not only discover/task-create/MRTR as before.
  • Deleted dead sidecar-era code discovered while implementing this: build_sessionless_initialize_result, handle_sessionless_initialize (both copies), discover_handler/initialize_handler attributes on NitroStackMcpServer, the old optional-header validators in jsonrpc.py, and the unused MethodContract/MODERN_METHOD_CONTRACTS machinery in method_contract.py (kept only the still-used DEPRECATED_MODERN_METHODS/rejects_deprecated_method).
  • Important finding that changed scope mid-implementation: the official mcp SDK already fully implements SEP-2243 MUST-header validation itself (mcp.shared.inbound.classify_inbound_request), triggered automatically whenever a client sends an MCP-Protocol-Version header the 2025 handshake doesn't recognize — independent of NitroStack's own protocol_era. I initially built a duplicate NitroStack-level validator per the issue's literal wording, then found this and removed it rather than ship a second implementation of the same ladder (exactly the anti-pattern [mcp-2026] Remove JSON-RPC sidecar; one /mcp owner (official mcp 2.x) #22/[mcp-2026] Unify HTTP factory: CORS once, subscribe flag, public stdio APIs #23 already removed). The new tests prove the SDK's existing behavior instead of re-testing NitroStack code that no longer exists.

Test plan

  • pytest tests/test_mcp24_wire_alignment.py tests/test_mcp23_http_factory.py tests/test_mcp22_official_http_owner.py tests/test_transport_http.py tests/test_lifecycle_http.py tests/test_mcp20_stdio.py tests/test_transports.py — new tests covering the issue's full "Test / verify" table, plus every existing mcp-2026 regression file → 58 passed
  • Full suite → 573 passed, 0 failed (excluded items independently confirmed pre-existing on the base branch or flaky Windows socket tests, not regressions from this branch — same exclusion list as [mcp-2026] Unify HTTP factory: CORS once, subscribe flag, public stdio APIs #23)
  • Manual: booted examples/calculator_server.py and a scaffolded python-pizzaz project over HTTP, confirmed /mcp/health, tools/list, and widget metadata all work end-to-end

Note for reviewers

Filed a separate follow-up investigation (not part of this PR): server/discover returns "method not found" when called via the plain 2025-shaped stateless dispatch path with no MCP-Protocol-Version header — root cause is the official SDK's own spec-version gate (_methods.validate_client_request) rejecting NitroStack's extension method at the default negotiated version. Confirmed unrelated to this PR's changes; needs its own fix in the sidecar-free architecture.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[mcp-2026] Align 2026 wire: drop ping, add -32021, discover _meta, MUST headers

2 participants