SwiftMCP
Swift package and macros for building MCP servers and clients over stdio, HTTP/SSE or TCP with Bonjour.
View on GitHub ↗- Stars
- ★ 166
- Last commit
- 4 Dec 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
Osaurus
A native Swift agent harness for macOS on Apple silicon, with local MLX or Foundation Models, optional cloud providers, persistent memory, skills, tools, automations and a local OpenAI-compatible server.
serve-sim
Streams a booted iOS Simulator to your browser, with touch, keyboard, screen recording and accessibility refs, so agents such as Codex, Cursor and Claude can see and drive it. By Evan Bacon, who develops Expo.
MCP Swift SDK
The official Swift SDK for building MCP clients and servers.
SwiftAgents