Swift MCP Toolkit
Strongly typed MCP tools in Swift
What is Swift MCP Toolkit?
Swift MCP Toolkit is a Model Context Protocol (MCP) server that allows AI assistants like Claude, Cursor, and VS Code to strongly typed mcp tools in swift
Strongly typed MCP tools in Swift
This server falls under the Developer Tools category on MCPgee, the world's largest MCP server directory with 33,000+ servers.
Features
- Strongly typed MCP tools in Swift
Use Cases
Maintainer
Works with
Installation
Manual Installation
npx swift-mcp-toolkitConfiguration
Configuration Details
claude_desktop_config.json
Performance
Response Metrics
Resource Usage
How to Set Up and Use Swift MCP Toolkit
Swift MCP Toolkit is a Swift Package Manager library that enables developers to build strongly typed MCP servers in Swift, with support for tools, resources, structured output, and both stdio and HTTP transport modes. It wraps the official swift-sdk MCP implementation with ergonomic Swift APIs including the @Schemable macro for automatic JSON Schema generation from Swift types, making it the natural choice for iOS/macOS developers building AI integrations.
Prerequisites
- Swift 5.9+ with Swift Package Manager (Xcode 15+ or Swift toolchain on Linux)
- Node.js (optional, for running the MCP Inspector testing tool)
- Vapor framework (automatically included for HTTP transport mode)
- Familiarity with Swift concurrency (async/await)
Add the package dependency
Add swift-mcp-toolkit to your Package.swift dependencies.
// Package.swift
dependencies: [
.package(url: "https://github.com/ajevans99/swift-mcp-toolkit.git", from: "0.1.0")
]Add MCPToolkit to your target
Include MCPToolkit as a dependency for the target that will host your MCP server.
// In your target definition:
.target(
name: "MyMCPServer",
dependencies: [
.product(name: "MCPToolkit", package: "swift-mcp-toolkit")
]
)Define a strongly typed tool
Use the @Schemable macro on your input struct and conform to the MCPTool protocol to create a tool with automatic parameter validation.
import MCPToolkit
@Schemable
struct GreetInput {
let name: String
let formal: Bool
}
struct GreetTool: MCPTool {
typealias Input = GreetInput
static let name = "greet"
static let description = "Greets a person by name"
func execute(_ input: GreetInput) async throws -> ToolResult {
let greeting = input.formal ? "Good day, \(input.name)." : "Hey \(input.name)!"
return .text(greeting)
}
}Start the MCP server in stdio mode
Create the server, register your tools, and run it using stdio transport for use with Claude Desktop.
import MCPToolkit
@main
struct MyServer {
static func main() async throws {
let server = MCPServer(name: "my-mcp-server", version: "1.0.0")
server.addTool(GreetTool())
try await server.run(transport: .stdio)
}
}Test with MCP Inspector (optional)
Use the MCP Inspector to interactively test your server before connecting it to Claude.
# Install inspector globally
npm install -g @modelcontextprotocol/inspector
# Test stdio transport
npx @modelcontextprotocol/inspector@latest swift run MyServer --transport stdio
# Test HTTP transport (start server first)
swift run MyServer --transport http
npx @modelcontextprotocol/inspector@latest --server-url http://127.0.0.1:8080/mcp --transport httpSwift MCP Toolkit Examples
Client configuration
Claude Desktop configuration for a Swift MCP server built with swift-mcp-toolkit, launched via swift run.
{
"mcpServers": {
"my-swift-server": {
"command": "swift",
"args": ["run", "--package-path", "/absolute/path/to/MyMCPServer", "MyServer", "--transport", "stdio"]
}
}
}Prompts to try
Once your Swift MCP server is registered, use these prompts to invoke the tools you have implemented.
- "Use the greet tool to say hello to Alice in a formal style"
- "List all available tools on the connected Swift MCP server"
- "Call the greet tool with name='Bob' and formal=false"Troubleshooting Swift MCP Toolkit
Build fails with 'No such module MCPToolkit'
Run 'swift package resolve' to download the dependency, then rebuild. Ensure the package URL and version in Package.swift exactly match the repository.
Server exits immediately when launched from Claude Desktop
Confirm your @main entry point calls 'try await server.run(transport: .stdio)' and does not exit before the run loop. Check that stdin/stdout are not being used for logging — direct all logs to stderr or a file.
@Schemable macro not recognized
The @Schemable macro requires the swift-json-schema package, which is included transitively by swift-mcp-toolkit. If it's missing, run 'swift package update' to fetch all transitive dependencies.
Frequently Asked Questions about Swift MCP Toolkit
What is Swift MCP Toolkit?
Swift MCP Toolkit is a Model Context Protocol (MCP) server that strongly typed mcp tools in swift It connects AI assistants to external tools and data sources through a standardized interface.
How do I install Swift MCP Toolkit?
Follow the installation instructions on the Swift MCP Toolkit GitHub repository. Clone the repo, install dependencies, and add the server config to your AI client.
Which AI clients work with Swift MCP Toolkit?
Swift MCP Toolkit works with all major MCP-compatible AI clients including Claude Desktop, Claude Code, Cursor, VS Code (GitHub Copilot), Windsurf, and Cline.
Is Swift MCP Toolkit free to use?
Yes, Swift MCP Toolkit is open source and available under the MIT license. You can use it freely in both personal and commercial projects.
Swift MCP Toolkit Alternatives — Similar Developer Tools Servers
Looking for alternatives to Swift MCP Toolkit? 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 Swift MCP Toolkit 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 Swift MCP Toolkit?
Browse our complete directory of 33,000+ MCP servers, read setup guides for your editor, and start building with the Model Context Protocol.