@bitefoundry/outlook 0.1.5 → 0.1.6
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/README.md +162 -145
- package/docs/API.md +365 -0
- package/docs/MCP.md +146 -0
- package/docs/NPM.md +236 -236
- package/docs/openapi.yaml +705 -0
- package/package.json +49 -46
package/docs/API.md
ADDED
|
@@ -0,0 +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
|
+
```
|
package/docs/MCP.md
ADDED
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
# `outlook` MCP Server
|
|
2
|
+
|
|
3
|
+
`outlook mcp` (alias `mcp-server`) runs a [Model Context Protocol](https://modelcontextprotocol.io/) server over **stdio** using newline-delimited JSON-RPC 2.0. It exposes pure **Microsoft Outlook** capabilities (**Mail**, **Calendar**, **Microsoft To Do**, and **Contacts & Entra Directory**) to MCP-capable agents such as Claude Desktop, Claude Code, and OpenAI Codex.
|
|
4
|
+
|
|
5
|
+
## Requirements
|
|
6
|
+
|
|
7
|
+
1. Install or build the `outlook` binary:
|
|
8
|
+
```bash
|
|
9
|
+
npm install -g @bitefoundry/outlook
|
|
10
|
+
# or from source:
|
|
11
|
+
cargo build --release
|
|
12
|
+
```
|
|
13
|
+
2. Authenticate once (the MCP server never prompts interactively on stdin):
|
|
14
|
+
```bash
|
|
15
|
+
outlook login
|
|
16
|
+
```
|
|
17
|
+
Or configure `OUTLOOK_ACCESS_TOKEN` / `OUTLOOK_TOKEN_FILE` (+ optional `OUTLOOK_TOKEN_REFRESH_CMD`), or rely on the automatic M365 shared-session bootstrap from `teams-cli` / `TEAMS_TOKEN_FILE` (`OUTLOOK_SHARE_M365_AUTH=true`).
|
|
18
|
+
3. Ensure `outlook` (e.g. `target/release/outlook.exe` on Windows or on `PATH`) is accessible to your MCP host.
|
|
19
|
+
|
|
20
|
+
## Starting manually
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
outlook mcp # stdio: one JSON-RPC 2.0 object per line
|
|
24
|
+
outlook mcp-server # alias
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
`stdout` is strictly reserved for single-line JSON-RPC 2.0 responses; diagnostics and startup warnings are written to `stderr` only.
|
|
28
|
+
|
|
29
|
+
## Client configuration
|
|
30
|
+
|
|
31
|
+
### Claude Desktop
|
|
32
|
+
|
|
33
|
+
`claude_desktop_config.json`:
|
|
34
|
+
|
|
35
|
+
```json
|
|
36
|
+
{
|
|
37
|
+
"mcpServers": {
|
|
38
|
+
"outlook": {
|
|
39
|
+
"command": "outlook",
|
|
40
|
+
"args": ["mcp"]
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
On Windows with an explicit executable path:
|
|
47
|
+
|
|
48
|
+
```json
|
|
49
|
+
{
|
|
50
|
+
"mcpServers": {
|
|
51
|
+
"outlook": {
|
|
52
|
+
"command": "C:\\Users\\me\\source\\outlook\\target\\release\\outlook.exe",
|
|
53
|
+
"args": ["mcp"]
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
### Claude Code
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
claude mcp add outlook -- outlook mcp
|
|
63
|
+
# or with an explicit binary path:
|
|
64
|
+
claude mcp add outlook -- C:\Users\me\source\outlook\target\release\outlook.exe mcp
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
### OpenAI Codex
|
|
68
|
+
|
|
69
|
+
`~/.codex/config.toml`:
|
|
70
|
+
|
|
71
|
+
```toml
|
|
72
|
+
[mcp_servers.outlook]
|
|
73
|
+
command = "outlook"
|
|
74
|
+
args = ["mcp"]
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
## Protocol
|
|
78
|
+
|
|
79
|
+
- **Transport**: JSON-RPC 2.0 over stdio, **newline-delimited JSON** (one JSON object per line, no `Content-Length` headers; maximum `8 MiB` per request line).
|
|
80
|
+
- **Supported `protocolVersion`s**: `2024-11-05`, `2025-03-26`, `2025-06-18` (unknown versions fall back to `2025-06-18`).
|
|
81
|
+
- **`serverInfo`**: The server name is `outlook` and the version matches `CARGO_PKG_VERSION`.
|
|
82
|
+
- **Startup**: `initialize` responds immediately; on an empty cache, initial mail folder bootstrap runs asynchronously in the background.
|
|
83
|
+
- **Notifications**: requests without `id` or methods starting with `notifications/` (such as `notifications/initialized`) emit no response.
|
|
84
|
+
- **`ping`**: returns `{}`.
|
|
85
|
+
- **Error codes**: `-32700` parse error, `-32600` invalid JSON-RPC envelope (or oversized line > `8 MiB`), `-32601` method not found.
|
|
86
|
+
- **`tools/call`**: returns `{ "content": [{ "type": "text", "text": "<pretty JSON>" }], "isError": false }` on success, or `"isError": true` with an error message (including JWT `scp`/`roles` permission diagnostics on `403`) on validation/Graph failures.
|
|
87
|
+
|
|
88
|
+
## Microsoft Outlook Tools (23)
|
|
89
|
+
|
|
90
|
+
Mail `folder` arguments accept a canonical folder ID, display name/prefix, or well-known alias (`inbox`, `sent`, `drafts`, `archive`, `trash`, `junk`). To Do `list` arguments accept a list ID, display name, or `'tasks'` / `'defaultList'`.
|
|
91
|
+
|
|
92
|
+
| # | Tool | Domain | Arguments | Returns |
|
|
93
|
+
| --- | --- | --- | --- | --- |
|
|
94
|
+
| 1 | `whoami` | Auth | *(none)* | `{ "authenticated": bool, "user_id": ..., "email": ..., "auth_mode": ..., "auth_source": ..., "scopes": [...] }` |
|
|
95
|
+
| 2 | `list_mail_folders` | Mail | `refresh?` (bool), `offline?` (bool) | `{ "folders": [...] }` |
|
|
96
|
+
| 3 | `list_messages` | Mail | `folder?` (default `'inbox'`), `limit?` (1..200), `unread?`, `flagged?`, `focused?`, `offline?`, `compact?` | `{ "folder": {...}, "messages": [...] }` |
|
|
97
|
+
| 4 | `get_message` | Mail | `message_id` (req), `mark_read?`, `offline?`, `compact?` | `{ "message": {...} }` |
|
|
98
|
+
| 5 | `send_mail` | Mail | `to` (`string[]`, req), `subject` (req), `body` (Markdown, req), `cc?`, `bcc?`, `importance?` (`low\|normal\|high`), `attachments?`, `save_to_sent_items?` | `{ "ok": true, "to": [...], "subject": "..." }` |
|
|
99
|
+
| 6 | `reply_mail` | Mail | `message_id` (req), `body` (req), `reply_all?` | `{ "ok": true, "message_id": "...", "reply_all": bool }` |
|
|
100
|
+
| 7 | `forward_mail` | Mail | `message_id` (req), `to` (`string[]`, req), `comment?` | `{ "ok": true, "message_id": "...", "to": [...] }` |
|
|
101
|
+
| 8 | `update_message` | Mail | `message_id` (req), `is_read?`, `flagged?`, `destination_folder?` | `{ "ok": true, "message_id": "...", "is_read": ..., "flagged": ..., "moved": ... }` |
|
|
102
|
+
| 9 | `delete_message` | Mail | `message_id` (req), `confirm` (must be literal `true`) | `{ "ok": true, "message_id": "..." }` |
|
|
103
|
+
| 10 | `download_attachment` | Mail | `message_id` (req), `attachment_index?` (>=0), `attachment?` (ID/name/index), `output_dir?` | `{ "ok": true, "attachment": {...}, "file": {...} }` |
|
|
104
|
+
| 11 | `search_mail` | Mail | `query` (req), `folder?`, `limit?` (1..200), `offline?` | `{ "query": "...", "hits": [...] }` (offline) or `{ "query": "...", "messages": [...] }` (online) |
|
|
105
|
+
| 12 | `list_events` | Calendar | `from?` (`ISO-8601\|YYYY-MM-DD`), `to?`, `days?` (1..365), `limit?` (1..200), `offline?` | `{ "start": "...", "end": "...", "events": [...] }` |
|
|
106
|
+
| 13 | `create_event` | Calendar | `subject` (req), `start` (req), `end` (req), `time_zone?`, `is_all_day?`, `location?`, `body?`, `attendees?`, `is_online_meeting?` | `{ "ok": true, "event": {...} }` |
|
|
107
|
+
| 14 | `respond_event` | Calendar | `event_id` (req), `response` (`accept\|tentative\|decline`, req), `comment?` | `{ "ok": true, "event_id": "...", "response": "..." }` |
|
|
108
|
+
| 15 | `delete_event` | Calendar | `event_id` (req), `confirm` (must be literal `true`) | `{ "ok": true, "event_id": "..." }` |
|
|
109
|
+
| 16 | `list_todo_lists` | To Do | `refresh?`, `offline?` | `{ "lists": [...] }` |
|
|
110
|
+
| 17 | `list_tasks` | To Do | `list?`, `include_completed?`, `limit?` (1..200), `offline?` | `{ "list": {...}, "list_id": "...", "tasks": [...] }` |
|
|
111
|
+
| 18 | `create_task` | To Do | `title` (req), `list?`, `notes?`, `due?` (`YYYY-MM-DD\|ISO-8601`), `importance?` (`low\|normal\|high`) | `{ "ok": true, "task": {...} }` |
|
|
112
|
+
| 19 | `complete_task` | To Do | `task_id` (req), `list?`, `completed?` (default `true`) | `{ "ok": true, "task": {...} }` |
|
|
113
|
+
| 20 | `search_contacts` | Contacts | `query?`, `limit?` (1..200), `offline?` | `{ "contacts": [...] }` |
|
|
114
|
+
| 21 | `update_draft` | Mail | `message_id` (req), `subject?`, `body?` (Markdown), `body_html?` (HTML) | `{ "ok": true, "message_id": "..." }` |
|
|
115
|
+
| 22 | `update_event` | Calendar | `event_id` (req), `subject?`, `start?`, `end?` | `{ "ok": true, "event": {...} }` |
|
|
116
|
+
| 23 | `update_task` | To Do | `task_id` (req), `list?` (default `'tasks'`), `title?`, `due?` | `{ "ok": true, "task": {...} }` |
|
|
117
|
+
|
|
118
|
+
### Destructive tool guard (`confirm: true`)
|
|
119
|
+
|
|
120
|
+
`delete_message` and `delete_event` require `"confirm": true` as a literal JSON boolean. Omitting `confirm`, passing `false`, `"true"`, or `1` is rejected during argument validation before any Graph API call is made.
|
|
121
|
+
|
|
122
|
+
### Example JSON-RPC session
|
|
123
|
+
|
|
124
|
+
```json
|
|
125
|
+
{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2025-06-18","capabilities":{},"clientInfo":{"name":"agent","version":"1.0"}}}
|
|
126
|
+
{"jsonrpc":"2.0","method":"notifications/initialized"}
|
|
127
|
+
{"jsonrpc":"2.0","id":2,"method":"tools/list"}
|
|
128
|
+
{"jsonrpc":"2.0","id":3,"method":"tools/call","params":{"name":"list_messages","arguments":{"folder":"inbox","unread":true,"limit":20,"compact":true}}}
|
|
129
|
+
{"jsonrpc":"2.0","id":4,"method":"tools/call","params":{"name":"send_mail","arguments":{"to":["alice@contoso.com"],"subject":"Release v0.1.0","body":"Build **passed**!"}}}
|
|
130
|
+
{"jsonrpc":"2.0","id":5,"method":"tools/call","params":{"name":"create_event","arguments":{"subject":"Design Sync","start":"2026-11-20T09:00:00Z","end":"2026-11-20T10:00:00Z","is_online_meeting":true}}}
|
|
131
|
+
{"jsonrpc":"2.0","id":6,"method":"tools/call","params":{"name":"delete_message","arguments":{"message_id":"AAMkAGI2...","confirm":true}}}
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
## Notes and limitations
|
|
135
|
+
|
|
136
|
+
- `send_mail` `attachments` paths and `download_attachment` `output_dir` paths are resolved on the host running `outlook mcp`, not on a remote MCP client.
|
|
137
|
+
- Pass `"offline": true` on read/search tools (`list_mail_folders`, `list_messages`, `get_message`, `search_mail`, `list_events`, `list_todo_lists`, `list_tasks`, `search_contacts`) to query the local SQLite cache (`cache.db`) without network calls.
|
|
138
|
+
- With `"compact": true`, `list_messages` returns the message ID, subject, sender, received time, and read, draft, flag, and attachment indicators. `get_message` returns addresses, timestamps, status, and the complete `body_plain` when loaded. For HTML and attachments, call `get_message` with the default output.
|
|
139
|
+
- `update_message` accepts read and flag changes or a destination folder. An unsupported argument such as `subject` fails validation before any write. Use `update_draft` for a draft's subject or body.
|
|
140
|
+
|
|
141
|
+
## Partial edits
|
|
142
|
+
|
|
143
|
+
- **Drafts.** `update_draft` checks the message's current draft status in Graph. A subject-only edit preserves the stored HTML and attachments. To replace the body, send either `body` for rendered Markdown or `body_html` for the supplied HTML. The HTML value can include existing CID references that you want to keep. [Microsoft Graph message update](https://learn.microsoft.com/en-us/graph/api/message-update?view=graph-rest-1.0)
|
|
144
|
+
- **Calendar.** `update_event` sends only the supplied subject, start, and end. It leaves the body, attendees, meeting link, and recurrence out of the PATCH. A wall-clock value such as `2026-11-23T09:00` uses the original zone for that endpoint. An RFC3339 timestamp represents an instant and is converted to UTC. For a recurring event in a non-UTC zone, use wall-clock values to keep the series in its original zone. For all-day events, use `YYYY-MM-DD` in the original zone and provide an exclusive end date. Graph may send meeting updates and can reject occurrences moved across their neighbors. [Microsoft Graph event update](https://learn.microsoft.com/en-us/graph/api/event-update?view=graph-rest-1.0) · [Event time zones](https://learn.microsoft.com/en-us/graph/api/resources/event?view=graph-rest-1.0)
|
|
145
|
+
- **To Do.** `update_task` sends only the supplied title and due date. The checklist, body, recurrence, and completion state stay outside the PATCH. A due date of `2026-11-25` means midnight UTC on that date. A due timestamp must be RFC3339 and is converted to UTC. [Microsoft Graph To Do update](https://learn.microsoft.com/en-us/graph/api/todotask-update?view=graph-rest-1.0)
|
|
146
|
+
- `search_mail` with `"offline": false` (default) queries Microsoft Graph KQL `$search` and caches matched messages into SQLite.
|