Skip to content

Conversation

@mattt
Copy link
Contributor

@mattt mattt commented Apr 11, 2025

Resolves #20

https://modelcontextprotocol.io/specification/2025-03-26/basic/transports#streamable-http

Whereas stdio transport is symmetrical between client and server, streamable HTTP transport has very different requirements for each. It's fairly straightforward to implement HTTP client transport in Swift using Foundation networking (URLSession). That's what this PR does.

It's another thing entirely to implement HTTP server transport. Most paths to getting Swift on Server involve pulling in SwiftNIO as a dependency. SwiftNIO itself is too low-level to be used on its own, and requires either implementing a nontrivial amount of server logic or pulling in an additional dependency, like Hummingbird or Vapor.

I suspect that the vast majority of developers using this SDK are interested in connecting to remote MCP servers from their app. And among those who do want to run an MCP server in Swift, I suspect many would do so as a form of inter-process communication for an app (like iMCP) — in which case, the existing NetworkTransport is sufficient. If we're prioritizing these use cases, it's hard to justify the cost of pulling in something on the order of a thousand additional Swift files from a dozen external packages for every installation.

So for now, let's start with HTTP streaming transport for clients. If you have ideas for what we can or should do about server transport, please open a new issue — I'd love to hear what you think.

@mattt mattt force-pushed the mattt/streamable-http-client branch from 519020b to b3a3119 Compare April 11, 2025 12:44
@mattt mattt marked this pull request as ready for review April 11, 2025 13:47
@mattt mattt force-pushed the mattt/streamable-http-client branch from 8a241f8 to 593985a Compare April 11, 2025 13:56
@mattt mattt force-pushed the mattt/streamable-http-client branch from 593985a to 55ab96d Compare April 14, 2025 11:10
@mattt mattt moved this to In Progress in 2025-03-26 Implementation Apr 15, 2025
@mattt mattt self-assigned this Apr 15, 2025
@mattt mattt merged commit d583151 into main Apr 15, 2025
4 checks passed
@mattt mattt deleted the mattt/streamable-http-client branch April 15, 2025 16:06
@github-project-automation github-project-automation bot moved this from In Progress to Done in 2025-03-26 Implementation Apr 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Development

Successfully merging this pull request may close these issues.

Add support for "Streamble HTTP" transport

2 participants