SwiftMCP
Swift package and macros for building MCP servers and clients over stdio, HTTP/SSE or TCP with Bonjour.
View on GitHub ↗- Stars
- ★ 163
- Last commit
- 19 Oct 2026
- Maintenance
- Active
- Licence
- BSD-2-Clause
- Category
- Other
- GitHub
- Cocoanetics/SwiftMCP
Overview
SwiftMCP from Cocoanetics is a Swift implementation of the Model Context Protocol, using JSON-RPC over several transports. You expose tools, resources and prompts from Swift code with macros, and it can also generate OpenAPI endpoints. It is for Swift developers building their own MCP servers or clients.
Features
- Transports: stdio, HTTP with Server-Sent Events, and TCP with Bonjour discovery
- Expose functions with @MCPTool, data with @MCPResource and prompts with @MCPPrompt
- Progress notifications, structured logging and parameter completions
- Built-in authorisation, optional OAuth validation and an OAuth proxy mode
- OpenAPI spec and AI plugin manifest generation
- Generates typed client proxies for any server
Requirements
The source doesn't list any requirements, so check the project's own docs before you install.
Install
Add SwiftMCP to Package.swift
.package(url: "https://github.com/Cocoanetics/SwiftMCP.git", branch: "main")Try the demo app
SwiftMCPDemo stdio
Example
Attach the @MCPServer macro to a class, mark its methods with @MCPTool and run it over stdio so Claude Desktop or another MCP client can call them.
Works with
Listed in
Read the code before you install anything. SwiftAgents doesn't review or endorse the tools listed here. Active: a commit in the last 90 days. Slowing: last commit within the past year. Stale: older than a year, or archived.
More in this category
apfel
Command-line tool, chat mode and local OpenAI-compatible server for the on-device model in Apple's FoundationModels framework. Needs macOS 26 and Apple silicon.
MCP Swift SDK
The official Swift SDK for building MCP clients and servers.
iCTRL
Runs a long-lived XCUITest on a real iPhone and exposes an HTTP API so agents can tap, type, read the UI and take screenshots. Meant for testing on your own devices.