swift-sdk/Sources/MCP/Base/Transport.swift
Mattt d583151871
Add streamable HTTP transport for clients (#70)
* Rename file to Transport.swift

* Rename file to StdioTransportTests.swift

* Add .index-build/ to .gitignore

* Implement HTTP client transport

* Add test coverage for streamable HTTP client transport

* Conditionally import FoundationNetworking

* Conditionalize streaming for unsupported platforms

* Import FoundationNetworking in tests

* Add 5 minute timeout to CI jobs

* Remove debug logging

* Formatting

* Skip SSE tests on platforms that don't support streaming
2025-04-15 09:06:29 -07:00

20 lines
496 B
Swift

import Logging
import struct Foundation.Data
/// Protocol defining the transport layer for MCP communication
public protocol Transport: Actor {
var logger: Logger { get }
/// Establishes connection with the transport
func connect() async throws
/// Disconnects from the transport
func disconnect() async
/// Sends data
func send(_ data: Data) async throws
/// Receives data in an async sequence
func receive() -> AsyncThrowingStream<Data, Swift.Error>
}