MCP Directory
ServersClientsBlog

xASO - App Store Optimization

AI-powered App Store Optimization platform for mobile apps

Go to xASO
MCP Directory

Model Context Protocol Directory

MKSF LTD
Suite 8805 5 Brayford Square
London, E1 0SG

MCP Directory

  • About
  • Blog
  • Documentation
  • Contact

Menu

  • Servers
  • Clients

© 2025 model-context-protocol.com

The Model Context Protocol (MCP) is an open standard for AI model communication.
Powered by Mert KoseogluSoftware Forge
  1. Home
  2. Servers
  3. swift-sdk

swift-sdk

GitHub

This repository provides a Swift SDK for implementing the Model Context Protocol (MCP), enabling developers to build clients and servers that can interact with models and tools. It supports macOS

992
11

MCP Swift SDK

This is the Swift implementation of the Model Context Protocol (MCP).

Requirements

  • Swift 6.0+ / Xcode 16+
  • macOS 14.0+ (Sonoma)
  • iOS 17.0+

Installation

Swift Package Manager

To install, add the package dependency to your Package.swift file, referencing the GitHub repository.

Usage

Basic Client Setup

Initialize a client with a name and version, create a StdioTransport, connect, and initialize the connection.

Basic Server Setup

Initialize a server with capabilities for prompts, resources (with subscribe enabled), and tools. Start the server with StdioTransport. Register method handlers (e.g., ReadResource) and notification handlers (e.g., ResourceUpdatedNotification). Stop the server when finished.

Working with Tools

List available tools, call a tool with arguments, and handle the returned content, which can be text or image data.

Working with Resources

List available resources, read a resource by URI, subscribe to resource updates, and handle ResourceUpdatedNotification messages.

Working with Prompts

List available prompts and retrieve a prompt with specified arguments to obtain a description and messages.

License

This project is licensed under the Apache License, Version 2.0.

Repository

MO
modelcontextprotocol

modelcontextprotocol/swift-sdk

Created

February 5, 2025

Updated

March 28, 2025

Language

Swift

Category

AI