SwiftMCP
Swift MCP SDK — Model Context Protocol client + server
What is SwiftMCP?
SwiftMCP is a Model Context Protocol (MCP) server that allows AI assistants like Claude, Cursor, and VS Code to swift mcp sdk — model context protocol client + server
Swift MCP SDK — Model Context Protocol client + server
This server falls under the Developer Tools category on MCPgee, the world's largest MCP server directory with 33,000+ servers.
Features
- Swift MCP SDK — Model Context Protocol client + server
Use Cases
Maintainer
Works with
Installation
Manual Installation
npx swiftmcpConfiguration
Configuration Details
claude_desktop_config.json
Performance
Response Metrics
Resource Usage
How to Set Up and Use SwiftMCP
SwiftMCP is a native Swift SDK that implements both the server and client sides of the Model Context Protocol, enabling Apple-platform developers to build MCP-enabled tools and AI integrations using idiomatic Swift. It provides macro-based annotations (@MCPTool, @MCPResource, @MCPPrompt) so developers can expose Swift functions as MCP tools with minimal boilerplate, and supports HTTP/SSE, TCP, and stdio transports. It is aimed at iOS, macOS, and server-side Swift developers who want to integrate AI assistant capabilities into their applications or create custom MCP servers in Swift.
Prerequisites
- Swift 6.1 or newer (Swift toolchain from swift.org or Xcode 16+)
- Swift Package Manager (included with Swift)
- For server transport: NIO-compatible networking (included via swift-nio dependency)
- For OAuth: a configured OAuth provider with issuer URL and credentials
Add SwiftMCP to your Swift package
Add the SwiftMCP dependency to your Package.swift file. Use the 'main' branch for the latest features or pin to a specific tag for stability.
// Package.swift
.package(url: "https://github.com/Cocoanetics/SwiftMCP.git", branch: "main")Add the target dependency
Include SwiftMCP in your target's dependencies list inside Package.swift.
.target(
name: "MyServer",
dependencies: [
.product(name: "SwiftMCP", package: "SwiftMCP")
]
)Define your MCP server with macros
Create a class annotated with @MCPServer and mark each function you want to expose with @MCPTool. SwiftMCP generates all the protocol scaffolding automatically.
import SwiftMCP
@MCPServer
class MyServer {
@MCPTool
func greet(name: String) -> String {
return "Hello, \(name)!"
}
@MCPTool
func add(a: Int, b: Int) -> Int {
return a + b
}
}Start the server on a transport
Instantiate your server and attach a transport. Use stdio for MCP client integration (Claude Desktop), HTTP/SSE for web-accessible endpoints, or TCP for direct connections.
// stdio (for Claude Desktop / Claude Code integration)
let server = MyServer()
let transport = StdioTransport(server: server)
try transport.run()
// HTTP/SSE
let httpTransport = HTTPSSETransport(server: server, port: 8080)
try httpTransport.run()Configure your MCP client to connect
For Claude Desktop, build the server executable and point the MCP config at it. For HTTP/SSE mode, point at the running server's URL.
{
"mcpServers": {
"my-swift-server": {
"command": "/path/to/MyServer",
"args": ["stdio"]
}
}
}SwiftMCP Examples
Client configuration
Claude Desktop configuration for a SwiftMCP server binary running in stdio mode.
{
"mcpServers": {
"my-swift-mcp-server": {
"command": "/Users/you/.build/release/MyServer",
"args": ["stdio"]
}
}
}Prompts to try
Once a SwiftMCP server with custom tools is running, you can invoke those tools through natural language.
- "Call the greet tool with the name 'Alice'"
- "Use the add tool to calculate 42 + 58"
- "List all available tools exposed by the Swift server"
- "Fetch the resource at uri 'file:///Users/me/docs/readme.md' from the server"
- "Run the 'summarize' prompt with the provided text"Troubleshooting SwiftMCP
Build fails with 'requires Swift tools version 6.1'
Update your Package.swift swift-tools-version header to 6.1 and install Swift 6.1 or newer from swift.org or by upgrading Xcode to version 16+.
Server trait causes linker errors on Windows
The Server trait pulls in swift-nio and swift-certificates which have limited Windows support. Disable the Server trait in Package.swift traits configuration and use only the Client or stdio transport on Windows.
Claude Desktop shows the server as disconnected
Ensure the built binary path in the config is absolute and the binary has execute permissions (`chmod +x /path/to/MyServer`). Test the binary directly in a terminal with the 'stdio' argument to confirm it starts without errors.
Frequently Asked Questions about SwiftMCP
What is SwiftMCP?
SwiftMCP is a Model Context Protocol (MCP) server that swift mcp sdk — model context protocol client + server It connects AI assistants to external tools and data sources through a standardized interface.
How do I install SwiftMCP?
Follow the installation instructions on the SwiftMCP GitHub repository. Clone the repo, install dependencies, and add the server config to your AI client.
Which AI clients work with SwiftMCP?
SwiftMCP works with all major MCP-compatible AI clients including Claude Desktop, Claude Code, Cursor, VS Code (GitHub Copilot), Windsurf, and Cline.
Is SwiftMCP free to use?
Yes, SwiftMCP is open source and available under the BSD-2-Clause license. You can use it freely in both personal and commercial projects.
SwiftMCP Alternatives — Similar Developer Tools Servers
Looking for alternatives to SwiftMCP? Here are other popular developer tools servers you can use with Claude, Cursor, and VS Code.
Ecc
★ 188.2kThe agent harness performance optimization system. Skills, instincts, memory, security, and research-first development for Claude Code, Codex, Opencode, Cursor and beyond.
Javaguide
★ 155.8kJava 面试 & 后端通用面试指南,覆盖计算机基础、数据库、分布式、高并发、系统设计与 AI 应用开发
Gemini CLI
★ 104.5kA secure MCP server that wraps the Google Gemini CLI, allowing clients to query Gemini models using local OAuth sessions without requiring an API key. It provides tools for model interaction and diagnostics with built-in protection against command in
Awesome MCP Servers
★ 87.3k⭐ Curated list of Model Context Protocol (MCP) servers - tools that extend Claude Desktop, Cursor, Windsurf, and other MCP clients with custom capabilities.
MCP Servers
★ 86.0kModel Context Protocol Servers
CC Switch
★ 77.5kA cross-platform desktop All-in-One assistant for Claude Code, Codex, OpenCode, OpenClaw, Gemini CLI & Hermes Agent. Only official website: ccswitch.io
Browse More Developer Tools MCP Servers
Explore all developer tools servers available in the MCPgee directory. Each server includes setup guides for Claude, Cursor, and VS Code.
Set Up SwiftMCP in Your Editor
Choose your AI client for step-by-step setup instructions.
Quick Config Preview
Add this to your claude_desktop_config.json or .cursor/mcp.json
Ready to use SwiftMCP?
Browse our complete directory of 33,000+ MCP servers, read setup guides for your editor, and start building with the Model Context Protocol.