Swift MCP Toolkit

v1.0.0Developer Toolsstable

Strongly typed MCP tools in Swift

swift-mcp-toolkitmcpai-integration
Share:
11
Stars
0
Downloads
0
Weekly
0/5

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

Build strongly typed MCP tools in Swift for type-safe AI integrations.
ajevans99

Maintainer

LicenseMIT
Languageswift
Versionv1.0.0
UpdatedMay 12, 2026
Statushealthy
Maintenanceactive

Works with

ClaudeOpenAIwindowsmacoslinux

Installation

Manual Installation

npx swift-mcp-toolkit

Configuration

Configuration Details

Config File

claude_desktop_config.json

Performance

Response Metrics

Response Time< 200ms
ThroughputMedium

Resource Usage

Memory UsageLow
CPU UsageLow

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)
1

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")
]
2

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")
  ]
)
3

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)
  }
}
4

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)
  }
}
5

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 http

Swift 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.

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.

Quick Config Preview

{ "mcpServers": { "swift-mcp-toolkit": { "command": "npx", "args": ["-y", "swift-mcp-toolkit"] } } }

Add this to your claude_desktop_config.json or .cursor/mcp.json

Read the full setup guide →

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.

33,000+ ServersFree & Open SourceStep-by-Step Guides