Python Apple MCP is a server implementation that enables interaction with macOS native applications including Contacts, Notes, Mail, Messages, Reminders, Calendar, and Maps through AppleScript. It provides asynchronous operations, comprehensive error handling, and type-safe interfaces using Pydantic models.
Follow these steps to install the Python Apple MCP server:
git clone https://github.com/jxnl/python-apple-mcp.git
cd python-apple-mcp
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
pip install -r requirements.txt
To set up and run the MCP server:
from apple_mcp import FastMCP, Context
# Initialize FastMCP server
mcp = FastMCP("Apple MCP")
# Use the tools
@mcp.tool()
def find_contact(name: str) -> List[Contact]:
"""Search for contacts by name"""
# Implementation here
pass
# Run the server
if __name__ == "__main__":
mcp.run()
You can also use individual modules directly:
from utils.contacts import ContactsModule
from utils.notes import NotesModule
# Initialize modules
contacts = ContactsModule()
notes = NotesModule()
# Use the modules
async def main():
# Find a contact
contact = await contacts.find_contact("John")
# Create a note
await notes.create_note(
title="Meeting Notes",
body="Discussion points...",
folder_name="Work"
)
# Run the async code
import asyncio
asyncio.run(main())
# Example: Finding a contact
contact = await contacts.find_contact("John Doe")
# Example: Creating a contact
new_contact = await contacts.create_contact(
name="Jane Smith",
phones=["123-456-7890", "098-765-4321"]
)
# Example: Creating a note
new_note = await notes.create_note(
title="Project Ideas",
body="1. Develop new feature\n2. Fix bugs",
folder_name="Work Projects"
)
# Example: Finding notes
found_notes = await notes.find_note("project")
# Example: Sending an email
mail_module = MailModule()
result = await mail_module.send_email(
to="[email protected]",
subject="Meeting Invitation",
body="Please join us for a meeting tomorrow at 2 PM."
)
There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json
file so that it is available in all of your projects.
If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json
file.
To add a global MCP server go to Cursor Settings > MCP and click "Add new global MCP server".
When you click that button the ~/.cursor/mcp.json
file will be opened and you can add your server like this:
{
"mcpServers": {
"cursor-rules-mcp": {
"command": "npx",
"args": [
"-y",
"cursor-rules-mcp"
]
}
}
}
To add an MCP server to a project you can create a new .cursor/mcp.json
file or add it to the existing one. This will look exactly the same as the global MCP server example above.
Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.
The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.
You can also explictly ask the agent to use the tool by mentioning the tool name and describing what the function does.