MCPSwiftWrapper is a lightweight wrapper for mcp-swift-sdk, designed to integrate with LLM Swift libraries like SwiftOpenAI and SwiftAnthropic. It simplifies the creation of MCP Clients within macOS applications.
MCPSwiftWrapper is a lightweight Swift wrapper around the mcp-swift-sdk
, designed to integrate Model Context Protocol (MCP) functionality into macOS applications using LLM Swift libraries like SwiftOpenAI and SwiftAnthropic. MCP enables AI models to securely interact with local and remote resources through standardized server implementations, allowing them to discover and call tools with parameters and receive responses in a standard format.
Requirements: macOS 14.0+, Swift 6.0+, Xcode 16.0+, and npm/npx. Installation is via Swift Package Manager. Note that app sandboxing needs to be disabled in macOS apps.
Usage: The wrapper facilitates initializing MCP clients, fetching available tools, and handling tool calls for both Anthropic and OpenAI. It provides methods to convert MCP tools into formats compatible with Anthropic and OpenAI APIs. The Example/MCPClientChat
directory contains a complete example of a chat application using MCP with both Anthropic and OpenAI models. Licensed under MIT.
jamesrochabrun/MCPSwiftWrapper
March 6, 2025
March 28, 2025
Swift