SwiftMCP
@compiler-inc
Basic information
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.
More Agent Frameworks MCP clients
🌟 MCPM - Model Context Protocol Manager
pathintegral-instituteCLI MCP package manager & registry for all platforms and all clients. Search & configure MCP servers. Advanced Router & Profile features.
MCP CLI - Model Context Protocol Command Line Interface
chrishayukMCP Agent Graph (MAG)
keta1930MCP Agent Graph (MAG) is an agent development framework for rapidly building agent systems. This project is based on graphs, nodes, and MCP to quickly construct complex Agent systems.
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.
Comments