swift-sdk/Sources/MCP/Base/Transports.swift
Mattt 1e61f205a1
Add support for Linux with glibc (#61)
* Conditionally import Glibc on Linux for fcntl calls

* Extract transport implementations into separate files

* Fix warning in test

* Add ubuntu-latest to CI test matrix

* Switch to vapor/swiftly-action for setup step

* Configure Prettier extension to format GitHub Actions workflows

* Setup with different actions depending on platform

* Rename step

* Rename job

* Update README
2025-04-10 05:22:56 -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>
}