Python Apple MCP

by jxnl

Integrations

  • Enables interaction with Apple's ecosystem through AppleScript, allowing access to native macOS applications and their data.

  • Project is hosted on GitHub and supports contribution through GitHub's pull request workflow.

  • Allows sending, reading, and scheduling iMessages through the Messages application, including accessing conversation history.

Python Apple MCP(모델 컨텍스트 프로토콜)

FastMCP를 사용하여 연락처, 메모, 메일, 메시지, 알림, 캘린더, 지도와 같은 macOS 애플리케이션과의 상호작용을 처리하는 서버의 Python 구현입니다.

특징

  • AppleScript를 통해 macOS 기본 애플리케이션과 상호 작용
  • 더 나은 성능을 위한 비동기 작업
  • 포괄적인 오류 처리
  • Pydantic 모델을 사용한 유형 안전 인터페이스
  • 광범위한 테스트 범위
  • 쉬운 확장을 위한 모듈식 디자인

지원되는 애플리케이션

  • 콘택트 렌즈
  • 노트
  • 우편
  • 메시지
  • 알림
  • 달력
  • 지도

설치

  1. 저장소를 복제합니다.

지엑스피1

  1. 가상 환경 만들기:
python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate
  1. 종속성 설치:
pip install -r requirements.txt
  1. 테스트 종속성 설치(선택 사항):
pip install -r requirements-test.txt

용법

기본 예제

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()

개별 모듈 사용

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())

테스트

테스트 모음을 실행합니다.

pytest

적용 범위를 사용하여 테스트 실행:

pytest --cov=utils tests/

특정 테스트 파일 실행:

pytest tests/test_contacts.py

API 문서

연락처 모듈

  • find_contact(name: str) -> List[Contact] : 이름으로 연락처 검색
  • get_all_contacts() -> List[Contact] : 모든 연락처 가져오기
  • create_contact(name: str, phones: List[str]) -> Contact : 새로운 연락처를 만듭니다.

노트 모듈

  • find_note(query: str) -> List[Note] : 노트 검색
  • create_note(title: str, body: str, folder_name: str) -> Note : 새로운 노트를 만듭니다.
  • get_all_notes() -> List[Note] : 모든 노트를 가져옵니다.

메일 모듈

  • send_email(to: str, subject: str, body: str) -> str : 이메일 보내기
  • search_emails(query: str) -> List[Email] : 이메일 검색
  • get_unread_mails() -> List[Email] : 읽지 않은 이메일 가져오기

메시지 모듈

  • send_message(to: str, content: str) -> bool : iMessage 보내기
  • read_messages(phone_number: str) -> List[Message] : 메시지 읽기
  • schedule_message(to: str, content: str, scheduled_time: str) -> Dict : 메시지 예약

알림 모듈

  • create_reminder(name: str, list_name: str, notes: str, due_date: str) -> Dict : 알림 생성
  • search_reminders(query: str) -> List[Dict] : 알림 검색
  • get_all_reminders() -> List[Dict] : 모든 알림을 가져옵니다.

캘린더 모듈

  • create_event(title: str, start_date: str, end_date: str, location: str, notes: str) -> Dict : 이벤트 생성
  • search_events(query: str) -> List[Dict] : 이벤트 검색
  • get_events() -> List[Dict] : 모든 이벤트 가져오기

지도 모듈

  • search_locations(query: str) -> List[Location] : 위치 검색
  • get_directions(from_address: str, to_address: str, transport_type: str) -> str : 길찾기
  • save_location(name: str, address: str) -> Dict : 즐겨찾기에 위치 저장

기여하다

  1. 저장소를 포크하세요
  2. 기능 브랜치 생성
  3. 변경 사항을 커밋하세요
  4. 지점으로 밀어 넣기
  5. 풀 리퀘스트 만들기

특허

이 프로젝트는 MIT 라이선스에 따라 라이선스가 부여되었습니다. 자세한 내용은 라이선스 파일을 참조하세요.

-
security - not tested
F
license - not found
-
quality - not tested

AppleScript를 통해 macOS 기본 애플리케이션(연락처, 메모, 메일, 메시지, 알림, 캘린더, 지도)과 상호작용을 가능하게 하는 Python 서버로, 비동기 작업과 유형 안전 인터페이스를 제공합니다.

  1. Features
    1. Supported Applications
      1. Installation
        1. Usage
          1. Basic Example
          2. Using Individual Modules
        2. Testing
          1. API Documentation
            1. Contacts Module
            2. Notes Module
            3. Mail Module
            4. Messages Module
            5. Reminders Module
            6. Calendar Module
            7. Maps Module
          2. Contributing
            1. License
              ID: 8rl8q84uwz