Get the FREE Ultimate OpenClaw Setup Guide →

swift-fast

The fastest way to build MCP servers in Swift.

Installation
Run this command in your terminal to add the MCP server to Claude Code.
Run in terminal:
Command
claude mcp add --transport stdio mehmetbaykar-swift-fast-mcp docker run -i mehmetbaykar/swift-fast-mcp

How to use

FastMCP provides a Swift-based framework to build MCP servers with a fluent builder API. You define your server name, add tools, resources, and prompts, then run it. Tools are MCPTool conforming types that implement a call(with:) method and are automatically exposed via a generated schema. Resources expose data to AI models, and Prompts provide reusable templates for conversations. The README demonstrates a minimal get-started flow using FastMCP.builder().name(...).addTools([...]).run(), and shows more complex usage including resources and prompts, sampling options, and transport configurations. To connect to Claude Desktop, you typically choose a transport (stdio, in-memory, or a custom transport) and configure Claude with your server’s name and path. In short, you get a production-ready MCP server with built-in tooling, resources, prompts, and lifecycle management, written in Swift and designed to minimize boilerplate.

How to install

Prerequisites:

  • macOS 14+ (as recommended by the project) and Swift 6.2+ installed
  • Xcode or Swift toolchain with Swift Package Manager (SPM)
  1. Install Swift (if not already installed)

    • macOS: Install Xcode or download the Swift toolchain from Apple or swift.org
    • Verify: swift --version
  2. Create a new Swift project or use the provided Swift package approach

    • Initialize a new package if starting from scratch: swift package init --type executable
  3. Add the swift-fast-mcp dependency to your Package.swift dependencies: [ .package(url: "https://github.com/mehmetbaykar/swift-fast-mcp", from: "1.0.2") ] And add the corresponding target: .target(name: "YourServer", dependencies: ["FastMCP"])

  4. Build and run locally

    • Build: swift build
    • Run: swift run YourServer
  5. Optional: Docker-based deployment (using the provided MCP server image)

    • Ensure Docker is installed and running
    • Start the server with the container image, or adapt the image to your project setup
  6. Verify connectivity

    • Connect via Claude Desktop or your configured transport and ensure the MCP server registers under its configured name.

Additional notes

Tips:

  • The builder API is highly declarative: you can chain calls to configure name, version, tools, resources, prompts, sampling, transport, logger, and lifecycle hooks.
  • Tools, Resources, and Prompts are defined as Swift types that conform to MCPTool, MCPResource, and MCPPrompt respectively; use @Schemable for typed parameters to auto-generate schemas.
  • If you plan to integrate with Claude Desktop, configure the appropriate transport (stdio for Claude Desktop) and provide the server path in claude_desktop_config.json.
  • Ensure your environment variables and file paths are correctly mapped when running inside Docker; expose necessary ports and volumes if your tools require I/O.
  • Check for graceful shutdown and lifecycle hooks to avoid abrupt terminations during updates or redeployments.

Related MCP Servers

Sponsor this space

Reach thousands of developers