Skip to content

Add MCP_PROTOCOL_MODE era selection and modern tools/list cache directives to fast-time-server - #20

Merged
jonpspri merged 1 commit into
mainfrom
fast-time-server/16-19-protocol-mode-and-cache-directives
Aug 7, 2026
Merged

Add MCP_PROTOCOL_MODE era selection and modern tools/list cache directives to fast-time-server#20
jonpspri merged 1 commit into
mainfrom
fast-time-server/16-19-protocol-mode-and-cache-directives

Conversation

@jonpspri

@jonpspri jonpspri commented Aug 7, 2026

Copy link
Copy Markdown
Collaborator

Closes #16. Closes #19.

What

#19 — cache directives on modern tools/list. tools/list is cacheable at 2026-07-28, whose wire format requires cacheScope/ttlMs on every response (mcp SDK 2.0.0 / mcp-types 2.0.0 reject replies without them, breaking gateway federation). The server now overrides list_tools to emit cacheScope: "private", ttlMs: 0 for requests carrying the 2026-07-28 _meta version — the same conservative defaults server/discover already uses. Legacy-era responses keep the fields absent, mirroring the SDK's version-gated resultType handling.

#16MCP_PROTOCOL_MODE env var + pinned UBI 10 build.

  • MCP_PROTOCOL_MODE=legacy|modern|dual selects the served MCP era(s) without rebuilding or editing the entrypoint; unknown values fail startup with an error listing the accepted values.
  • The rmcp SDK's default initialize negotiation accepts any known revision regardless of supported_protocol_versions(), so single-era modes also override initialize to reject the other era's handshake with -32022 (e.g. modern mode rejects initialize(2025-11-25) with supported: ["2026-07-28"]).
  • Containerfile: builder stage moves from rustlang/rust:nightly-slim to the same pinned registry.access.redhat.com/ubi10/ubi-minimal:10.2-1777462752 as the runtime (UBI 10.2 AppStream ships Rust 1.92, above the crate's 1.88 floor — no nightly). Image defaults to ENV MCP_PROTOCOL_MODE=dual; new .dockerignore excludes target/.

Deviations from #16's text (it predates the rmcp rewrite in #17)

  • The --protocol/--strict CLI flags no longer exist, so "CLI overrides env" is moot — the env var is the only mode selector.
  • Unset default is dual, not legacy, preserving the server's current documented dual-era behavior rather than regressing it.

Verification

  • cargo fmt --check, cargo clippy --all-targets, cargo test: clean, 37/37 (7 new tests: mode parsing, per-era wire gating, cache-directive presence/absence, /version per mode).
  • Image builds on UBI 10; all three modes plus the invalid-value exit exercised live with curl (modern tools/list returns resultType/cacheScope/ttlMs; legacy mode rejects modern requests with -32022; MCP_PROTOCOL_MODE=nightly exits 1 with guidance).

Note: /version now reports protocol_mode + mcp_versions; the singular mcp_version field was dropped.

…tives to fast-time-server

- Emit cacheScope/ttlMs on tools/list responses at 2026-07-28, which the
  modern wire format requires for cacheable results; legacy responses keep
  the fields absent (#19)
- Add MCP_PROTOCOL_MODE=legacy|modern|dual (default dual) to select the
  served MCP era(s); single-era modes also reject the other era's
  initialize handshake with -32022, and invalid values fail startup (#16)
- Build the image on pinned registry.access.redhat.com/ubi10/ubi-minimal
  for both stages (Rust 1.92 from AppStream, no nightly), default the
  image to MCP_PROTOCOL_MODE=dual, and exclude target/ via .dockerignore

Signed-off-by: Jonathan Springer <jps@s390x.com>
@jonpspri
jonpspri merged commit 890afe4 into main Aug 7, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant