ModelContextProtocol is an under-development Swift 6.0 implementation of Anthropic's Model Context Protocol (MCP), with the goal of providing an easy-to-use, pluggable Swift Package for MCP use across macOS, iOS, + Linux.
The package is split into three components:
- MCPCore: The core data types and functionality shared between the MCPClient and MCPServer.
- MCPClient: A relatively simple implementation for an MCPClient.
- MCPServer: An interface for a server to provide MCP functionality.
While the direction of the project is subject to change, the server implementation will likely be dependent on (and agnostic towards) external server frameworks such as Vapor or Hummingbird for flexible implementation into existing server applications.
⚠️ Note: This SDK is under active development. APIs may change as progress continues.
- 🏃 Modern Swift Concurrency - Built with Swift 6.0, leveraging actors, async/await, + Sendable
- 🔒 Type-Safe - Full type safety for all MCP messages and operations
- 🔌 Multiple Transports - Support for stdio and Server-Sent Events (SSE)
- ⚡️ Performance - Efficient message handling with timeout and retry support
- 🛠 Rich Capabilities - Support for resources, prompts, tools, and more
- 📦 SwiftPM Ready - Easy integration through Swift Package Manager
- Read the MCP Specification
- Fork the repository
- Create a feature branch
- Add tests for new functionality
- Submit a pull request
- StdioTransport does not work in sandboxed environments