Adopting `with`- style accessors as part of the Transport APIs
维护者通常 2 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 5/5
- 预计耗时
- 一周以上
- 新手友好度
- 30/100
- Issue 类型
- 功能
- 描述清晰度
- 基本清楚
- 活跃度
- 停滞
- 技术栈
- swift
调研方向
Start by reading the existing Transport API entry points for connect(), send(), and receive(), then compare them with the proposed withClient closure flow. Done means a bootstrap can manage the connection for the closure, expose sending and incoming messages there, and close and clean up when the closure returns.
由索引模型根据 Issue 内容生成。
描述
Is your feature request related to a problem? Please describe.
The current Transport APIs require the user to call connect() to establish a connection. From this point, the user has to manually track whether or not the connection is still alive, by handling any errors thrown by send or receive.
If a user wants to correctly handle error cases, this leads to more complexity in their implementations.
Describe the solution you'd like
In the Swift on Server ecosystem, we've adopted a with- style pattern, which compliments prior art in Swift's standard library. In there, we have a "bootstrap" for each transport that can be configured with the intended behavior of a transport connection.
let bootstrap = MCPTransportBootstrap()
A bootstrap connects in a with- style function call like so:
bootstrap.withClient { send, messages in
try await send(SomeToolCall())
for try await message in messages {
// Handle incoming traffic
}
}
Returning out of the withClient scope closes and cleans up the connection.
This pattern can be wrapped in more domain specific use cases like a request/response style flow in the higher level APIs.
- 主要语言
- Swift
- 星标
- 1.6k
- 派生
- 270
- 平均合并
- 2 天 7 小时
- 30 天内合并 PR
- 15
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
modelcontextprotocol/swift-sdk 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 73/100
modelcontextprotocol/swift-sdk#327 ·
维护者通常 2 天内回复
-
Value decoding changes data-URL-looking JSON strings into Value.data可能已有人在做 @bitbemol 于 73 天前认领。 未关闭bug
难度 2/5 1-3 小时 新手友好度 76/100
modelcontextprotocol/swift-sdk#277 ·
维护者通常 2 天内回复
-
enhancement
难度 1/5 1 小时以内 新手友好度 78/100
modelcontextprotocol/swift-sdk#274 ·
维护者通常 2 天内回复
-
`HTTPClientTransport` fails to build on Windows: `#if !os(Linux)` guards no longer match the `EventSource` platform condition可能重新可做 关联的 PR 已关闭且未合并。 未关闭
难度 2/5 1-3 小时 新手友好度 85/100
modelcontextprotocol/swift-sdk#261 ·
维护者通常 2 天内回复
-
Client.withBatch leaves per-request tasks pending when transport.send throws可能已有人在做 @bbdu3 于 1 天前认领。 未关闭
难度 4/5 3-5 天 新手友好度 55/100
modelcontextprotocol/swift-sdk#324 · 2 条评论 · 1 个 reaction ·
维护者通常 2 天内回复
查看 modelcontextprotocol/swift-sdk 的全部 Issue
相似的 Issue
-
area: energy area: panel enhancement
难度 2/5 1-3 小时 新手友好度 63/100
Pallepadehat/WatchMyBattery#11 ·
维护者通常 1 天内回复
-
🎉 Add Ginkgo可能已有人在做 @usual2970 今天认领。 未关闭addition
难度 1/5 1 小时以内 新手友好度 76/100
jaywcjlove/awesome-mac#4442 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 66/100
DeveloperAcademy-POSTECH/2026-C6-A03-KIIKICK-iOS#76 ·
维护者通常 1 天内回复
-
难度 1/5 1 小时以内 新手友好度 91/100
维护者通常 2 天内回复
-
难度 2/5 1-3 小时 新手友好度 82/100