# dhravya/apple-mcp architecture

> Architecture diagram of the GitHub repository dhravya/apple-mcp, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-03-30). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/dhravya/apple-mcp
- Repository: https://github.com/dhravya/apple-mcp

## Overview

##### Project Type & Purpose
- Recognize that the project isn’t a full-stack web app but rather a command-line interface (CLI) tool designed for interacting with Apple native apps.
- Its primary purpose is to process natural language commands (or structured requests) that trigger different utilities (messages, emails, notes, contacts, reminders, etc.) via the MCP protocol.
- The README makes it clear that the tool integrates with various Apple apps and can be chained together to create custom workflows.

##### Main Components Identification
- Entry Point – “index.ts”: Illustrate this as the primary entry point for the application where commands are initially received.
- Command Router / Coordinator – “tools.ts”: This file likely contains logic that directs incoming commands to the respective utility modules.

##### Component Relationships & Interactions
- “tools.ts” then routes these commands to the appropriate utility module within “utils” (each module being its own component, e.g., messages, notes, contacts, emails, reminders).
- If applicable, indicate any feedback loops or return routes where modules send their output back to be aggregated or returned to the CLI for display.
- Optionally, include an external component representing the MCP protocol integration—illustrate how commands can be “daisy-chained” to work seamlessly with other systems (as described in the README).

##### Architectural Patterns & Principles
- Clear separation of concerns by showing how each utility module handles a specific feature.

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "CLI Layer"
        cli("CLI Invocation"):::core
    end

    subgraph "Core Components"
        indexEntry("index.ts (Entry Point)"):::core
        tools("tools.ts (Command Router)"):::core
    end

    cli -->|"process_command"| indexEntry
    indexEntry -->|"dispatch_command"| tools

    subgraph "Utility Modules"
        messages("Messages Module"):::utility
        notes("Notes Module"):::utility
        reminders("Reminders Module"):::utility
        emails("Emails Module"):::utility
        contacts("Contacts Module"):::utility
        calendar("Calendar Module"):::utility
        webSearch("Web Search Module"):::utility
    end

    tools -->|"route:messages"| messages
    tools -->|"route:notes"| notes
    tools -->|"route:reminders"| reminders
    tools -->|"route:emails"| emails
    tools -->|"route:contacts"| contacts
    tools -->|"route:calendar"| calendar
    tools -->|"route:webSearch"| webSearch

    messages -->|"response"| tools
    notes -->|"response"| tools
    reminders -->|"response"| tools
    emails -->|"response"| tools
    contacts -->|"response"| tools
    calendar -->|"response"| tools
    webSearch -->|"response"| tools

    tools -->|"return_output"| cli

    subgraph "External Integration"
        mcp("MCP Protocol Integration"):::external
    end

    tools -->|"via_MCP"| mcp

    subgraph "Build & Config Files"
        pkg("package.json"):::config
        tsconfig("tsconfig.json"):::config
        bun("bun.lockb"):::config
        github(".github"):::config
        license("LICENSE"):::config
        readme("README.md"):::config
    end

    click indexEntry "https://github.com/dhravya/apple-mcp/blob/main/index.ts"
    click tools "https://github.com/dhravya/apple-mcp/blob/main/tools.ts"
    click messages "https://github.com/dhravya/apple-mcp/blob/main/utils/message.ts"
    click notes "https://github.com/dhravya/apple-mcp/blob/main/utils/notes.ts"
    click reminders "https://github.com/dhravya/apple-mcp/blob/main/utils/reminders.ts"
    click emails "https://github.com/dhravya/apple-mcp/blob/main/utils/mail.ts"
    click contacts "https://github.com/dhravya/apple-mcp/blob/main/utils/contacts.ts"
    click calendar "https://github.com/dhravya/apple-mcp/blob/main/utils/calendar.ts"
    click webSearch "https://github.com/dhravya/apple-mcp/blob/main/utils/webSearch.ts"
    click pkg "https://github.com/dhravya/apple-mcp/blob/main/package.json"
    click tsconfig "https://github.com/dhravya/apple-mcp/blob/main/tsconfig.json"
    click bun "https://github.com/dhravya/apple-mcp/blob/main/bun.lockb"
    click github "https://github.com/dhravya/apple-mcp/blob/main/.github"
    click license "https://github.com/dhravya/apple-mcp/tree/main/LICENSE"
    click readme "https://github.com/dhravya/apple-mcp/blob/main/README.md"

    classDef core fill:#ffd700,stroke:#333,stroke-width:2px;
    classDef utility fill:#87cefa,stroke:#333,stroke-width:2px;
    classDef external fill:#90ee90,stroke:#333,stroke-width:2px;
    classDef config fill:#d3d3d3,stroke:#333,stroke-width:2px;
```
