You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
add RawJSONValue and ExactJSONObject for ordered members, duplicate keys, exact Unicode-scalar identity, exact number lexemes, and strings that never auto-decode as data URLs
add a source-compatible two-argument Server.withMethodHandler overload that receives the normal typed request alongside RawRequestContext
route raw-aware single and batch requests with zero-copy, cancellation-aware parsing and explicit document/string/depth/entry limits while leaving legacy handlers, notifications, and inbound responses on their existing decoding path
keep malformed batch documents as top-level parse errors while isolating structurally invalid or over-limit items so valid siblings still run and available request IDs are retained
preflight programmatic data URL sizes with overflow-checked base64 length arithmetic before allocation
Validation
swift test (575 tests on macOS)
swift build -c release
swift package generate-documentation --target MCP --warnings-as-errors
Swift 6.1.2 Linux: swift test (494 tests) and swift build -c release
Swift 6.1.2 static Linux SDK: upstream install-and-build-with-sdk.sh --static
Documentation
document exact JSON method handlers and custom RawJSONLimits in the README
Hi @steipete, thank you for this PR and for the detailed work on exact JSON handling and batch error isolation!
Because rel/1.0.0 (#372) is now finalized and ready to merge into main, this PR conflicts heavily with the new server dispatch (withMethodHandler was replaced by setHandler(for:_:) passing (Parameters, HandlerContext) in #416). Several of the underlying issues this PR addressed also landed directly in 1.0.0:
For the remaining new public API (RawJSONValue, ExactJSONObject, ordered/duplicate keys, exact number lexemes), we'd prefer to discuss the design in an issue for a future release rather than merge it directly into 1.0.0. Could you please close this PR against main? We've added the pending-close label in the meantime — if you still need exact raw JSON access on top of 1.0.0, please open a design issue so we can align on an additive API!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pending-closeawaiting author confirmation for final closure
3 participants
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
RawJSONValueandExactJSONObjectfor ordered members, duplicate keys, exact Unicode-scalar identity, exact number lexemes, and strings that never auto-decode as data URLsServer.withMethodHandleroverload that receives the normal typed request alongsideRawRequestContextValidation
swift test(575 tests on macOS)swift build -c releaseswift package generate-documentation --target MCP --warnings-as-errorsswift test(494 tests) andswift build -c releaseinstall-and-build-with-sdk.sh --staticDocumentation
RawJSONLimitsin the README