Skip to content

feat: add stateless MCP Streamable HTTP transport - #21

Merged
shivros merged 1 commit into
mainfrom
runner/COD-525-mcp-http
Sep 29, 2026
Merged

shivros merged 1 commit into
mainfrom
runner/COD-525-mcp-http

Conversation

@shivros

@shivros shivros commented Sep 28, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Add the reusable hydra-mcp-http stateless MCP Streamable HTTP runtime for protocol 2026-07-28.
  • Validate explicit Origin policy, JSON/SSE media negotiation, JSON-RPC metadata, mirrored MCP headers, tool manifests, safe errors, and Base64-sentinel tool names.
  • Share the generated-location Notes MCP adapter between stdio and HTTP, with a real loopback server/discover -> tools/list -> tools/call acceptance path.
  • Document embedding and intentionally unsupported session, legacy, CORS/PNA, and x-mcp-header boundaries.

Linear: COD-525

Scope boundaries

  • No api/operations.yaml, generated operation artifact, business operation, authentication policy, deployment, release, or AnkiMCP change.
  • The generic runtime never binds a listener or selects a mount path; the Notes example owns 127.0.0.1:8942 and /mcp.

Verification

  • cargo build --locked --all-targets
  • cargo test --locked --all-targets (60 codegen, 3 runtime unit, 7 runtime transport, 1 real Notes loopback, 14 Notes surface, and 6 security-scan tests)
  • cargo clippy --locked --workspace --all-targets -- -D warnings
  • cargo fmt --all -- --check
  • cargo run --locked -p hydra-codegen --bin hydra-codegen -- check in examples/notes, examples/security-scan, and examples/ts-client
  • Two hydra-codegen write passes in each example were byte-identical to the committed four-artifact snapshots and to each other; final codegen checks passed.
  • examples/ts-client: npm ci --ignore-scripts --no-audit --no-fund, generated check, typecheck, build, and nested-schema test
  • creed diff
  • git diff --check

All gates passed on signed commit 001de6ff52b5cddaa7e855c0909da656aef026d5.

@shivros

shivros commented Sep 28, 2026

Copy link
Copy Markdown
Contributor Author

🤖 Automated Review Panel

Reviewer A — GPT-5.6 Terra

Initial result: BLOCK; findings resolved before handoff.

  • Correctness: invalid JSON-RPC IDs (object/array/boolean) were initially echoed in error responses. The runtime now normalizes invalid or missing IDs to null and the transport test asserts that behavior.
  • Evidence: the initial panel noted that the focused matrix did not explicitly exercise dispatch errors, legacy initialize, or OPTIONS. Added deterministic coverage for the isError tool-result envelope, initialize method-not-found, and OPTIONS 405/no-CORS behavior. The OpenSpec tasks.md evidence is now updated with the executed gate matrix.

Runner follow-up verification after these fixes: cargo build --locked --all-targets, cargo test --locked --all-targets, strict Clippy, fmt, codegen freshness/determinism, TypeScript checks, creed diff, and git diff --check all pass.

Reviewer B — Gemini 3 Flash Preview

Review findings and disposition:

  • Base64 sentinel/control handling: the reviewer questioned rejecting decoded control characters. This is intentional: the frozen contract requires malformed/control values to be rejected before comparison, and construction rejects tool names containing control characters. Base64 remains supported for valid non-ASCII, whitespace, and other unsafe plain-header values; a Unicode sentinel round-trip is covered by tests.
  • Structured content: the reviewer questioned the JSON text mirror. The frozen design explicitly requires a successful dispatch Value in both structuredContent and backwards-compatible JSON text content; the transport test asserts both.
  • OpenSpec evidence: the reviewer identified the missing living task evidence during the initial pass. openspec/changes/add-mcp-streamable-http/tasks.md now records all verified tasks and exact gate evidence.
  • The remaining Origin and x-mcp-header observations match the intentionally strict frozen contract and are documented/tested.

Panel conclusion

The review findings were addressed or explicitly resolved against the frozen contract. No unresolved correctness blocker remains in the final commit.

@shivros
shivros marked this pull request as ready for review September 28, 2026 23:38
@shivros

shivros commented Sep 29, 2026

Copy link
Copy Markdown
Contributor Author

Auto-Merge Gate

Confidence: 0.86

Rationale: Implements COD-525's stateless MCP Streamable HTTP transport as a contained runtime crate, wires the Notes reference through the shared dispatcher, documents the explicit protocol/security boundaries, and includes focused transport plus real loopback acceptance coverage. The existing dual-model review panel records that its initial correctness findings were fixed before handoff; no unresolved review activity remains.

Checks observed: CI Test and Creed context drift completed successfully on 001de6ff52b5cddaa7e855c0909da656aef026d5.

Scope limits checked: no deployment, release, authentication-policy, billing, data-deletion, or credential changes; COD-525 has no manual-review marker.

@shivros
shivros merged commit 303ba7a into main Sep 29, 2026
2 checks passed
@shivros
shivros deleted the runner/COD-525-mcp-http branch September 29, 2026 01:22
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.

1 participant