# MCPSwiftWrapper

> MCP Client

MCPSwiftWrapper is a lightweight wrapper for mcp-swift-sdk, designed to integrate with LLM Swift libraries like SwiftOpenAI and SwiftAnthropic. It simplifies the creation of MCP Clients within macOS applications.

## Overview

- **Category:** AI
- **Language:** Swift
- **Stars:** 36
- **Forks:** 0
- **Owner:** jamesrochabrun
- **GitHub:** https://github.com/jamesrochabrun/MCPSwiftWrapper
- **Created:** 2025-03-06T07:15:14+00:00
- **Updated:** 2025-03-28T18:58:21+00:00
- **Source:** https://model-context-protocol.com/clients/swift-mcp-client-wrapper-macos-integration

## Setup

## Setup

1.  **Requirements:**
    - macOS 14.0+
    - Swift 6.0+
    - Xcode 16.0+
    - [npm/npx](https://www.npmjs.com/package/npx) installed on your system

2.  **Installing npm/npx:**
    - Install via Homebrew:
      ```bash
      brew install node
      ```
    - Or download and install directly from the [Node.js website](https://nodejs.org/)
    - Verify installation:
      ```bash
      npx --version
      ```

3.  **Installation via Swift Package Manager:**
    - Add the following dependency to your `Package.swift` file:
      ```swift
      dependencies: [
          .package(url: "https://github.com/jamesrochabrun/MCPSwiftWrapper", from: "1.0.0")
      ]
      ```
    - Or add it directly in Xcode:
      1.  File > Add Package Dependencies
      2.  Enter the GitHub URL: `https://github.com/jamesrochabrun/MCPSwiftWrapper`
      3.  Click Add Package

4.  **Important:** Disable app sandboxing in your app's entitlements file when building a client macOS app.

## Tools

## Available Tools

1.  **MCPClient Initialization:** (Initialize an MCP client to connect to a tool provider.)
2.  **GitHub MCP Client Example:** (Provides an example of creating a GitHub MCP client.)
3.  **Anthropic Integration:** (Provides methods to get tools for Anthropic and handle tool calls for Anthropic models.)
4.  **OpenAI Integration:** (Provides methods to get tools for OpenAI and handle tool calls for OpenAI models.)
5.  **Example Application:** (Includes a complete example application in the `Example/MCPClientChat` directory for a full implementation of a chat application using MCP with both Anthropic and OpenAI models.)
