$ show carterlasalle/mac_messages_mcp
Mac Messages MCP is a Python application that provides an MCP (Model Context Protocol) server for interacting with macOS Messages. It enables AI assistants like Claude Desktop, Cursor, and others to read, search, and send messages through the native Messages app using standard input/output communication. The application directly accesses the macOS Messages and AddressBook SQLite databases, uses AppleScript for sending messages with automatic SMS/RCS fallback, and provides tools for message retrieval, contact search, fuzzy message search, attachment handling, and permission diagnostics. The architecture follows a clean separation of concerns with the MCP server handling protocol communication, and the messages module containing all core business logic for interacting with macOS systems.
The LLM identified 4 files worth highlighting for reuse:
Provides robust escaping for AppleScript strings with proper handling of escape order (backslashes before quotes) and Unicode line/paragraph separators (U+2028/U+2029). This function prevents injection vulnerabilities and ensures special characters are properly handled when interfacing with AppleScript. Demonstrates defensive programming and deep understanding of AppleScript's escaping requirements.
Implements sophisticated token-based fuzzy matching for contact names that handles first name searches, prefix matching, and fuzzy matching on individual tokens. Goes beyond simple string similarity to provide intuitive name resolution that matches how people actually search for contacts. Demonstrates domain-specific understanding of naming patterns and user search behavior.
Provides bidirectional conversion between Unix timestamps and Apple's epoch format (nanoseconds since 2001-01-01). Correctly handles both the legacy second-format timestamps found in older macOS versions and the newer nanosecond-format timestamps. Demonstrates deep understanding of Apple's internal timestamp storage mechanisms and careful handling of format variations.
Converts raw database rows from the Messages attachment join into a standardized metadata format. Recognizes that database-stored file sizes can be unreliable and verifies with the actual file system when possible. Demonstrates defensive programming principles and understanding of how to handle potentially stale or incorrect data in database systems.