Skip to content

Fix Windows builds: guard EventSource usage in HTTPClientTransport - #279

Open
onetamer wants to merge 1 commit into
modelcontextprotocol:mainfrom
onetamer:windows-eventsource-guard
Open

Fix Windows builds: guard EventSource usage in HTTPClientTransport#279
onetamer wants to merge 1 commit into
modelcontextprotocol:mainfrom
onetamer:windows-eventsource-guard

Conversation

@onetamer

Copy link
Copy Markdown

Problem

Package.swift provides the EventSource product to the MCP target only on Apple platforms:

.product(
    name: "EventSource", package: "eventsource",
    condition: .when(platforms: [.macOS, .iOS, .tvOS, .visionOS, .watchOS, .macCatalyst])),

but HTTPClientTransport.swift imports and uses it behind #if !os(Linux). Any Windows build of the SDK therefore fails with:

error: no such module 'EventSource'

Fix

Widen every EventSource-related guard in HTTPClientTransport.swift from os(Linux) to os(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 build on macOS: unchanged, green.
  • swift build on 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.

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant