# hstern/activesync-mcp architecture

> Architecture diagram of the GitHub repository hstern/activesync-mcp, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-18). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/hstern/activesync-mcp
- Repository: https://github.com/hstern/activesync-mcp

## Overview

activesync-mcp is an MCP server that lets MCP clients read and manage Exchange ActiveSync mailbox data. The main runtime path starts in the CLI, loads account configuration, opens persistent state, builds the EAS manager and MCP server, then serves tool calls over stdio. Tool surfaces cover email, calendar, contacts, tasks, notes, directory search, settings, folders, and administration; optional push notifications report server-side changes. Setup, diagnostics, authentication, and durable sync state support that workflow. Several tool modules are indexed but not excerpted, so their internal call details are not inferred.

Main entry points: [`cmd/activesync-mcp/main.go`](https://github.com/hstern/activesync-mcp/blob/main/cmd/activesync-mcp/main.go) (CLI dispatch), [`lib/server/server.go`](https://github.com/hstern/activesync-mcp/blob/main/lib/server/server.go) (MCP server), [`lib/config/config.go`](https://github.com/hstern/activesync-mcp/blob/main/lib/config/config.go) (Account config), [`lib/server/manager.go`](https://github.com/hstern/activesync-mcp/blob/main/lib/server/manager.go) (EAS manager)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["CLI and setup"]
  node_cli["CLI dispatch<br/>[main.go]"]
  node_setup["Setup TUI<br/>[setup_tui.go]"]
  node_saveconfig["Config writer<br/>[setup_save.go]"]
  node_doctor["Account diagnostics<br/>[doctor.go]"]
end

subgraph group_runtime["MCP runtime"]
  node_mcp["MCP server<br/>[server.go]"]
  node_manager["EAS manager<br/>[manager.go]"]
end

subgraph group_mailbox["Mailbox tools"]
  node_emailread["Email reading<br/>[tools_email.go]"]
  node_emailwrite["Email mutations"]
  node_calendar["Calendar tools<br/>[tools_calendar.go]"]
  node_pim["Contacts tasks notes<br/>[tools_pim.go]"]
  node_extras["Folders and extras<br/>[tools_extras.go]"]
end

subgraph group_identity["Configuration and auth"]
  node_config["Account config<br/>[config.go]"]
  node_access["Write access policy<br/>[access.go]"]
  node_tls["TLS configuration<br/>[tls.go]"]
  node_kerberos["Kerberos auth<br/>[kerberos.go]"]
  node_ntlm["NTLM auth<br/>[ntlm.go]"]
end

subgraph group_state["State and notifications"]
  node_store[("Persistent state<br/>[bbolt.go]")]
  node_push["Push notifications<br/>[push.go]"]
end

node_client(("MCP client"))
node_eas["EAS mailbox"]

node_client -->|"sends tool calls"| node_mcp
node_cli -->|"loads config"| node_config
node_cli -->|"opens database"| node_store
node_cli -->|"builds manager"| node_manager
node_cli -->|"runs stdio server"| node_mcp
node_cli -->|"starts controller"| node_push
node_setup -.->|"saves settings"| node_saveconfig
node_cli -->|"dispatches setup"| node_setup
node_cli -->|"dispatches doctor"| node_doctor
node_mcp -->|"registers tools"| node_emailread
node_mcp -->|"registers tools"| node_emailwrite
node_mcp -->|"registers tools"| node_calendar
node_mcp -->|"registers tools"| node_pim
node_mcp -->|"registers tools"| node_extras
node_emailread -->|"gets client"| node_manager
node_pim -->|"gets client"| node_manager
node_manager -->|"accesses mailbox"| node_eas
node_manager -->|"uses account state"| node_store
node_config -->|"defines permissions"| node_access
node_config -.->|"holds TLS settings"| node_tls
node_config -.->|"configures auth"| node_kerberos
node_config -.->|"selects auth"| node_ntlm
node_push -->|"emits updates"| node_client

click node_cli "https://github.com/hstern/activesync-mcp/blob/main/cmd/activesync-mcp/main.go"
click node_setup "https://github.com/hstern/activesync-mcp/blob/main/cmd/activesync-mcp/setup_tui.go"
click node_saveconfig "https://github.com/hstern/activesync-mcp/blob/main/cmd/activesync-mcp/setup_save.go"
click node_doctor "https://github.com/hstern/activesync-mcp/blob/main/cmd/activesync-mcp/doctor.go"
click node_config "https://github.com/hstern/activesync-mcp/blob/main/lib/config/config.go"
click node_access "https://github.com/hstern/activesync-mcp/blob/main/lib/config/access.go"
click node_tls "https://github.com/hstern/activesync-mcp/blob/main/lib/config/tls.go"
click node_kerberos "https://github.com/hstern/activesync-mcp/blob/main/lib/server/kerberos.go"
click node_ntlm "https://github.com/hstern/activesync-mcp/blob/main/lib/server/ntlm.go"
click node_mcp "https://github.com/hstern/activesync-mcp/blob/main/lib/server/server.go"
click node_manager "https://github.com/hstern/activesync-mcp/blob/main/lib/server/manager.go"
click node_emailread "https://github.com/hstern/activesync-mcp/blob/main/lib/server/tools_email.go"
click node_emailwrite "https://github.com/hstern/activesync-mcp/blob/main/lib/server/tools_email_write.go"
click node_calendar "https://github.com/hstern/activesync-mcp/blob/main/lib/server/tools_calendar.go"
click node_pim "https://github.com/hstern/activesync-mcp/blob/main/lib/server/tools_pim.go"
click node_extras "https://github.com/hstern/activesync-mcp/blob/main/lib/server/tools_extras.go"
click node_store "https://github.com/hstern/activesync-mcp/blob/main/lib/store/bbolt.go"
click node_push "https://github.com/hstern/activesync-mcp/blob/main/lib/server/push.go"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_cli,node_setup,node_saveconfig,node_doctor,node_client toneBlue
class node_mcp,node_manager toneAmber
class node_emailread,node_emailwrite,node_calendar,node_pim,node_extras toneMint
class node_config,node_access,node_tls,node_kerberos,node_ntlm toneRose
class node_store,node_push,node_eas toneIndigo
```

## Components

### CLI and setup

- [CLI dispatch](https://github.com/hstern/activesync-mcp/blob/main/cmd/activesync-mcp/main.go): `cmd/activesync-mcp/main.go`
- [Setup TUI](https://github.com/hstern/activesync-mcp/blob/main/cmd/activesync-mcp/setup_tui.go): `cmd/activesync-mcp/setup_tui.go`
- [Config writer](https://github.com/hstern/activesync-mcp/blob/main/cmd/activesync-mcp/setup_save.go): `cmd/activesync-mcp/setup_save.go`
- [Account diagnostics](https://github.com/hstern/activesync-mcp/blob/main/cmd/activesync-mcp/doctor.go): `cmd/activesync-mcp/doctor.go`

### MCP runtime

- [MCP server](https://github.com/hstern/activesync-mcp/blob/main/lib/server/server.go): `lib/server/server.go`
- [EAS manager](https://github.com/hstern/activesync-mcp/blob/main/lib/server/manager.go): `lib/server/manager.go`

### Mailbox tools

- [Email reading](https://github.com/hstern/activesync-mcp/blob/main/lib/server/tools_email.go): `lib/server/tools_email.go`
- [Email mutations](https://github.com/hstern/activesync-mcp/blob/main/lib/server/tools_email_write.go): `lib/server/tools_email_write.go`
- [Calendar tools](https://github.com/hstern/activesync-mcp/blob/main/lib/server/tools_calendar.go): `lib/server/tools_calendar.go`
- [Contacts tasks notes](https://github.com/hstern/activesync-mcp/blob/main/lib/server/tools_pim.go): `lib/server/tools_pim.go`
- [Folders and extras](https://github.com/hstern/activesync-mcp/blob/main/lib/server/tools_extras.go): `lib/server/tools_extras.go`

### Configuration and auth

- [Account config](https://github.com/hstern/activesync-mcp/blob/main/lib/config/config.go): `lib/config/config.go`
- [Write access policy](https://github.com/hstern/activesync-mcp/blob/main/lib/config/access.go): `lib/config/access.go`
- [TLS configuration](https://github.com/hstern/activesync-mcp/blob/main/lib/config/tls.go): `lib/config/tls.go`
- [Kerberos auth](https://github.com/hstern/activesync-mcp/blob/main/lib/server/kerberos.go): `lib/server/kerberos.go`
- [NTLM auth](https://github.com/hstern/activesync-mcp/blob/main/lib/server/ntlm.go): `lib/server/ntlm.go`

### State and notifications

- [Persistent state](https://github.com/hstern/activesync-mcp/blob/main/lib/store/bbolt.go): `lib/store/bbolt.go`
- [Push notifications](https://github.com/hstern/activesync-mcp/blob/main/lib/server/push.go): `lib/server/push.go`

### Other components

- **MCP client**
- **EAS mailbox**

## Connections

- MCP client → MCP server: sends tool calls (evidence: `README.md`)
- CLI dispatch → Account config: loads config (evidence: `cmd/activesync-mcp/main.go`)
- CLI dispatch → Persistent state: opens database (evidence: `cmd/activesync-mcp/main.go`)
- CLI dispatch → EAS manager: builds manager (evidence: `cmd/activesync-mcp/main.go`)
- CLI dispatch → MCP server: runs stdio server (evidence: `cmd/activesync-mcp/main.go`)
- CLI dispatch → Push notifications: starts controller (evidence: `cmd/activesync-mcp/main.go`)
- Setup TUI → Config writer: saves settings
- CLI dispatch → Setup TUI: dispatches setup (evidence: `README.md`)
- CLI dispatch → Account diagnostics: dispatches doctor (evidence: `README.md`)
- MCP server → Email reading: registers tools (evidence: `lib/server/server.go`)
- MCP server → Email mutations: registers tools (evidence: `lib/server/server.go`)
- MCP server → Calendar tools: registers tools (evidence: `lib/server/server.go`)
- MCP server → Contacts tasks notes: registers tools (evidence: `lib/server/server.go`)
- MCP server → Folders and extras: registers tools (evidence: `lib/server/server.go`)
- Email reading → EAS manager: gets client (evidence: `lib/server/tools_email.go`)
- Contacts tasks notes → EAS manager: gets client (evidence: `lib/server/tools_pim.go`)
- EAS manager → EAS mailbox: accesses mailbox (evidence: `README.md`)
- EAS manager → Persistent state: uses account state
- Account config → Write access policy: defines permissions (evidence: `lib/config/access.go`)
- Account config → TLS configuration: holds TLS settings
- Account config → Kerberos auth: configures auth
- Account config → NTLM auth: selects auth
- Push notifications → MCP client: emits updates (evidence: `README.md`)
