# lionello/onedrive-cli architecture

> Architecture diagram of the GitHub repository lionello/onedrive-cli, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-30). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/lionello/onedrive-cli
- Repository: https://github.com/lionello/onedrive-cli

## Overview

onedrive-cli is a Node.js command-line client for personal OneDrive, with OAuth login, filesystem-like drive operations, album and sharing features, and a read-only MCP server. The README documents these user-facing capabilities and token handoff; the only indexed source excerpt is package metadata, so command internals and most call relationships cannot be verified. Capability nodes therefore point to the known CLI entry file without implying unobserved internal call chains.

Main entry points: [`bin/onedrive`](https://github.com/lionello/onedrive-cli/blob/master/bin/onedrive) (Command interface), [`docs/oauthcallbackhandler.html`](https://github.com/lionello/onedrive-cli/blob/master/docs/oauthcallbackhandler.html) (OAuth callback page)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["CLI and authentication"]
  node_cli["Command interface"]
  node_login["OAuth login"]
  node_callback["OAuth callback page"]
  node_token[("Access token")]
end

subgraph group_files["Drive operations"]
  node_fileops["File operations"]
  node_search["Search and find"]
  node_storage["Storage usage"]
end

subgraph group_media["Albums and sharing"]
  node_album["Photo albums"]
  node_sharing["Sharing controls"]
end

subgraph group_mcp["MCP access"]
  node_mcpserver["MCP server"]
  node_mcptools["Browse tools"]
end

node_user(("CLI user"))
node_drive[("OneDrive")]
node_mcpclient(("MCP client"))

node_user -->|"runs commands"| node_cli
node_cli -->|"dispatches login"| node_login
node_login -->|"hands off token"| node_callback
node_login -->|"stores token"| node_token
node_cli -->|"dispatches commands"| node_fileops
node_cli -->|"dispatches commands"| node_search
node_cli -->|"dispatches df"| node_storage
node_cli -->|"dispatches album"| node_album
node_cli -->|"dispatches commands"| node_sharing
node_mcpclient -->|"connects over stdio"| node_mcpserver
node_cli -->|"starts mcp"| node_mcpserver
node_mcpserver -->|"exposes tools"| node_mcptools
node_mcptools -->|"reads drive"| node_drive
node_fileops -.->|"operates on"| node_drive
node_search -.->|"searches"| node_drive
node_storage -.->|"reports quota"| node_drive
node_album -.->|"manages bundles"| node_drive
node_sharing -.->|"changes sharing"| node_drive

click node_cli "https://github.com/lionello/onedrive-cli/blob/master/bin/onedrive"
click node_login "https://github.com/lionello/onedrive-cli/blob/master/bin/onedrive"
click node_callback "https://github.com/lionello/onedrive-cli/blob/master/docs/oauthcallbackhandler.html"
click node_fileops "https://github.com/lionello/onedrive-cli/blob/master/bin/onedrive"
click node_search "https://github.com/lionello/onedrive-cli/blob/master/bin/onedrive"
click node_storage "https://github.com/lionello/onedrive-cli/blob/master/bin/onedrive"
click node_album "https://github.com/lionello/onedrive-cli/blob/master/bin/onedrive"
click node_sharing "https://github.com/lionello/onedrive-cli/blob/master/bin/onedrive"
click node_mcpserver "https://github.com/lionello/onedrive-cli/blob/master/bin/onedrive"
click node_mcptools "https://github.com/lionello/onedrive-cli/blob/master/bin/onedrive"

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_login,node_callback,node_token,node_user,node_mcpclient toneBlue
class node_fileops,node_search,node_storage,node_drive toneAmber
class node_album,node_sharing toneMint
class node_mcpserver,node_mcptools toneRose
```

## Components

### CLI and authentication

- [Command interface](https://github.com/lionello/onedrive-cli/blob/master/bin/onedrive): `bin/onedrive`
- [OAuth login](https://github.com/lionello/onedrive-cli/blob/master/bin/onedrive): `bin/onedrive`
- [OAuth callback page](https://github.com/lionello/onedrive-cli/blob/master/docs/oauthcallbackhandler.html): `docs/oauthcallbackhandler.html`
- **Access token**

### Drive operations

- [File operations](https://github.com/lionello/onedrive-cli/blob/master/bin/onedrive): `bin/onedrive`
- [Search and find](https://github.com/lionello/onedrive-cli/blob/master/bin/onedrive): `bin/onedrive`
- [Storage usage](https://github.com/lionello/onedrive-cli/blob/master/bin/onedrive): `bin/onedrive`

### Albums and sharing

- [Photo albums](https://github.com/lionello/onedrive-cli/blob/master/bin/onedrive): `bin/onedrive`
- [Sharing controls](https://github.com/lionello/onedrive-cli/blob/master/bin/onedrive): `bin/onedrive`

### MCP access

- [MCP server](https://github.com/lionello/onedrive-cli/blob/master/bin/onedrive): `bin/onedrive`
- [Browse tools](https://github.com/lionello/onedrive-cli/blob/master/bin/onedrive): `bin/onedrive`

### Other components

- **CLI user**
- **OneDrive**
- **MCP client**

## Connections

- CLI user → Command interface: runs commands (evidence: `README.md`)
- Command interface → OAuth login: dispatches login (evidence: `README.md`)
- OAuth login → OAuth callback page: hands off token (evidence: `README.md`)
- OAuth login → Access token: stores token (evidence: `README.md`)
- Command interface → File operations: dispatches commands (evidence: `README.md`)
- Command interface → Search and find: dispatches commands (evidence: `README.md`)
- Command interface → Storage usage: dispatches df (evidence: `README.md`)
- Command interface → Photo albums: dispatches album (evidence: `README.md`)
- Command interface → Sharing controls: dispatches commands (evidence: `README.md`)
- MCP client → MCP server: connects over stdio (evidence: `README.md`)
- Command interface → MCP server: starts mcp (evidence: `README.md`)
- MCP server → Browse tools: exposes tools (evidence: `README.md`)
- Browse tools → OneDrive: reads drive (evidence: `README.md`)
- File operations → OneDrive: operates on
- Search and find → OneDrive: searches
- Storage usage → OneDrive: reports quota
- Photo albums → OneDrive: manages bundles
- Sharing controls → OneDrive: changes sharing
