Skip to content

2025-11-25 spec compliance fixes + JuliaC trim-compile harness - #4

Merged
quinnj merged 8 commits into
mainfrom
spec-2025-11-25-fixes
Aug 4, 2026
Merged

2025-11-25 spec compliance fixes + JuliaC trim-compile harness#4
quinnj merged 8 commits into
mainfrom
spec-2025-11-25-fixes

Conversation

@quinnj

@quinnj quinnj commented Jul 28, 2026

Copy link
Copy Markdown
Member

Summary

Bring the implementation into compliance with MCP 2025-11-25. Add the standard JuliaC --trim=safe compile harness used across JuliaServices packages.

Spec compliance fixes

  • Return deterministic ordering from tools/list, prompts/list, resources/list, and resources/templates/list.
  • Return -32602 for unknown tools and prompts. Return -32002 for unknown resources.
  • Parse SSE-streamed POST responses. Dispatch interleaved notifications and server requests before returning the final response.

Trim-safe static server

  • Include the tools-only StaticMCPServer work from Add a trim-safe static tools server #3 without adding exports.
  • Keep the request and dispatch graph concrete for JuliaC --trim=safe builds.
  • Replace dynamic JSON parsing in the trim path with a strict scanner.
  • Reject malformed escapes, numbers, Unicode, trailing bytes, excessive nesting, duplicate envelope fields, and invalid parameter shapes.
  • Validate required initialize fields, tool schemas, annotations, and structured result objects.
  • Preserve JSON-RPC string, null, integer, decimal, exponent, and large numeric IDs exactly.
  • Do not execute request-only methods when a client omits the JSON-RPC ID.
  • Convert argument and handler failures to stable JSON-RPC errors without leaking internal exception text.
  • Document the namespaced API, route setup, handler contract, and support limits.

Integration updates

  • Merge the current main branch, including OAuth 3 compatibility and retained negotiated client capabilities.

Validation

  • Full package suite passes on Julia 1.12.6 with HTTP 2.6.1 and OAuth 3.0.0.
  • JuliaC --trim=safe verification reports zero verifier errors or warnings. The produced executable passes.
  • Full package suite passes on the minimum supported Julia 1.10.11 in a clean environment.
  • Documenter 1.17 builds all pages and runs the new executable example.
  • git diff --check passes.

Co-authored by Codex

quinnj and others added 6 commits July 22, 2026 12:11
Add a concrete tools-only Streamable HTTP server for native compilation. Typed request envelopes, raw JSON fragments, concrete handlers, and explicit sessions avoid dynamic Function and Dict dispatch while preserving initialize, tools/list, tools/call, ping, and session lifecycle behavior.
…med responses

- Return tools/prompts/resources/templates lists in deterministic sorted
  order so clients get stable prompt-cache-friendly results
- Unknown tool/prompt in tools/call & prompts/get now return -32602
  (Invalid params) instead of -32601; unknown resource in resources/read
  returns -32002 (Resource not found) per the 2025-11-25 spec
- Client now handles Streamable HTTP POST responses delivered as SSE
  streams: request-scoped notifications/server requests are dispatched to
  registered handlers and the final JSON-RPC response is extracted

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
JSON.lazy/typed-parse request paths reach Parsers' recursive float
parsing and repr()-based error formatting, neither of which passes the
JuliaC --trim=safe verifier (456 errors). Replace them with a minimal
self-contained scanner (string unescape incl. surrogate pairs, value
extent skipping, Int64 ids) so the static server's entire request graph
verifies clean. Drops the StructUtils dependency.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
- test/trim_compile_tests.jl: standard trim harness (compiles workloads
  with --trim=safe in a temp env, requires 0 verifier errors/warnings,
  runs the produced executable); skips on Julia < 1.12/prerelease/32-bit
- test/mcp_trim_safe.jl: StaticMCPServer workload exercising the full
  session + tools request lifecycle over in-memory HTTP requests
- New testset covering deterministic list ordering, spec error codes,
  and SSE-streamed POST response handling in the client

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
quinnj added a commit that referenced this pull request Jul 30, 2026
Replace fixed 200 ms sleeps with bounded condition waits. This matches the deterministic listener test change already present in PR #4 and prevents unrelated platform timing failures from masking the stale-session regression.
quinnj added a commit that referenced this pull request Jul 31, 2026
* fix(transport): return 404 for stale sessions

Return the HTTP status required by Streamable HTTP when a client sends an unknown MCP session ID. Keep the JSON-RPC -32001 body so clients can log the protocol error while using HTTP 404 to start a new session.

* test(client): wait for streamed events

Replace fixed 200 ms sleeps with bounded condition waits. This matches the deterministic listener test change already present in PR #4 and prevents unrelated platform timing failures from masking the stale-session regression.
quinnj added 2 commits August 4, 2026 11:34
Validate JSON, initialization parameters, tool schemas, and result shapes in the trim-safe server. Prevent request-only methods from running as notifications and return stable JSON-RPC errors for handler failures. Add regression tests and executable documentation.
@quinnj
quinnj merged commit 636c3c6 into main Aug 4, 2026
11 checks passed
@quinnj
quinnj deleted the spec-2025-11-25-fixes branch August 4, 2026 17:54
@quinnj
quinnj restored the spec-2025-11-25-fixes branch August 4, 2026 17:55
@quinnj
quinnj deleted the spec-2025-11-25-fixes branch August 4, 2026 17:55
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