The official Swift SDK for Model Context Protocol servers and clients.
by modelcontextprotocolLast 12 weeks ยท 3 commits
5 of 6 standards met
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
So now that we have the client working pretty well with the latest streamable http spec, i'm starting to work on upgrading our servers to support the server side of said spec. I believe we may have a design issue, or maybe (hopefully) i'm missing something. The current design of the works fine because typically a client app would have a single instance of a client (per server to connect to). That coupling becomes an issue on the server side, though. A server needs to allow more than one client to connect to it, and then any given client needs to be able to have multiple connections open within its session. I've been studying the official TS streamable server code and of course while the syntax will be vastly different, i think i have a handle on the direction we need to go to do it properly. Basically, the server needs to allow multiple transports to be added (vs just one like it is currently). Each connection from a client would create a new transport which would be added to the server for that session. The GETs (which are all just one direction, server->client) would sit in there and all general messages would get written to all of them. The POSTs would also add their own transports to that session's server, but they would be shorter lived and let the server write to just that one transport, identified by the incoming id of the POST request. The spec explicitly states a client can have mutliple connections open so while we don't necessarily have to match the exact approach of the TS implementation, we must do something at least remotely similar. Have you given this area much thought and if so, what are the thoughts? If not, I may go ahead and work on a POC in my fork
Repository: modelcontextprotocol/swift-sdk. Description: The official Swift SDK for Model Context Protocol servers and clients. Stars: 1270, Forks: 167. Primary language: Swift. Languages: Swift (99.7%), Shell (0.3%). Topics: mcp, swift. Latest release: 0.11.0 (1w ago). Open PRs: 17, open issues: 36. Last activity: 2d ago. Community health: 87%. Top contributors: mattt, adamwulf, carlpeaslee, stallent, Overcot, aspitz, localden, phimage, glaciotech, movetz and others.
Swift
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