An Osaurus plugin for interacting with macOS Messages.app. Send and read iMessages programmatically. Based on apple-mcp message.ts.
Grant permission in:
- System Settings > Privacy & Security > Automation
Add the application using this plugin (e.g., Osaurus, or your terminal if running from CLI) and enable access to Messages.
Grant permission in:
- System Settings > Privacy & Security > Full Disk Access
Add the application using this plugin. This is required to access the Messages database at ~/Library/Messages/chat.db.
Send an iMessage to a phone number.
Parameters:
phoneNumber(required): The recipient's phone number (e.g.,+1234567890or1234567890)message(required): The message content to send
Example:
{
"phoneNumber": "+15551234567",
"message": "Hello from Osaurus!"
}Response:
{
"success": true,
"message": "Message sent to +15551234567"
}Read message history from a specific contact.
Parameters:
phoneNumber(required): The contact's phone number to read messages fromlimit(optional): Maximum number of messages to return (default: 10, max: 50)
Example:
{
"phoneNumber": "+15551234567",
"limit": 5
}Response:
[
{
"content": "Hey, how are you?",
"date": "2024-01-15 14:30:00",
"sender": "+15551234567",
"isFromMe": false,
"attachments": null
},
{
"content": "I'm good, thanks!",
"date": "2024-01-15 14:32:00",
"sender": "+15551234567",
"isFromMe": true,
"attachments": null
}
]Get all unread messages from all contacts.
Parameters:
limit(optional): Maximum number of messages to return (default: 10, max: 50)
Example:
{
"limit": 10
}Response:
[
{
"content": "Are you coming to the meeting?",
"date": "2024-01-15 15:00:00",
"sender": "+15559876543",
"isFromMe": false,
"attachments": null
}
]All message-related tools return messages in this format:
| Field | Type | Description |
|---|---|---|
content |
string |
The message text content |
date |
string |
Date/time the message was sent (local time) |
sender |
string |
Phone number or email of the sender |
isFromMe |
boolean |
Whether you sent this message |
attachments |
string[] |
List of attachment indicators (if any) |
-
Build:
swift build -c release cp .build/release/libosaurus-messages.dylib ./libosaurus-messages.dylib
-
Install locally:
osaurus tools install .
codesign --force --options runtime --timestamp \
--sign "Developer ID Application: Your Name (TEAMID)" \
.build/release/libosaurus-messages.dylibosaurus tools package osaurus.messages 0.1.0This creates osaurus.messages-0.1.0.zip for distribution.
This error means the application doesn't have Full Disk Access. To fix:
- Open System Settings > Privacy & Security > Full Disk Access
- Click the lock icon to make changes
- Add the application (Terminal.app, iTerm.app, or Osaurus)
- Restart the application
This typically means:
- Messages.app is not set up or logged in
- The phone number format is incorrect
- Automation permissions haven't been granted
Ensure you've granted Automation permissions and that Messages.app is properly configured with your iMessage account.
- apple-mcp by supermemoryai