SwiftMCP
@compiler-inc
About SwiftMCP
Overview
What is SwiftMCP?
SwiftMCP is a Swift Package that implements an MCP (Model Context Protocol) client for iOS and macOS, enabling native API integration through a JSON‑RPC interface. It also includes an OpenAI‑compatible function calling bridge, allowing LLMs to invoke Apple’s native APIs (e.g., HealthKit) directly from Swift applications.
How to use SwiftMCP?
Install the package via Swift Package Manager with the dependency https://github.com/compiler-inc/SwiftMCP.git from version 1.0.0. Create a ToolRegistry and MCPClient, register tools (like HealthKitTool), and send JSON‑RPC requests. For OpenAI integration, use OpenAIToolRegistry to convert MCP tools into OpenAI function definitions. For on‑device usage, use MLXToolRegistry together with an MLX model loaded via MLXModelFactory.
Key features of SwiftMCP
- Open source function definitions for Apple’s native APIs such as HealthKit
- JSON‑RPC 2.0 compliant interface
- OpenAI‑compatible function calling bridge
- On‑device MLX function calling (supports Mistral, Llama, and Phi models)
- Custom tool creation with the
MCPToolprotocol - Some test coverage
Use cases of SwiftMCP
- Integrate HealthKit step count and workout data into LLM‑powered conversational agents
- Enable an on‑device AI assistant to query health metrics without sending data to external APIs
- Build custom MCP tools that expose any iOS/macOS native capability to a language model
- Combine multiple LLM backends (OpenAI and local MLX) within a single app
FAQ from SwiftMCP
What platforms and Swift versions does SwiftMCP support?
SwiftMCP requires iOS 15.0+ / macOS 12.0+, Swift 6.0+, and Xcode 15.0+.
Does SwiftMCP include an actual MCP server?
No, SwiftMCP is a client library. It provides the MCPClient, tool registry, and bridges to connect to LLMs (via OpenAI or local MLX). The package does not include a server implementation.
Which MCP servers are supported?
The README does not list specific external MCP servers. The package is designed to handle JSON‑RPC requests from any compatible source (e.g., an OpenAI‑powered chat loop or a local MLX model). It does not yet detail integration with other MCP server implementations.
Is SwiftMCP free and open source?
Yes, the project is licensed under the MIT License and the code is publicly available on GitHub.
What are the current limitations of SwiftMCP?
The README notes that only “some test coverage” is present, and the goal is to add as many iOS APIs as possible. Currently only HealthKit tools are documented; other Apple APIs are not yet implemented.
Basic information
More Agent Frameworks MCP clients
Evo AI - AI Agents Platform
evolutionapiEvo AI is an open-source platform for creating and managing AI agents, enabling integration with different AI models and services.
Unified MCP Client Library
pietrozullomcp-use is the easiest way to interact with mcp servers with custom agents
Nerve
evilsocketThe Simple Agent Development Kit.
Saiki
truffle-aiA customizable, general purpose AI Agent that supports MCP. Talk to Saiki in natural language to control computers, applications and more!
Unified MCP Client Library
mcp-usemcp-use is the easiest way to interact with mcp servers with custom agents
Comments