swift-mcp-server-generator

Generate a complete Model Context Protocol server project in Swift using the official MCP Swift SDK.

1|1|Updated Jan 29, 2026
One-click install
npx skills add https://github.com/ultraviollettnympho/transit-ticket --skill swift-mcp-server-generator-ultraviollettnympho
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: swift-mcp-server-generator
Source: https://github.com/ultraviollettnympho/transit-ticket/tree/main/.github/skills/swift-mcp-server-generator
Command: npx skills add https://github.com/ultraviollettnympho/transit-ticket --skill swift-mcp-server-generator-ultraviollettnympho

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Building a Model Context Protocol server in Swift from scratch requires wiring together the MCP Swift SDK, logging, service lifecycle management, and handler registration for tools, resources, and prompts, which is repetitive and error-prone without a proven template. ## Core Features & Use Cases - Full Project Scaffolding: Generates Package.swift, main.swift, Server.swift, and organized Tools, Resources, and Prompts directories with definitions and handlers. - Production Patterns Included: Templates use swift-log for structured logging, swift-service-lifecycle for graceful shutdown, actor-based state for thread safety, and async/await throughout. - Tests and Integration: Includes XCTest unit tests for handlers and instructions for registering the server in Claude Desktop's configuration. - Use Case: A developer wants to expose a custom tool to Claude Desktop. Ask for a Swift MCP server, receive a complete compilable project with greet and calculate example tools, resource subscriptions, and a code-review prompt, ready to build with swift build. ## Quick Start Ask the AI to generate a Swift MCP server project named after your service using the official MCP Swift SDK.

Frequently Asked Questions about swift-mcp-server-generator

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I create an MCP server in Swift?

Create a Swift package depending on the modelcontextprotocol/swift-sdk package, then define a Server with capabilities and register handlers for tools, resources, and prompts. Run it over StdioTransport and connect it from a client like Claude Desktop.

What dependencies does a Swift MCP server need?

The generated project uses the official MCP Swift SDK for protocol handling, apple/swift-log for structured logging, and swift-server/swift-service-lifecycle for graceful shutdown on SIGTERM and SIGINT signals.

How do I connect a Swift MCP server to Claude Desktop?

Build the executable with swift build -c release, then add an entry to claude_desktop_config.json under mcpServers with the command pointing to the compiled binary path. Claude Desktop launches the server over stdio.

Does the Swift MCP SDK support resource subscriptions?

Yes, the server template declares resource capabilities with subscribe and listChanged enabled, and implements ResourceSubscribe and ResourceUnsubscribe handlers backed by an actor that tracks subscribed URIs safely across concurrency domains.

What Swift version is required for an MCP server?

The generated Package.swift specifies swift-tools-version 6.0 and targets macOS 13, iOS 16, watchOS 9, tvOS 16, and visionOS 1 or later. The code uses modern concurrency features like async/await and actors.