FoundationModels

FoundationModels

An MCP server that integrates Apple's FoundationModels for text generation.

5
Stars
1
Forks
0
Releases

Overview

foundation-models is a Model Context Protocol (MCP) server that provides text generation capabilities by leveraging Apple's Foundation Models framework running on macOS. It enables MCP clients to perform private, on-device language model inference, ensuring user data does not leave the device. Implemented in Swift, it uses the MCP Swift SDK and adheres to the Model Context Protocol, with a focus on secure and private generation workflows. The server is designed to run on macOS 26.0 or later (macOS Tahoe) on Apple Silicon for best performance, and is built using standard Swift tooling (swift-argument-parser for CLI, swift-service-lifecycle for graceful startup/shutdown). Build from source via swift build -c release, producing the executable at .build/release/mcp-foundation-models. The README also describes how to wire the server into Claude Desktop via the mcpServers configuration, enabling seamless integration. It supports environment-based configuration through SYSTEM_INSTRUCTIONS to set default system prompts and DEBUG to enable verbose logging. Dependencies include swift-argument-parser, swift-sdk (MCP), and swift-service-lifecycle. The project is MIT-licensed, with a TODO for session history management.

Details

Owner
phimage
Language
Swift
License
MIT License
Updated
2025-12-07

Features

Apple Foundation Models Integration

Leverages Apple's on-device language models for text generation to enable private, on-device inference.

MCP Protocol Implementation

Implements the Model Context Protocol for MCP clients using the swift-sdk.

Environment-based Configuration

Supports runtime configuration via environment variables, including SYSTEM_INSTRUCTIONS and DEBUG for prompts and debugging.

Graceful Service Lifecycle

Uses swift-service-lifecycle for clean startup and shutdown handling.

Command-line Argument Parsing

Parses and processes CLI arguments using swift-argument-parser.

Claude Desktop Integration

Can be registered in Claude Desktop's mcpServers config to route requests to the Foundation Models MCP server.

Audience

MCP clientsAccess Apple's on-device Foundation Models for private, secure text generation through MCP.
Mac developersIntegrate private on-device text generation into macOS applications via MCP.
Claude Desktop usersConfigure Claude Desktop to route MCP foundation-models requests to the on-device server.

Tags

Foundation ModelsOn-deviceApple Foundation ModelsMCPText generationmacOSSwiftApple SiliconPrivacyClaude Desktop integration