@bitefoundry/outlook 0.2.0 → 0.3.0
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/LICENSE +21 -21
- package/README.md +177 -165
- package/docs/API.md +365 -365
- package/docs/MCP.md +147 -147
- package/docs/NPM.md +236 -236
- package/docs/openapi.yaml +705 -705
- package/package.json +49 -49
package/docs/API.md
CHANGED
|
@@ -1,365 +1,365 @@
|
|
|
1
|
-
# `outlook` HTTP JSON API
|
|
2
|
-
|
|
3
|
-
Local HTTP/JSON server for AI agents, scripts, and integrations. Exposed by `outlook serve` (alias `api`), backed by Microsoft Graph v1.0, local SQLite WAL/FTS5 caching, and the background sync engine (`sync::spawn_sync_engine`).
|
|
4
|
-
|
|
5
|
-
## Starting the server
|
|
6
|
-
|
|
7
|
-
```bash
|
|
8
|
-
outlook serve # http://127.0.0.1:3939
|
|
9
|
-
outlook serve --port 9000 # custom port
|
|
10
|
-
outlook serve --bind 127.0.0.1 --port 3939
|
|
11
|
-
outlook serve --api-key secret123 # require Bearer secret123 or x-api-key: secret123
|
|
12
|
-
outlook serve --token secret123 # --token is an alias for --api-key
|
|
13
|
-
outlook api # alias for `serve`
|
|
14
|
-
```
|
|
15
|
-
|
|
16
|
-
- `--bind` defaults to `127.0.0.1` (loopback only). Binding to a non-loopback address (e.g. `0.0.0.0`) requires `--api-key <KEY>` (or `--token <KEY>`) unless `OUTLOOK_ALLOW_INSECURE_SERVE=1` is explicitly set.
|
|
17
|
-
- `--port` defaults to `3939`.
|
|
18
|
-
- `--api-key` (alias `--token`) is optional; when set, every endpoint except `GET /health` requires either `Authorization: Bearer <key>` or `x-api-key: <key>`.
|
|
19
|
-
- Requires an existing login (`outlook login`), `OUTLOOK_ACCESS_TOKEN`, `OUTLOOK_TOKEN_FILE`, or a shared M365 session (`teams-cli` / `TEAMS_TOKEN_FILE` when `OUTLOOK_SHARE_M365_AUTH=true`).
|
|
20
|
-
- On startup, `outlook serve` spawns the background sync engine so the local SQLite cache stays warm while serving requests.
|
|
21
|
-
|
|
22
|
-
## Conventions
|
|
23
|
-
|
|
24
|
-
- All responses are JSON (`Content-Type: application/json`).
|
|
25
|
-
- Errors use `{"error": "<message>"}` with HTTP `400`, `401`, `403`, `404`, or `500`.
|
|
26
|
-
- `limit` is clamped to `1..=1000`.
|
|
27
|
-
- Mail folder parameters accept a folder ID, display name/prefix, or well-known alias (`inbox`, `sent`, `drafts`, `archive`, `trash`, `junk`).
|
|
28
|
-
- To Do list parameters default to `"tasks"` and accept a list ID, display name, or `"default"` / `"tasks"` / `"defaultList"`.
|
|
29
|
-
- CORS is restricted to loopback (`localhost` / `127.0.0.1` / `[::1]`) origins when `--api-key` is unset, and permissive when `--api-key` is configured.
|
|
30
|
-
|
|
31
|
-
## Endpoints
|
|
32
|
-
|
|
33
|
-
### System & Auth
|
|
34
|
-
|
|
35
|
-
#### `GET /health`
|
|
36
|
-
|
|
37
|
-
Always public, even when `--api-key` is configured.
|
|
38
|
-
|
|
39
|
-
```bash
|
|
40
|
-
curl http://127.0.0.1:3939/health
|
|
41
|
-
```
|
|
42
|
-
|
|
43
|
-
```json
|
|
44
|
-
{
|
|
45
|
-
"ok": true,
|
|
46
|
-
"user_id": "00000000-0000-0000-0000-000000000000",
|
|
47
|
-
"version": "0.1.5"
|
|
48
|
-
}
|
|
49
|
-
```
|
|
50
|
-
|
|
51
|
-
#### `GET /openapi.json`
|
|
52
|
-
|
|
53
|
-
Returns the OpenAPI 3.1.0 specification JSON generated by the running server.
|
|
54
|
-
|
|
55
|
-
```bash
|
|
56
|
-
curl http://127.0.0.1:3939/openapi.json
|
|
57
|
-
```
|
|
58
|
-
|
|
59
|
-
#### `GET /v1/whoami`
|
|
60
|
-
|
|
61
|
-
Returns the active user profile, auth mode/source (`outlook-cli` vs shared `teams-cli` session), token expiry, and JWT `scp` / `roles` diagnostics.
|
|
62
|
-
|
|
63
|
-
```bash
|
|
64
|
-
curl http://127.0.0.1:3939/v1/whoami -H "Authorization: Bearer secret123"
|
|
65
|
-
```
|
|
66
|
-
|
|
67
|
-
```json
|
|
68
|
-
{
|
|
69
|
-
"authenticated": true,
|
|
70
|
-
"user_id": "00000000-0000-0000-0000-000000000000",
|
|
71
|
-
"display_name": "Alice Kim",
|
|
72
|
-
"email": "alice@contoso.com",
|
|
73
|
-
"client_id": "14d82eec-204b-4c2f-b7e8-296a70dab67e",
|
|
74
|
-
"tenant_id": "common",
|
|
75
|
-
"auth_mode": "pkce",
|
|
76
|
-
"auth_source": "keyring",
|
|
77
|
-
"expires_at": 1795023600,
|
|
78
|
-
"expired": false,
|
|
79
|
-
"scopes": ["Mail.ReadWrite", "Mail.Send", "Calendars.ReadWrite", "Tasks.ReadWrite", "Contacts.Read"],
|
|
80
|
-
"roles": []
|
|
81
|
-
}
|
|
82
|
-
```
|
|
83
|
-
|
|
84
|
-
### Mail
|
|
85
|
-
|
|
86
|
-
#### `GET /v1/mail/folders?refresh=false&offline=false`
|
|
87
|
-
|
|
88
|
-
Lists Outlook mail folders with unread and total item counts.
|
|
89
|
-
|
|
90
|
-
```bash
|
|
91
|
-
curl "http://127.0.0.1:3939/v1/mail/folders?refresh=true"
|
|
92
|
-
```
|
|
93
|
-
|
|
94
|
-
```json
|
|
95
|
-
{
|
|
96
|
-
"folders": [
|
|
97
|
-
{
|
|
98
|
-
"id": "AAMkAGI2...",
|
|
99
|
-
"display_name": "Inbox",
|
|
100
|
-
"well_known_name": "inbox",
|
|
101
|
-
"parent_folder_id": null,
|
|
102
|
-
"child_folder_count": 0,
|
|
103
|
-
"unread_item_count": 4,
|
|
104
|
-
"total_item_count": 128
|
|
105
|
-
}
|
|
106
|
-
]
|
|
107
|
-
}
|
|
108
|
-
```
|
|
109
|
-
|
|
110
|
-
#### `GET /v1/mail/messages?folder=inbox&limit=30&unread=false&flagged=false&focused=false&refresh=false&offline=false`
|
|
111
|
-
|
|
112
|
-
Lists messages in a mail folder (`inbox`, `sent`, `drafts`, `archive`, `trash`, `junk`, folder name, or folder ID).
|
|
113
|
-
|
|
114
|
-
```bash
|
|
115
|
-
curl "http://127.0.0.1:3939/v1/mail/messages?folder=inbox&limit=20&unread=true"
|
|
116
|
-
```
|
|
117
|
-
|
|
118
|
-
```json
|
|
119
|
-
{
|
|
120
|
-
"folder": { "id": "AAMkAGI2...", "display_name": "Inbox", "well_known_name": "inbox" },
|
|
121
|
-
"messages": [
|
|
122
|
-
{
|
|
123
|
-
"id": "AAMkAGI2...",
|
|
124
|
-
"conversation_id": "AAQkAGI2...",
|
|
125
|
-
"folder_id": "AAMkAGI2...",
|
|
126
|
-
"subject": "Quarterly Review",
|
|
127
|
-
"from": { "name": "Bob Smith", "address": "bob@contoso.com" },
|
|
128
|
-
"received_at": "2026-11-18T09:30:00Z",
|
|
129
|
-
"is_read": false,
|
|
130
|
-
"flagged": false,
|
|
131
|
-
"importance": "normal",
|
|
132
|
-
"inference_classification": "focused",
|
|
133
|
-
"has_attachments": true,
|
|
134
|
-
"body_loaded": false,
|
|
135
|
-
"preview": "Attached are the Q4 numbers..."
|
|
136
|
-
}
|
|
137
|
-
]
|
|
138
|
-
}
|
|
139
|
-
```
|
|
140
|
-
|
|
141
|
-
#### `GET /v1/mail/messages/{id}?offline=false`
|
|
142
|
-
|
|
143
|
-
Fetches full headers, HTML/plain body, and attachment metadata for a single message (and caches it in SQLite).
|
|
144
|
-
|
|
145
|
-
```bash
|
|
146
|
-
curl "http://127.0.0.1:3939/v1/mail/messages/AAMkAGI2..."
|
|
147
|
-
```
|
|
148
|
-
|
|
149
|
-
#### `POST /v1/mail/send`
|
|
150
|
-
|
|
151
|
-
Composes and sends a new email (Markdown compiled to HTML) with optional `cc`, `bcc`, `importance` (`low` | `normal` | `high`), host file `attachments`, and `save_to_sent_items` (default `true`). `markdown` also accepts alias `body`.
|
|
152
|
-
|
|
153
|
-
```bash
|
|
154
|
-
curl -X POST http://127.0.0.1:3939/v1/mail/send \
|
|
155
|
-
-H "Content-Type: application/json" \
|
|
156
|
-
-d '{"to":["bob@contoso.com"],"subject":"Release v0.1.0","markdown":"Build **passed**!","importance":"high"}'
|
|
157
|
-
```
|
|
158
|
-
|
|
159
|
-
```json
|
|
160
|
-
{
|
|
161
|
-
"ok": true,
|
|
162
|
-
"to": ["bob@contoso.com"],
|
|
163
|
-
"subject": "Release v0.1.0"
|
|
164
|
-
}
|
|
165
|
-
```
|
|
166
|
-
|
|
167
|
-
#### `POST /v1/mail/messages/{id}/reply`
|
|
168
|
-
|
|
169
|
-
Replies (`reply_all: false`) or replies-all (`reply_all: true`) to an email message. `markdown` also accepts alias `body`.
|
|
170
|
-
|
|
171
|
-
```bash
|
|
172
|
-
curl -X POST http://127.0.0.1:3939/v1/mail/messages/AAMkAGI2.../reply \
|
|
173
|
-
-H "Content-Type: application/json" \
|
|
174
|
-
-d '{"markdown":"Looks good, approved.","reply_all":true}'
|
|
175
|
-
```
|
|
176
|
-
|
|
177
|
-
#### `POST /v1/mail/messages/{id}/forward`
|
|
178
|
-
|
|
179
|
-
Forwards an email message to one or more recipients (`to`) with an optional Markdown `markdown` (alias `comment`) preface.
|
|
180
|
-
|
|
181
|
-
```bash
|
|
182
|
-
curl -X POST http://127.0.0.1:3939/v1/mail/messages/AAMkAGI2.../forward \
|
|
183
|
-
-H "Content-Type: application/json" \
|
|
184
|
-
-d '{"to":["carol@contoso.com"],"markdown":"FYI — see thread below."}'
|
|
185
|
-
```
|
|
186
|
-
|
|
187
|
-
#### `PATCH /v1/mail/messages/{id}`
|
|
188
|
-
|
|
189
|
-
Updates read status (`is_read`), flag status (`flagged`), and/or moves the message to `destination_folder_id` (alias `destination_folder`, accepting folder name, alias such as `"archive"`, or folder ID). At least one field must be provided.
|
|
190
|
-
|
|
191
|
-
To edit an existing draft's subject or body, use `outlook edit-draft` or MCP `update_draft`. To edit an active composition, use the TUI.
|
|
192
|
-
|
|
193
|
-
```bash
|
|
194
|
-
curl -X PATCH http://127.0.0.1:3939/v1/mail/messages/AAMkAGI2... \
|
|
195
|
-
-H "Content-Type: application/json" \
|
|
196
|
-
-d '{"is_read":true,"flagged":false,"destination_folder_id":"archive"}'
|
|
197
|
-
```
|
|
198
|
-
|
|
199
|
-
```json
|
|
200
|
-
{
|
|
201
|
-
"ok": true,
|
|
202
|
-
"message_id": "AAMkAGI2...",
|
|
203
|
-
"is_read": true,
|
|
204
|
-
"flagged": false,
|
|
205
|
-
"moved": { "id": "AAMkAGI2..." }
|
|
206
|
-
}
|
|
207
|
-
```
|
|
208
|
-
|
|
209
|
-
#### `DELETE /v1/mail/messages/{id}`
|
|
210
|
-
|
|
211
|
-
Deletes a mail message and removes it from the local SQLite cache.
|
|
212
|
-
|
|
213
|
-
```bash
|
|
214
|
-
curl -X DELETE http://127.0.0.1:3939/v1/mail/messages/AAMkAGI2...
|
|
215
|
-
```
|
|
216
|
-
|
|
217
|
-
#### `POST /v1/mail/messages/{id}/attachments/{att_id}/download`
|
|
218
|
-
|
|
219
|
-
Downloads an attachment to disk on the host running `outlook serve` (defaults to `download_dir`, usually `Downloads/outlook`). Optional body: `{"out_dir": "/path/to/dir"}` (alias `dir`).
|
|
220
|
-
|
|
221
|
-
```bash
|
|
222
|
-
curl -X POST http://127.0.0.1:3939/v1/mail/messages/AAMkAGI2.../attachments/ATT_ID/download \
|
|
223
|
-
-H "Content-Type: application/json" \
|
|
224
|
-
-d '{"out_dir":"./downloads"}'
|
|
225
|
-
```
|
|
226
|
-
|
|
227
|
-
```json
|
|
228
|
-
{
|
|
229
|
-
"ok": true,
|
|
230
|
-
"path": "./downloads/report.pdf",
|
|
231
|
-
"file_name": "report.pdf",
|
|
232
|
-
"bytes_written": 48120
|
|
233
|
-
}
|
|
234
|
-
```
|
|
235
|
-
|
|
236
|
-
#### `GET /v1/mail/search?q=...&folder=&remote=false&limit=30`
|
|
237
|
-
|
|
238
|
-
Searches local SQLite FTS5 + `LIKE` (`hits`) and, when `remote=true`, queries Microsoft Graph KQL `$search` (`remote`) while caching returned messages.
|
|
239
|
-
|
|
240
|
-
```bash
|
|
241
|
-
curl "http://127.0.0.1:3939/v1/mail/search?q=quarterly&remote=true&limit=20"
|
|
242
|
-
```
|
|
243
|
-
|
|
244
|
-
### Calendar
|
|
245
|
-
|
|
246
|
-
#### `GET /v1/calendar/events?from=&to=&days=7&limit=50&offline=false`
|
|
247
|
-
|
|
248
|
-
Lists calendar events within a time window (`from` / `to` accept aliases `start` / `end` as ISO-8601 or `YYYY-MM-DD`; defaults to now through `+7` days).
|
|
249
|
-
|
|
250
|
-
```bash
|
|
251
|
-
curl "http://127.0.0.1:3939/v1/calendar/events?days=14"
|
|
252
|
-
```
|
|
253
|
-
|
|
254
|
-
```json
|
|
255
|
-
{
|
|
256
|
-
"start": "2026-11-18T00:00:00Z",
|
|
257
|
-
"end": "2026-12-02T00:00:00Z",
|
|
258
|
-
"events": [
|
|
259
|
-
{
|
|
260
|
-
"id": "AAMkAGI2...",
|
|
261
|
-
"subject": "Architecture Review",
|
|
262
|
-
"start_iso": "2026-11-20T09:00:00Z",
|
|
263
|
-
"end_iso": "2026-11-20T10:00:00Z",
|
|
264
|
-
"time_zone": "UTC",
|
|
265
|
-
"is_all_day": false,
|
|
266
|
-
"location": "Room 4B",
|
|
267
|
-
"response_status": "accepted",
|
|
268
|
-
"is_online_meeting": true,
|
|
269
|
-
"online_meeting_url": "https://teams.microsoft.com/l/meetup-join/..."
|
|
270
|
-
}
|
|
271
|
-
]
|
|
272
|
-
}
|
|
273
|
-
```
|
|
274
|
-
|
|
275
|
-
#### `POST /v1/calendar/events`
|
|
276
|
-
|
|
277
|
-
Creates a new calendar event. `start_iso` / `end_iso` accept aliases `start` / `end`; `markdown` accepts alias `body`; `is_online_meeting` accepts alias `online`.
|
|
278
|
-
|
|
279
|
-
```bash
|
|
280
|
-
curl -X POST http://127.0.0.1:3939/v1/calendar/events \
|
|
281
|
-
-H "Content-Type: application/json" \
|
|
282
|
-
-d '{"subject":"Sprint Planning","start_iso":"2026-11-20T14:00:00Z","end_iso":"2026-11-20T15:00:00Z","attendees":["bob@contoso.com"],"is_online_meeting":true}'
|
|
283
|
-
```
|
|
284
|
-
|
|
285
|
-
#### `GET /v1/calendar/events/{id}?offline=false`
|
|
286
|
-
|
|
287
|
-
Reads full details and attendees for a calendar event.
|
|
288
|
-
|
|
289
|
-
```bash
|
|
290
|
-
curl "http://127.0.0.1:3939/v1/calendar/events/AAMkAGI2..."
|
|
291
|
-
```
|
|
292
|
-
|
|
293
|
-
#### `POST /v1/calendar/events/{id}/rsvp`
|
|
294
|
-
|
|
295
|
-
Responds to a meeting invitation (`response`: `"accept"` | `"tentative"` | `"decline"`, optional `comment`).
|
|
296
|
-
|
|
297
|
-
```bash
|
|
298
|
-
curl -X POST http://127.0.0.1:3939/v1/calendar/events/AAMkAGI2.../rsvp \
|
|
299
|
-
-H "Content-Type: application/json" \
|
|
300
|
-
-d '{"response":"accept","comment":"See you there."}'
|
|
301
|
-
```
|
|
302
|
-
|
|
303
|
-
#### `DELETE /v1/calendar/events/{id}`
|
|
304
|
-
|
|
305
|
-
Cancels/deletes a calendar event and removes it from the local cache.
|
|
306
|
-
|
|
307
|
-
```bash
|
|
308
|
-
curl -X DELETE http://127.0.0.1:3939/v1/calendar/events/AAMkAGI2...
|
|
309
|
-
```
|
|
310
|
-
|
|
311
|
-
### Microsoft To Do
|
|
312
|
-
|
|
313
|
-
#### `GET /v1/todo/lists?refresh=false&offline=false`
|
|
314
|
-
|
|
315
|
-
Lists Microsoft To Do task lists.
|
|
316
|
-
|
|
317
|
-
```bash
|
|
318
|
-
curl "http://127.0.0.1:3939/v1/todo/lists"
|
|
319
|
-
```
|
|
320
|
-
|
|
321
|
-
#### `GET /v1/todo/tasks?list=tasks&all=false&limit=50&refresh=false&offline=false`
|
|
322
|
-
|
|
323
|
-
Lists tasks in a To Do list (`all` accepts alias `include_completed`).
|
|
324
|
-
|
|
325
|
-
```bash
|
|
326
|
-
curl "http://127.0.0.1:3939/v1/todo/tasks?list=tasks&all=true"
|
|
327
|
-
```
|
|
328
|
-
|
|
329
|
-
#### `POST /v1/todo/tasks`
|
|
330
|
-
|
|
331
|
-
Creates a To Do task (`body_plain` accepts alias `notes`; `due_date_iso` accepts alias `due`; `importance`: `low` | `normal` | `high`).
|
|
332
|
-
|
|
333
|
-
```bash
|
|
334
|
-
curl -X POST http://127.0.0.1:3939/v1/todo/tasks \
|
|
335
|
-
-H "Content-Type: application/json" \
|
|
336
|
-
-d '{"title":"Publish outlook v0.1.0","due_date_iso":"2026-11-20","importance":"high"}'
|
|
337
|
-
```
|
|
338
|
-
|
|
339
|
-
#### `PATCH /v1/todo/tasks/{id}`
|
|
340
|
-
|
|
341
|
-
Marks a To Do task completed or incomplete (`{ "list"?: "tasks", "completed": true }`).
|
|
342
|
-
|
|
343
|
-
```bash
|
|
344
|
-
curl -X PATCH http://127.0.0.1:3939/v1/todo/tasks/TASK_ID \
|
|
345
|
-
-H "Content-Type: application/json" \
|
|
346
|
-
-d '{"completed":true}'
|
|
347
|
-
```
|
|
348
|
-
|
|
349
|
-
#### `DELETE /v1/todo/tasks/{id}?list=tasks`
|
|
350
|
-
|
|
351
|
-
Deletes a To Do task.
|
|
352
|
-
|
|
353
|
-
```bash
|
|
354
|
-
curl -X DELETE "http://127.0.0.1:3939/v1/todo/tasks/TASK_ID?list=tasks"
|
|
355
|
-
```
|
|
356
|
-
|
|
357
|
-
### Contacts & Directory
|
|
358
|
-
|
|
359
|
-
#### `GET /v1/contacts?q=&limit=50&offline=false`
|
|
360
|
-
|
|
361
|
-
Lists personal Outlook contacts (`/me/contacts`) or, when `q` (alias `query`) is provided, searches both personal contacts and the Entra ID organization directory (`/users`).
|
|
362
|
-
|
|
363
|
-
```bash
|
|
364
|
-
curl "http://127.0.0.1:3939/v1/contacts?q=alice&limit=20"
|
|
365
|
-
```
|
|
1
|
+
# `outlook` HTTP JSON API
|
|
2
|
+
|
|
3
|
+
Local HTTP/JSON server for AI agents, scripts, and integrations. Exposed by `outlook serve` (alias `api`), backed by Microsoft Graph v1.0, local SQLite WAL/FTS5 caching, and the background sync engine (`sync::spawn_sync_engine`).
|
|
4
|
+
|
|
5
|
+
## Starting the server
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
outlook serve # http://127.0.0.1:3939
|
|
9
|
+
outlook serve --port 9000 # custom port
|
|
10
|
+
outlook serve --bind 127.0.0.1 --port 3939
|
|
11
|
+
outlook serve --api-key secret123 # require Bearer secret123 or x-api-key: secret123
|
|
12
|
+
outlook serve --token secret123 # --token is an alias for --api-key
|
|
13
|
+
outlook api # alias for `serve`
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
- `--bind` defaults to `127.0.0.1` (loopback only). Binding to a non-loopback address (e.g. `0.0.0.0`) requires `--api-key <KEY>` (or `--token <KEY>`) unless `OUTLOOK_ALLOW_INSECURE_SERVE=1` is explicitly set.
|
|
17
|
+
- `--port` defaults to `3939`.
|
|
18
|
+
- `--api-key` (alias `--token`) is optional; when set, every endpoint except `GET /health` requires either `Authorization: Bearer <key>` or `x-api-key: <key>`.
|
|
19
|
+
- Requires an existing login (`outlook login`), `OUTLOOK_ACCESS_TOKEN`, `OUTLOOK_TOKEN_FILE`, or a shared M365 session (`teams-cli` / `TEAMS_TOKEN_FILE` when `OUTLOOK_SHARE_M365_AUTH=true`).
|
|
20
|
+
- On startup, `outlook serve` spawns the background sync engine so the local SQLite cache stays warm while serving requests.
|
|
21
|
+
|
|
22
|
+
## Conventions
|
|
23
|
+
|
|
24
|
+
- All responses are JSON (`Content-Type: application/json`).
|
|
25
|
+
- Errors use `{"error": "<message>"}` with HTTP `400`, `401`, `403`, `404`, or `500`.
|
|
26
|
+
- `limit` is clamped to `1..=1000`.
|
|
27
|
+
- Mail folder parameters accept a folder ID, display name/prefix, or well-known alias (`inbox`, `sent`, `drafts`, `archive`, `trash`, `junk`).
|
|
28
|
+
- To Do list parameters default to `"tasks"` and accept a list ID, display name, or `"default"` / `"tasks"` / `"defaultList"`.
|
|
29
|
+
- CORS is restricted to loopback (`localhost` / `127.0.0.1` / `[::1]`) origins when `--api-key` is unset, and permissive when `--api-key` is configured.
|
|
30
|
+
|
|
31
|
+
## Endpoints
|
|
32
|
+
|
|
33
|
+
### System & Auth
|
|
34
|
+
|
|
35
|
+
#### `GET /health`
|
|
36
|
+
|
|
37
|
+
Always public, even when `--api-key` is configured.
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
curl http://127.0.0.1:3939/health
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
```json
|
|
44
|
+
{
|
|
45
|
+
"ok": true,
|
|
46
|
+
"user_id": "00000000-0000-0000-0000-000000000000",
|
|
47
|
+
"version": "0.1.5"
|
|
48
|
+
}
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
#### `GET /openapi.json`
|
|
52
|
+
|
|
53
|
+
Returns the OpenAPI 3.1.0 specification JSON generated by the running server.
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
curl http://127.0.0.1:3939/openapi.json
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
#### `GET /v1/whoami`
|
|
60
|
+
|
|
61
|
+
Returns the active user profile, auth mode/source (`outlook-cli` vs shared `teams-cli` session), token expiry, and JWT `scp` / `roles` diagnostics.
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
curl http://127.0.0.1:3939/v1/whoami -H "Authorization: Bearer secret123"
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
```json
|
|
68
|
+
{
|
|
69
|
+
"authenticated": true,
|
|
70
|
+
"user_id": "00000000-0000-0000-0000-000000000000",
|
|
71
|
+
"display_name": "Alice Kim",
|
|
72
|
+
"email": "alice@contoso.com",
|
|
73
|
+
"client_id": "14d82eec-204b-4c2f-b7e8-296a70dab67e",
|
|
74
|
+
"tenant_id": "common",
|
|
75
|
+
"auth_mode": "pkce",
|
|
76
|
+
"auth_source": "keyring",
|
|
77
|
+
"expires_at": 1795023600,
|
|
78
|
+
"expired": false,
|
|
79
|
+
"scopes": ["Mail.ReadWrite", "Mail.Send", "Calendars.ReadWrite", "Tasks.ReadWrite", "Contacts.Read"],
|
|
80
|
+
"roles": []
|
|
81
|
+
}
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
### Mail
|
|
85
|
+
|
|
86
|
+
#### `GET /v1/mail/folders?refresh=false&offline=false`
|
|
87
|
+
|
|
88
|
+
Lists Outlook mail folders with unread and total item counts.
|
|
89
|
+
|
|
90
|
+
```bash
|
|
91
|
+
curl "http://127.0.0.1:3939/v1/mail/folders?refresh=true"
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
```json
|
|
95
|
+
{
|
|
96
|
+
"folders": [
|
|
97
|
+
{
|
|
98
|
+
"id": "AAMkAGI2...",
|
|
99
|
+
"display_name": "Inbox",
|
|
100
|
+
"well_known_name": "inbox",
|
|
101
|
+
"parent_folder_id": null,
|
|
102
|
+
"child_folder_count": 0,
|
|
103
|
+
"unread_item_count": 4,
|
|
104
|
+
"total_item_count": 128
|
|
105
|
+
}
|
|
106
|
+
]
|
|
107
|
+
}
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
#### `GET /v1/mail/messages?folder=inbox&limit=30&unread=false&flagged=false&focused=false&refresh=false&offline=false`
|
|
111
|
+
|
|
112
|
+
Lists messages in a mail folder (`inbox`, `sent`, `drafts`, `archive`, `trash`, `junk`, folder name, or folder ID).
|
|
113
|
+
|
|
114
|
+
```bash
|
|
115
|
+
curl "http://127.0.0.1:3939/v1/mail/messages?folder=inbox&limit=20&unread=true"
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
```json
|
|
119
|
+
{
|
|
120
|
+
"folder": { "id": "AAMkAGI2...", "display_name": "Inbox", "well_known_name": "inbox" },
|
|
121
|
+
"messages": [
|
|
122
|
+
{
|
|
123
|
+
"id": "AAMkAGI2...",
|
|
124
|
+
"conversation_id": "AAQkAGI2...",
|
|
125
|
+
"folder_id": "AAMkAGI2...",
|
|
126
|
+
"subject": "Quarterly Review",
|
|
127
|
+
"from": { "name": "Bob Smith", "address": "bob@contoso.com" },
|
|
128
|
+
"received_at": "2026-11-18T09:30:00Z",
|
|
129
|
+
"is_read": false,
|
|
130
|
+
"flagged": false,
|
|
131
|
+
"importance": "normal",
|
|
132
|
+
"inference_classification": "focused",
|
|
133
|
+
"has_attachments": true,
|
|
134
|
+
"body_loaded": false,
|
|
135
|
+
"preview": "Attached are the Q4 numbers..."
|
|
136
|
+
}
|
|
137
|
+
]
|
|
138
|
+
}
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
#### `GET /v1/mail/messages/{id}?offline=false`
|
|
142
|
+
|
|
143
|
+
Fetches full headers, HTML/plain body, and attachment metadata for a single message (and caches it in SQLite). Messages fetched with expanded attachments include `attachments[].content_bytes_b64`.
|
|
144
|
+
|
|
145
|
+
```bash
|
|
146
|
+
curl "http://127.0.0.1:3939/v1/mail/messages/AAMkAGI2..."
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
#### `POST /v1/mail/send`
|
|
150
|
+
|
|
151
|
+
Composes and sends a new email (Markdown compiled to HTML) with optional `cc`, `bcc`, `importance` (`low` | `normal` | `high`), host file `attachments`, and `save_to_sent_items` (default `true`). `markdown` also accepts alias `body`.
|
|
152
|
+
|
|
153
|
+
```bash
|
|
154
|
+
curl -X POST http://127.0.0.1:3939/v1/mail/send \
|
|
155
|
+
-H "Content-Type: application/json" \
|
|
156
|
+
-d '{"to":["bob@contoso.com"],"subject":"Release v0.1.0","markdown":"Build **passed**!","importance":"high"}'
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
```json
|
|
160
|
+
{
|
|
161
|
+
"ok": true,
|
|
162
|
+
"to": ["bob@contoso.com"],
|
|
163
|
+
"subject": "Release v0.1.0"
|
|
164
|
+
}
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
#### `POST /v1/mail/messages/{id}/reply`
|
|
168
|
+
|
|
169
|
+
Replies (`reply_all: false`) or replies-all (`reply_all: true`) to an email message. `markdown` also accepts alias `body`.
|
|
170
|
+
|
|
171
|
+
```bash
|
|
172
|
+
curl -X POST http://127.0.0.1:3939/v1/mail/messages/AAMkAGI2.../reply \
|
|
173
|
+
-H "Content-Type: application/json" \
|
|
174
|
+
-d '{"markdown":"Looks good, approved.","reply_all":true}'
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
#### `POST /v1/mail/messages/{id}/forward`
|
|
178
|
+
|
|
179
|
+
Forwards an email message to one or more recipients (`to`) with an optional Markdown `markdown` (alias `comment`) preface.
|
|
180
|
+
|
|
181
|
+
```bash
|
|
182
|
+
curl -X POST http://127.0.0.1:3939/v1/mail/messages/AAMkAGI2.../forward \
|
|
183
|
+
-H "Content-Type: application/json" \
|
|
184
|
+
-d '{"to":["carol@contoso.com"],"markdown":"FYI — see thread below."}'
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
#### `PATCH /v1/mail/messages/{id}`
|
|
188
|
+
|
|
189
|
+
Updates read status (`is_read`), flag status (`flagged`), and/or moves the message to `destination_folder_id` (alias `destination_folder`, accepting folder name, alias such as `"archive"`, or folder ID). At least one field must be provided.
|
|
190
|
+
|
|
191
|
+
To edit an existing draft's subject or body, use `outlook edit-draft` or MCP `update_draft`. To edit an active composition, use the TUI.
|
|
192
|
+
|
|
193
|
+
```bash
|
|
194
|
+
curl -X PATCH http://127.0.0.1:3939/v1/mail/messages/AAMkAGI2... \
|
|
195
|
+
-H "Content-Type: application/json" \
|
|
196
|
+
-d '{"is_read":true,"flagged":false,"destination_folder_id":"archive"}'
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
```json
|
|
200
|
+
{
|
|
201
|
+
"ok": true,
|
|
202
|
+
"message_id": "AAMkAGI2...",
|
|
203
|
+
"is_read": true,
|
|
204
|
+
"flagged": false,
|
|
205
|
+
"moved": { "id": "AAMkAGI2...", "folder_id": "AAMkAGI2..." }
|
|
206
|
+
}
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
#### `DELETE /v1/mail/messages/{id}`
|
|
210
|
+
|
|
211
|
+
Deletes a mail message and removes it from the local SQLite cache.
|
|
212
|
+
|
|
213
|
+
```bash
|
|
214
|
+
curl -X DELETE http://127.0.0.1:3939/v1/mail/messages/AAMkAGI2...
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
#### `POST /v1/mail/messages/{id}/attachments/{att_id}/download`
|
|
218
|
+
|
|
219
|
+
Downloads an attachment to disk on the host running `outlook serve` (defaults to `download_dir`, usually `Downloads/outlook`). Optional body: `{"out_dir": "/path/to/dir"}` (alias `dir`).
|
|
220
|
+
|
|
221
|
+
```bash
|
|
222
|
+
curl -X POST http://127.0.0.1:3939/v1/mail/messages/AAMkAGI2.../attachments/ATT_ID/download \
|
|
223
|
+
-H "Content-Type: application/json" \
|
|
224
|
+
-d '{"out_dir":"./downloads"}'
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
```json
|
|
228
|
+
{
|
|
229
|
+
"ok": true,
|
|
230
|
+
"path": "./downloads/report.pdf",
|
|
231
|
+
"file_name": "report.pdf",
|
|
232
|
+
"bytes_written": 48120
|
|
233
|
+
}
|
|
234
|
+
```
|
|
235
|
+
|
|
236
|
+
#### `GET /v1/mail/search?q=...&folder=&remote=false&limit=30`
|
|
237
|
+
|
|
238
|
+
Searches local SQLite FTS5 + `LIKE` (`hits`) and, when `remote=true`, queries Microsoft Graph KQL `$search` (`remote`) while caching returned messages.
|
|
239
|
+
|
|
240
|
+
```bash
|
|
241
|
+
curl "http://127.0.0.1:3939/v1/mail/search?q=quarterly&remote=true&limit=20"
|
|
242
|
+
```
|
|
243
|
+
|
|
244
|
+
### Calendar
|
|
245
|
+
|
|
246
|
+
#### `GET /v1/calendar/events?from=&to=&days=7&limit=50&offline=false`
|
|
247
|
+
|
|
248
|
+
Lists calendar events within a time window (`from` / `to` accept aliases `start` / `end` as ISO-8601 or `YYYY-MM-DD`; defaults to now through `+7` days).
|
|
249
|
+
|
|
250
|
+
```bash
|
|
251
|
+
curl "http://127.0.0.1:3939/v1/calendar/events?days=14"
|
|
252
|
+
```
|
|
253
|
+
|
|
254
|
+
```json
|
|
255
|
+
{
|
|
256
|
+
"start": "2026-11-18T00:00:00Z",
|
|
257
|
+
"end": "2026-12-02T00:00:00Z",
|
|
258
|
+
"events": [
|
|
259
|
+
{
|
|
260
|
+
"id": "AAMkAGI2...",
|
|
261
|
+
"subject": "Architecture Review",
|
|
262
|
+
"start_iso": "2026-11-20T09:00:00Z",
|
|
263
|
+
"end_iso": "2026-11-20T10:00:00Z",
|
|
264
|
+
"time_zone": "UTC",
|
|
265
|
+
"is_all_day": false,
|
|
266
|
+
"location": "Room 4B",
|
|
267
|
+
"response_status": "accepted",
|
|
268
|
+
"is_online_meeting": true,
|
|
269
|
+
"online_meeting_url": "https://teams.microsoft.com/l/meetup-join/..."
|
|
270
|
+
}
|
|
271
|
+
]
|
|
272
|
+
}
|
|
273
|
+
```
|
|
274
|
+
|
|
275
|
+
#### `POST /v1/calendar/events`
|
|
276
|
+
|
|
277
|
+
Creates a new calendar event. `start_iso` / `end_iso` accept aliases `start` / `end`; `markdown` accepts alias `body`; `is_online_meeting` accepts alias `online`.
|
|
278
|
+
|
|
279
|
+
```bash
|
|
280
|
+
curl -X POST http://127.0.0.1:3939/v1/calendar/events \
|
|
281
|
+
-H "Content-Type: application/json" \
|
|
282
|
+
-d '{"subject":"Sprint Planning","start_iso":"2026-11-20T14:00:00Z","end_iso":"2026-11-20T15:00:00Z","attendees":["bob@contoso.com"],"is_online_meeting":true}'
|
|
283
|
+
```
|
|
284
|
+
|
|
285
|
+
#### `GET /v1/calendar/events/{id}?offline=false`
|
|
286
|
+
|
|
287
|
+
Reads full details and attendees for a calendar event.
|
|
288
|
+
|
|
289
|
+
```bash
|
|
290
|
+
curl "http://127.0.0.1:3939/v1/calendar/events/AAMkAGI2..."
|
|
291
|
+
```
|
|
292
|
+
|
|
293
|
+
#### `POST /v1/calendar/events/{id}/rsvp`
|
|
294
|
+
|
|
295
|
+
Responds to a meeting invitation (`response`: `"accept"` | `"tentative"` | `"decline"`, optional `comment`).
|
|
296
|
+
|
|
297
|
+
```bash
|
|
298
|
+
curl -X POST http://127.0.0.1:3939/v1/calendar/events/AAMkAGI2.../rsvp \
|
|
299
|
+
-H "Content-Type: application/json" \
|
|
300
|
+
-d '{"response":"accept","comment":"See you there."}'
|
|
301
|
+
```
|
|
302
|
+
|
|
303
|
+
#### `DELETE /v1/calendar/events/{id}`
|
|
304
|
+
|
|
305
|
+
Cancels/deletes a calendar event and removes it from the local cache.
|
|
306
|
+
|
|
307
|
+
```bash
|
|
308
|
+
curl -X DELETE http://127.0.0.1:3939/v1/calendar/events/AAMkAGI2...
|
|
309
|
+
```
|
|
310
|
+
|
|
311
|
+
### Microsoft To Do
|
|
312
|
+
|
|
313
|
+
#### `GET /v1/todo/lists?refresh=false&offline=false`
|
|
314
|
+
|
|
315
|
+
Lists Microsoft To Do task lists.
|
|
316
|
+
|
|
317
|
+
```bash
|
|
318
|
+
curl "http://127.0.0.1:3939/v1/todo/lists"
|
|
319
|
+
```
|
|
320
|
+
|
|
321
|
+
#### `GET /v1/todo/tasks?list=tasks&all=false&limit=50&refresh=false&offline=false`
|
|
322
|
+
|
|
323
|
+
Lists tasks in a To Do list (`all` accepts alias `include_completed`).
|
|
324
|
+
|
|
325
|
+
```bash
|
|
326
|
+
curl "http://127.0.0.1:3939/v1/todo/tasks?list=tasks&all=true"
|
|
327
|
+
```
|
|
328
|
+
|
|
329
|
+
#### `POST /v1/todo/tasks`
|
|
330
|
+
|
|
331
|
+
Creates a To Do task (`body_plain` accepts alias `notes`; `due_date_iso` accepts alias `due`; `importance`: `low` | `normal` | `high`).
|
|
332
|
+
|
|
333
|
+
```bash
|
|
334
|
+
curl -X POST http://127.0.0.1:3939/v1/todo/tasks \
|
|
335
|
+
-H "Content-Type: application/json" \
|
|
336
|
+
-d '{"title":"Publish outlook v0.1.0","due_date_iso":"2026-11-20","importance":"high"}'
|
|
337
|
+
```
|
|
338
|
+
|
|
339
|
+
#### `PATCH /v1/todo/tasks/{id}`
|
|
340
|
+
|
|
341
|
+
Marks a To Do task completed or incomplete (`{ "list"?: "tasks", "completed": true }`).
|
|
342
|
+
|
|
343
|
+
```bash
|
|
344
|
+
curl -X PATCH http://127.0.0.1:3939/v1/todo/tasks/TASK_ID \
|
|
345
|
+
-H "Content-Type: application/json" \
|
|
346
|
+
-d '{"completed":true}'
|
|
347
|
+
```
|
|
348
|
+
|
|
349
|
+
#### `DELETE /v1/todo/tasks/{id}?list=tasks`
|
|
350
|
+
|
|
351
|
+
Deletes a To Do task.
|
|
352
|
+
|
|
353
|
+
```bash
|
|
354
|
+
curl -X DELETE "http://127.0.0.1:3939/v1/todo/tasks/TASK_ID?list=tasks"
|
|
355
|
+
```
|
|
356
|
+
|
|
357
|
+
### Contacts & Directory
|
|
358
|
+
|
|
359
|
+
#### `GET /v1/contacts?q=&limit=50&offline=false`
|
|
360
|
+
|
|
361
|
+
Lists personal Outlook contacts (`/me/contacts`) or, when `q` (alias `query`) is provided, searches both personal contacts and the Entra ID organization directory (`/users`).
|
|
362
|
+
|
|
363
|
+
```bash
|
|
364
|
+
curl "http://127.0.0.1:3939/v1/contacts?q=alice&limit=20"
|
|
365
|
+
```
|