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

  1. Add SwiftMCP to Package.swift

    .package(url: "https://github.com/Cocoanetics/SwiftMCP.git", branch: "main")
  2. 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

Any MCP client

Listed in

swiftskills.dev

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