swift-context-protocol
by 1amageek·★ 11·综合分 33
Swift实现的MCP服务器,使用分布式actor为AI上下文提供类型安全的工具、资源和提示。
概述
swift-context-protocol是Model Context Protocol的Swift实现,利用Swift的分布式actor模型实现工具、资源和提示的类型安全异步远程调用。它提供了ContextProtocol接口用于初始化、工具调用、资源读取和提示执行等操作。该实现支持输入和输出的JSON Schema验证,并使用WebSocket实现客户端和服务器之间的分布式通信。
试试问 AI
装完之后,这里有 5 个你可以让 AI 做的事:
什么时候选它
如果您正在使用 Swift 生态系统并且需要类型安全的分布式 AI 工具,并且希望利用 Swift 的演员模型,请选择此 MCP 服务器。
什么时候不要选它
如果您需要更广泛的语言支持,或者您的团队不使用 Swift 6+,请避免使用此服务器,因为分布式演员是 Swift 的较新功能。
此 server 暴露的工具
从 README 抽取出 7 个工具echoA tool that echoes the provided input.
listToolsRetrieves a list of all available tools.
listPromptsLists available prompt templates.
listResourcesRetrieves a list of all available resources.
readResourceReads content from a specified resource.
callToolInvokes and executes a specified tool with parameters.
getPromptRetrieves a prompt template based on input parameters.
可对比工具
安装
要安装swift-context-protocol,请将其添加到您的Package.swift依赖项中:
dependencies: [
.package(url: "https://github.com/1amageek/swift-context-protocol.git", from: "1.0.0")
]然后将其添加到您的目标依赖项中:
targets: [
.executableTarget(
name: "YourApp",
dependencies: [
"swift-context-protocol"
]
)
]对于Claude Desktop集成,通常会将服务器添加到您的configuration.json中,但这个Swift服务器可能需要额外的Swift环境设置。
FAQ
- 需要什么Swift版本?
- swift-context-protocol需要Swift 6.0或更高版本,以利用分布式actor模型。
- 分布式actor通信如何工作?
- 实现使用WebSocketActorSystem实现客户端和服务器之间的分布式通信。
swift-context-protocol 对比
最后更新于 · 由 README + GitHub 公开数据自动生成。