outlook-cli 1.2.1 → 1.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CLI.md +16 -0
- package/README.md +110 -5
- package/cli.js +483 -70
- package/docs/REFERENCE.md +40 -2
- package/email/attachments.js +359 -0
- package/email/index.js +58 -1
- package/email/search.js +18 -12
- package/package.json +1 -1
- package/utils/graph-api.js +132 -44
package/CLI.md
CHANGED
|
@@ -13,7 +13,9 @@ outlook-cli --help
|
|
|
13
13
|
## Global options
|
|
14
14
|
|
|
15
15
|
- `--json`
|
|
16
|
+
- `--ai`
|
|
16
17
|
- `--output text|json`
|
|
18
|
+
- `--theme k9s|ocean|mono`
|
|
17
19
|
- `--plain`
|
|
18
20
|
- `--no-color`
|
|
19
21
|
- `--no-animate`
|
|
@@ -34,15 +36,28 @@ outlook-cli tools schema send-email
|
|
|
34
36
|
outlook-cli auth status
|
|
35
37
|
outlook-cli auth url
|
|
36
38
|
outlook-cli auth login --open --start-server --wait --timeout 180
|
|
39
|
+
outlook-cli auth login --open --client-id <id> --client-secret <secret>
|
|
40
|
+
outlook-cli auth server --start
|
|
41
|
+
outlook-cli auth server --status
|
|
37
42
|
outlook-cli auth logout
|
|
38
43
|
```
|
|
39
44
|
|
|
45
|
+
## AI Agents
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
outlook-cli agents guide
|
|
49
|
+
outlook-cli tools list --ai
|
|
50
|
+
outlook-cli call list-emails --args-json '{"folder":"inbox","count":5}' --ai
|
|
51
|
+
```
|
|
52
|
+
|
|
40
53
|
## Email
|
|
41
54
|
|
|
42
55
|
```bash
|
|
43
56
|
outlook-cli email list --folder inbox --count 20
|
|
44
57
|
outlook-cli email search --query "invoice" --unread-only true --count 10
|
|
45
58
|
outlook-cli email read --id <message-id>
|
|
59
|
+
outlook-cli email attachments --id <message-id>
|
|
60
|
+
outlook-cli email attachment --id <message-id> --attachment-id <attachment-id> --save-path ./downloads/
|
|
46
61
|
outlook-cli email send --to jane@example.com --subject "Status" --body "Done"
|
|
47
62
|
outlook-cli email mark-read --id <message-id> --is-read true
|
|
48
63
|
```
|
|
@@ -86,4 +101,5 @@ outlook-cli call create-event --args-json '{"subject":"Standup","start":"2026-04
|
|
|
86
101
|
outlook-cli doctor
|
|
87
102
|
outlook-cli update
|
|
88
103
|
outlook-cli update --run
|
|
104
|
+
outlook-cli mcp-server
|
|
89
105
|
```
|
package/README.md
CHANGED
|
@@ -10,8 +10,8 @@ Production-ready CLI and MCP server for Microsoft Outlook through Microsoft Grap
|
|
|
10
10
|
|
|
11
11
|
- Global CLI command: `outlook-cli`
|
|
12
12
|
- One-time OAuth token storage — reused across runs and updates
|
|
13
|
-
- Human-friendly commands with rich terminal output,
|
|
14
|
-
-
|
|
13
|
+
- Human-friendly commands with rich terminal output, theme presets, and machine-friendly `--json`/`--ai` mode
|
|
14
|
+
- 21 MCP tools available to Claude and other AI assistants via the shared tool registry
|
|
15
15
|
- Full email, calendar, folder, and rules management through Microsoft Graph API
|
|
16
16
|
|
|
17
17
|
---
|
|
@@ -139,12 +139,16 @@ outlook-cli calendar list # list upcoming events
|
|
|
139
139
|
| `auth status` | Show current authentication status | `outlook-cli auth status` |
|
|
140
140
|
| `auth login` | Start authentication flow | `outlook-cli auth login --open --start-server --wait` |
|
|
141
141
|
| `auth url` | Show the OAuth URL without opening browser | `outlook-cli auth url` |
|
|
142
|
+
| `auth server` | Check/start local OAuth callback server | `outlook-cli auth server --start` |
|
|
142
143
|
| `auth logout` | Clear stored tokens | `outlook-cli auth logout` |
|
|
143
144
|
|
|
144
145
|
**Flags for `auth login`:**
|
|
145
146
|
- `--open` — Automatically open the auth URL in your browser
|
|
146
147
|
- `--start-server` — Start the OAuth callback server automatically
|
|
147
148
|
- `--wait` — Wait for authentication to complete before returning
|
|
149
|
+
- `--client-id` — Provide Application (client) ID at runtime (optional)
|
|
150
|
+
- `--client-secret` — Provide client secret value at runtime (optional)
|
|
151
|
+
- `--prompt-credentials` — Prompt for missing credentials in interactive terminals
|
|
148
152
|
|
|
149
153
|
**Examples:**
|
|
150
154
|
```bash
|
|
@@ -159,6 +163,13 @@ outlook-cli auth status
|
|
|
159
163
|
|
|
160
164
|
# Force re-authentication
|
|
161
165
|
outlook-cli auth login --open --force
|
|
166
|
+
|
|
167
|
+
# Runtime credentials (useful outside repo where .env is not loaded)
|
|
168
|
+
outlook-cli auth login --open --client-id <id> --client-secret <secret>
|
|
169
|
+
|
|
170
|
+
# Start or check auth callback server
|
|
171
|
+
outlook-cli auth server --start
|
|
172
|
+
outlook-cli auth server --status
|
|
162
173
|
```
|
|
163
174
|
|
|
164
175
|
---
|
|
@@ -170,6 +181,8 @@ outlook-cli auth login --open --force
|
|
|
170
181
|
| `email list` | List recent emails | `outlook-cli email list --count 20` |
|
|
171
182
|
| `email search` | Search emails by criteria | `outlook-cli email search --from boss@company.com` |
|
|
172
183
|
| `email read` | Read full email content | `outlook-cli email read --id AAMkAGVm...` |
|
|
184
|
+
| `email attachments` | List attachments on one email | `outlook-cli email attachments --id AAMkAGVm...` |
|
|
185
|
+
| `email attachment` | Get one attachment and optionally save it | `outlook-cli email attachment --id AAMkAGVm... --attachment-id AA... --save-path ./downloads/` |
|
|
173
186
|
| `email send` | Send a new email | `outlook-cli email send --to user@example.com --subject "Hi" --body "Hello"` |
|
|
174
187
|
| `email mark-read` | Mark email as read or unread | `outlook-cli email mark-read --id AAMkAGVm...` |
|
|
175
188
|
|
|
@@ -273,6 +286,70 @@ outlook-cli email read --id AAMkAGVmMDAwAT... --json
|
|
|
273
286
|
|
|
274
287
|
---
|
|
275
288
|
|
|
289
|
+
#### `email attachments` — List Email Attachments
|
|
290
|
+
|
|
291
|
+
Lists attachments for a specific email message.
|
|
292
|
+
|
|
293
|
+
**Parameters:**
|
|
294
|
+
|
|
295
|
+
| Flag | Type | Required | Default | Description |
|
|
296
|
+
|---|---|---|---|---|
|
|
297
|
+
| `--id` | string | yes | — | Message ID from `email list` or `email search` |
|
|
298
|
+
| `--count` | number | no | `25` | Max attachments to list (1–50) |
|
|
299
|
+
|
|
300
|
+
**Examples:**
|
|
301
|
+
```bash
|
|
302
|
+
# List attachments for one message
|
|
303
|
+
outlook-cli email attachments --id AAMkAGVmMDAwAT...
|
|
304
|
+
|
|
305
|
+
# Limit to first 10 attachments
|
|
306
|
+
outlook-cli email attachments --id AAMkAGVmMDAwAT... --count 10
|
|
307
|
+
```
|
|
308
|
+
|
|
309
|
+
**Output shows:** Attachment ID, type (`fileAttachment`, `itemAttachment`, or `referenceAttachment`), content type, size, inline flag, and last modified date.
|
|
310
|
+
|
|
311
|
+
---
|
|
312
|
+
|
|
313
|
+
#### `email attachment` — Get/Download One Attachment
|
|
314
|
+
|
|
315
|
+
Gets metadata for one attachment and optionally saves it to disk.
|
|
316
|
+
|
|
317
|
+
**Parameters:**
|
|
318
|
+
|
|
319
|
+
| Flag | Type | Required | Default | Description |
|
|
320
|
+
|---|---|---|---|---|
|
|
321
|
+
| `--id` | string | yes | — | Message ID |
|
|
322
|
+
| `--attachmentId` | string | yes | — | Attachment ID from `email attachments` |
|
|
323
|
+
| `--savePath` | string | no | — | File path or directory path to save downloaded bytes |
|
|
324
|
+
| `--includeContent` | boolean | no | `false` | Include text preview when attachment content is text-like |
|
|
325
|
+
| `--expandItem` | boolean | no | `false` | Expand metadata for item attachments |
|
|
326
|
+
| `--overwrite` | boolean | no | `false` | Overwrite existing file at destination path |
|
|
327
|
+
|
|
328
|
+
**Examples:**
|
|
329
|
+
```bash
|
|
330
|
+
# Get metadata only
|
|
331
|
+
outlook-cli email attachment --id AAMkAGVmMDAwAT... --attachment-id AAMkAGVmMDAwAT...=
|
|
332
|
+
|
|
333
|
+
# Save attachment to downloads directory
|
|
334
|
+
outlook-cli email attachment \
|
|
335
|
+
--id AAMkAGVmMDAwAT... \
|
|
336
|
+
--attachment-id AAMkAGVmMDAwAT...= \
|
|
337
|
+
--save-path ./downloads/
|
|
338
|
+
|
|
339
|
+
# Save and include text preview when possible
|
|
340
|
+
outlook-cli email attachment \
|
|
341
|
+
--id AAMkAGVmMDAwAT... \
|
|
342
|
+
--attachment-id AAMkAGVmMDAwAT...= \
|
|
343
|
+
--save-path ./downloads/ \
|
|
344
|
+
--include-content
|
|
345
|
+
```
|
|
346
|
+
|
|
347
|
+
**Notes:**
|
|
348
|
+
- `referenceAttachment` is a cloud link and cannot be downloaded as raw bytes from this endpoint.
|
|
349
|
+
- Item attachments use MIME raw content when downloaded.
|
|
350
|
+
|
|
351
|
+
---
|
|
352
|
+
|
|
276
353
|
#### `email send` — Send Email
|
|
277
354
|
|
|
278
355
|
Composes and sends an email from the user's account.
|
|
@@ -315,7 +392,7 @@ outlook-cli email send \
|
|
|
315
392
|
|
|
316
393
|
**Notes:**
|
|
317
394
|
- HTML body is detected automatically when the body contains `<html`.
|
|
318
|
-
-
|
|
395
|
+
- Sending attachments is not supported yet — body text only.
|
|
319
396
|
|
|
320
397
|
---
|
|
321
398
|
|
|
@@ -750,6 +827,24 @@ outlook-cli call list-events --args-json '{"count":10}' --json
|
|
|
750
827
|
|
|
751
828
|
---
|
|
752
829
|
|
|
830
|
+
### `agents` — AI Agent Guide
|
|
831
|
+
|
|
832
|
+
Shows best-practice command flow for AI agents (Claude, Codex, VS Code, automation scripts).
|
|
833
|
+
|
|
834
|
+
```bash
|
|
835
|
+
outlook-cli agents guide
|
|
836
|
+
```
|
|
837
|
+
|
|
838
|
+
**Agent workflow (recommended):**
|
|
839
|
+
```bash
|
|
840
|
+
outlook-cli auth status --json
|
|
841
|
+
outlook-cli tools list --json
|
|
842
|
+
outlook-cli tools schema send-email --json
|
|
843
|
+
outlook-cli call list-emails --args-json '{"folder":"inbox","count":5}' --ai
|
|
844
|
+
```
|
|
845
|
+
|
|
846
|
+
---
|
|
847
|
+
|
|
753
848
|
### `doctor` — Diagnostics
|
|
754
849
|
|
|
755
850
|
Runs a series of diagnostic checks and reports what's working and what needs fixing.
|
|
@@ -784,14 +879,22 @@ npm i -g outlook-cli@latest
|
|
|
784
879
|
| Flag | Description |
|
|
785
880
|
|---|---|
|
|
786
881
|
| `--json` | Output raw JSON instead of human-readable text |
|
|
882
|
+
| `--ai` | Agent-safe alias for JSON mode (suppresses rich UI output) |
|
|
883
|
+
| `--theme k9s|ocean|mono` | Select color theme for text output |
|
|
787
884
|
| `--plain` | No colors or formatting |
|
|
788
885
|
| `--no-color` | Disable color only |
|
|
789
886
|
| `--no-animate` | Disable spinner animations |
|
|
790
887
|
|
|
888
|
+
In JSON mode, responses include both:
|
|
889
|
+
- `result` (original MCP tool payload)
|
|
890
|
+
- `structured` (normalized machine-friendly fields like `summary`, `items`, and parsed metadata)
|
|
891
|
+
|
|
791
892
|
**Examples:**
|
|
792
893
|
```bash
|
|
793
894
|
outlook-cli auth status --json
|
|
895
|
+
outlook-cli tools list --ai
|
|
794
896
|
outlook-cli email list --count 10 --json
|
|
897
|
+
outlook-cli --theme ocean --help
|
|
795
898
|
outlook-cli calendar list --plain
|
|
796
899
|
```
|
|
797
900
|
|
|
@@ -799,7 +902,7 @@ outlook-cli calendar list --plain
|
|
|
799
902
|
|
|
800
903
|
## Complete MCP Tool Catalog
|
|
801
904
|
|
|
802
|
-
All
|
|
905
|
+
All 21 tools are available through the shared MCP tool registry — used by Claude and other AI assistants, and also callable via `outlook-cli call <tool-name>`.
|
|
803
906
|
|
|
804
907
|
### Authentication Tools
|
|
805
908
|
|
|
@@ -826,6 +929,8 @@ All 19 tools are available through the shared MCP tool registry — used by Clau
|
|
|
826
929
|
| `list-emails` | List recent emails from a folder | none | `folder`, `count` |
|
|
827
930
|
| `search-emails` | Search with text and filter criteria | none | `query`, `folder`, `from`, `to`, `subject`, `hasAttachments`, `unreadOnly`, `count` |
|
|
828
931
|
| `read-email` | Read full content of one email | `id` | none |
|
|
932
|
+
| `list-attachments` | List attachments on a message | `messageId` | `count` |
|
|
933
|
+
| `get-attachment` | Get one attachment metadata and optionally download it | `messageId`, `attachmentId` | `savePath`, `includeContent`, `expandItem`, `overwrite` |
|
|
829
934
|
| `send-email` | Send a new email | `to`, `subject`, `body` | `cc`, `bcc`, `importance`, `saveToSentItems` |
|
|
830
935
|
| `mark-as-read` | Mark email read or unread | `id` | `isRead` (boolean, default `true`) |
|
|
831
936
|
|
|
@@ -962,7 +1067,7 @@ uv run python tools/install_skill.py --verify --personal
|
|
|
962
1067
|
|---|---|
|
|
963
1068
|
| [skills/outlook-automation/SKILL.md](skills/outlook-automation/SKILL.md) | Main skill entry — overview, behavioral rules, quick examples, install instructions |
|
|
964
1069
|
| [skills/outlook-automation/reference/cli.md](skills/outlook-automation/reference/cli.md) | Complete CLI command reference — every command, flag, and example |
|
|
965
|
-
| [skills/outlook-automation/reference/json-schema.md](skills/outlook-automation/reference/json-schema.md) | JSON schemas for all
|
|
1070
|
+
| [skills/outlook-automation/reference/json-schema.md](skills/outlook-automation/reference/json-schema.md) | JSON schemas for all 21 MCP tools |
|
|
966
1071
|
| [skills/outlook-automation/reference/security.md](skills/outlook-automation/reference/security.md) | OAuth flow, token lifecycle, permission scopes, AI safety rules |
|
|
967
1072
|
| [skills/outlook-automation/reference/troubleshooting.md](skills/outlook-automation/reference/troubleshooting.md) | Common errors, diagnostic checklist, step-by-step fixes |
|
|
968
1073
|
|