Fix Windows builds: guard EventSource usage in HTTPClientTransport - #279
Open
onetamer wants to merge 1 commit into
Open
Fix Windows builds: guard EventSource usage in HTTPClientTransport#279onetamer wants to merge 1 commit into
onetamer wants to merge 1 commit into
Conversation
Package.swift provides the EventSource product only on Apple platforms (condition: .when(platforms: [.macOS, .iOS, ...])), but HTTPClientTransport.swift imports and uses it behind #if !os(Linux), so any Windows build of the MCP target fails with "no such module 'EventSource'". Widen every EventSource-related guard from os(Linux) to os(Linux) || os(Windows): Windows takes the same buffered (non-streaming) HTTP path Linux already takes, and SSE streaming is reported unsupported the same way.
This was referenced Sep 10, 2026
ianegordon
added a commit
to ianegordon/swift-sdk
that referenced
this pull request
Sep 11, 2026
The Windows build failure is real — Package.swift provides EventSource only on Apple platforms while HTTPClientTransport.swift imports it behind #if !os(Linux) — and widening the five guards to os(Linux) || os(Windows) is the obvious fix. It is inert on macOS and Linux by inspection. But that it actually fixes Windows cannot be verified here: no Windows machine, and ci.yml runs macos-latest and ubuntu-latest only. Windows is low priority for this fork's downstreams, so an unverifiable patch is not worth the divergence. Cheap to reverse if that changes: unlike modelcontextprotocol#227, this cannot make fork code fail to build against upstream. Moved from the candidate table to 'Not included, and why'. Remaining candidates renumbered 7-9 to 6-8 so the intended order still continues the manifest sequence. Tracking: fork issue #9, relabelled decline. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Eb9yGSXH1TVkg5Afsu9phk
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Problem
Package.swiftprovides theEventSourceproduct to the MCP target only on Apple platforms:but
HTTPClientTransport.swiftimports and uses it behind#if !os(Linux). Any Windows build of the SDK therefore fails with:Fix
Widen every EventSource-related guard in
HTTPClientTransport.swiftfromos(Linux)toos(Linux) || os(Windows). Windows takes the same buffered (non-streaming) HTTP response path Linux already takes, and an SSE streaming request logs the same "not fully supported" warning instead of attempting an EventSource connection.No behavior change on any platform that built before.
Verification
swift buildon macOS: unchanged, green.swift buildon Windows 11 ARM64 (Swift 6.3.3): the MCP target builds with this patch applied; without it, the build fails as above. We (CopyBucket) have been shipping a production Windows MCP server against 0.12.1 with exactly this diff applied as a vendored patch since 2026-08.