The official Swift SDK for Model Context Protocol servers and clients.
by modelcontextprotocolLast 12 weeks · 4 commits
5 of 6 standards met
Motivation and Context Fixes compilation warnings under Swift 6.3 strict concurrency checking. Issue: https://github.com/modelcontextprotocol/swift-sdk/issues/203 Full credits to @wti How Has This Been Tested? Tested on Apple Swift 6.3 / XCode 26.4 beta 2 (17E5170d) Types of changes [x] Bug fix (non-breaking change which fixes an issue) [ ] New feature (non-breaking change which adds functionality) [ ] Breaking change (fix or feature that would cause existing functionality to change) [ ] Documentation update Checklist [ ] I have read the MCP Documentation [ ] My code follows the repository's style guidelines [ ] New and existing tests pass locally [ ] I have added appropriate error handling [ ] I have added or updated documentation as needed Additional context
Motivation and Context this PR adds support for progress notifications (aka ) from the 2025-03-26 spec. How Has This Been Tested? i validated this change locally within a private codebase that uses this swift package. i updated that codebase to point to this feature branch via and confirmed that i received progress notifications when i attached a to a request. the spec mandates that both clients and servers should be capable of subscribing to progress notifications, but i only validated the client case. however, i believe the logic i wrote should work for servers subscribing to clients as well. if reviewers know of any sample projects in which i might validate this behavior, please let me know! i also wrote some unit tests for the new ProgressNotification type following the existing pattern set by the ResourceUpdatedNotification unit tests. Breaking Changes there shouldn't be any! i followed @stallent's first suggestion in https://github.com/modelcontextprotocol/swift-sdk/issues/82, which avoids breaking changes. Types of changes [ ] Bug fix (non-breaking change which fixes an issue) [x] New feature (non-breaking change which adds functionality) [ ] Breaking change (fix or feature that would cause existing functionality to change) [x] Documentation update Checklist [x] I have read the MCP Documentation [x] My code follows the repository's style guidelines [x] New and existing tests pass locally [ ] I have added appropriate error handling [x] I have added or updated documentation as needed i roughly adhered to the pattern set by ResourceUpdatedNotification, which has no special error handling. however, please let me know if there's something i missed, and i'd be happy to update this PR! Additional context there are multiple ways to support progress notifications within this repository, most of which @stallent outlines in https://github.com/modelcontextprotocol/swift-sdk/issues/82. i'll summarize them here briefly, and explain why i chose this particular design: 1. require that callers must pass a in arguments when invoking a method (e.g., ). sender does not deliver progress directly; instead, the caller must subscribe to the stream for notifications (messages) with the passed into the method. 2. add an optional progress closure to all methods that support progress tracking. sender invokes this closure when it wishes to notify caller of progress. 3. modify the return types of all methods that support progress tracking to include an AsyncStream for progress notifications. callers can optionally process the progress updates that come through this stream. i did not consider option 2 because it doesn't feel like a modern iOS design pattern, and chose option 1 over option 3 because i like that it should work for all eligible methods with a minimal code footprint. the downside of option 1, however, is that the SDK does not make subscribing to progress notifications very obvious 😅 maintainers and community users, let me know what you think!
Repository: modelcontextprotocol/swift-sdk. Description: The official Swift SDK for Model Context Protocol servers and clients. Stars: 1281, Forks: 169. Primary language: Swift. Languages: Swift (99.7%), Shell (0.3%). Topics: mcp, swift. Latest release: 0.11.0 (2w ago). Open PRs: 16, open issues: 36. Last activity: 9h ago. Community health: 87%. Top contributors: mattt, adamwulf, carlpeaslee, stallent, Overcot, aspitz, localden, phimage, glaciotech, movetz and others.
Swift
Authentication implementation Motivation and Context Extends protocol conformance How Has This Been Tested? unit + conformance tests Breaking Changes Types of changes [ ] Bug fix (non-breaking change which fixes an issue) [X] New feature (non-breaking change which adds functionality) [ ] Breaking change (fix or feature that would cause existing functionality to change) [X] Documentation update Checklist [X] I have read the MCP Documentation [X] My code follows the repository's style guidelines [X] New and existing tests pass locally [X] I have added appropriate error handling [X] I have added or updated documentation as needed Additional context
TBC Motivation and Context Unix socket transport How Has This Been Tested? Work in progress Breaking Changes None Types of changes [ ] Bug fix (non-breaking change which fixes an issue) [x] New feature (non-breaking change which adds functionality) [ ] Breaking change (fix or feature that would cause existing functionality to change) [ ] Documentation update Checklist [x] I have read the MCP Documentation [x] My code follows the repository's style guidelines [x] New and existing tests pass locally [ ] I have added appropriate error handling [ ] I have added or updated documentation as needed Additional context
This PR updates the SDK and tests for strict sendability: Wrap transport errors with at all call sites in stdio/network transports and mock transport Mark closure as Refactor batch tests to avoid non-sendable captured mutable state by using actor-backed task storage Align eventsource URL with Validation: (206 tests passed)
Review fixes to increase SDK's conformance to protocol and some quality improvements. Motivation and Context More conformance coverage and general improvements How Has This Been Tested? Unit + Conformance tests Types of changes [X] Bug fix (non-breaking change which fixes an issue) [ ] New feature (non-breaking change which adds functionality) [x] Breaking change (fix or feature that would cause existing functionality to change) [ ] Documentation update Checklist [X] I have read the MCP Documentation [X] My code follows the repository's style guidelines [X] New and existing tests pass locally [X] I have added appropriate error handling [ ] I have added or updated documentation as needed Additional context