Skip to main content
Glama
outlook-mcp

outlook-mcp

by ajs117

outlook-mcp

A local MCP server for a personal Outlook.com / Hotmail / Live account (not a work/school Microsoft 365 account). It talks to Microsoft Graph directly using an OAuth device-code login, so it runs entirely on your own machine — no third-party service sees your mail.

Tools it exposes: list_folders, inbox_summary, list_messages, get_message, archive_message, move_message, delete_message, mark_read, create_reply_draft, bulk variants bulk_mark_read, bulk_move_messages, bulk_archive_messages, bulk_delete_messages (all backed by Graph's $batch endpoint, chunked to 20 ops/call), bulk_by_query (match + act in one call, ids never leave the server), create_draft (compose a new draft), create_folder, sender_summary (per-sender counts and read rates), find_newsletters, unsubscribe, unsubscribe_many and protected_senders (a keep-list bulk ops won't touch).

Common workflows

  • Decide what to keep — measure, don't guess. sender_summary groups a folder by exact sending address and reports count, read, unread and read_pct per sender. A sender nobody opens is evidence; a sender whose name sounds like junk is not. Rows carry a heuristic brand label for display only — grouping is always by the full address, and brand_shared flags addresses whose brand collides with another, because hello@edfenergy.com (bills) and hello@home.edfenergy.com (marketing) are two different senders that must never be merged.

  • Triage a big folder / clear old mail. Use bulk_by_query with a search term and received_before to sweep, e.g. delete old shipping notifications: action="delete", search="delivery", received_before="2026-06-01". It runs dry_run first (count + sample), then executes on the second call. Custom folders work by name — action="move", destination_folder="Receipts" resolves the name to its id (create it first with create_folder if needed).

  • Unsubscribe from newsletters. find_newsletters lists bulk senders (grouped by sender, with read counts and the best unsubscribe method for each); unsubscribe_many(refs, execute=True) then does the whole sweep in one call. RFC 8058 one-click senders are unsubscribed with a single POST (no browser); mailto senders get an unsubscribe draft to send; link-only senders — and one-click endpoints that reject the POST, which some privacy portals do with a 405 — come back under needs_browser with a URL to open yourself (never auto-fetched). The List-Unsubscribe header means "bulk sender", not "junk": order confirmations, delivery updates, bank statements and voucher codes all carry it, so treat the output as candidates to show a human, never as a sweep list. Then clear the wanted ones with bulk_by_query(action="archive", only_newsletters=True) — the only_newsletters filter keeps just the bulk mail (List-Unsubscribe header) among the matches, so you can e.g. archive every newsletter older than a week. Note: unsubscribing confirms your address is live — do it for legitimate senders; for real spam, just delete/block.

  • Protect the mail you can't afford to lose. protected_senders(add=[...]) stores a keep-list — benefits, medical, legal, bills, anything with a case number. A pattern with */? is a glob over the whole address (*@edfenergy.com, which deliberately does not match a marketing subdomain); one without is a substring test (dwp). bulk_by_query then excludes protected senders from every sweep and reports how many it held back (on_protected="error" to abort instead, "include" to ignore the list), and bulk_delete_messages refuses outright unless called with allow_protected=True. The list lives in ~/.outlook_mcp_config.json (override with OUTLOOK_MCP_CONFIG).

  • Act on specific senders. bulk_by_query(senders_only=[...]) filters matches to an exact set of addresses client-side — Graph rejects a sender $filter alongside $orderby, so this is the supported route.

  • Draft an email. create_draft(to, subject, body) saves to Drafts and never sends — you review and send from Outlook. (This server holds Mail.ReadWrite, which can create drafts but deliberately cannot send.) list_messages also takes fetch_all=True to page past the default 25-message limit (up to max_results, default 500) instead of returning a single page.

Token efficiency

Graph message ids are ~150 characters of opaque base64 each, which dominates token cost when listing or bulk-triaging a mailbox. To keep tool traffic small:

  • Short refs. Listings return a compact ref (e.g. m12) per message instead of the raw id. Every tool accepts a ref in place of an id and resolves it server-side, so you pass m12, not a 150-char string. Refs are stable for the life of the server process; after a restart, just re-list.

  • Lean listings. list_messages returns only triage fields by default. For content, prefer include_keywords=True (a short salient-word list per message — denser than a preview) and reach for get_message for a full read. include_preview=True still attaches the full plaintext preview when wanted.

  • Plaintext, truncated bodies. get_message asks Graph for the plaintext body (not raw HTML) and truncates to max_chars (default 4000); include_body=False gives metadata only.

  • Compact bulk results. The bulk_* tools return {"ok": <count>, "failed_count": <n>, "failed": [...]} — succeeded ids are counted, not echoed back.

  • Filter-and-act — ids never touch the conversation. bulk_by_query matches messages by folder/filter_query/search and applies one action (archive/delete/mark_read/mark_unread/move) to all of them server-side, returning just a count. This is the cheapest way to triage: no id list is ever streamed through the model. It runs dry_run=True by default (returns a count + small sample and does nothing) so a bad filter can't silently nuke the wrong mail — call again with dry_run=False to execute.

1. Create a free Azure app registration (one-time, ~10 min)

You need this to get a client_id. It costs nothing — no Azure subscription or credit card required for this.

  1. Go to https://portal.azure.com and sign in with your Microsoft account (your outlook.com account works fine as the sign-in).

  2. Search for "App registrations" and click New registration.

  3. Name it anything, e.g. outlook-mcp-personal.

  4. Under Supported account types, choose: "Personal Microsoft accounts only" (or the "any organizational directory and personal Microsoft accounts" option — either works).

  5. Leave Redirect URI blank for now. Click Register.

  6. Copy the Application (client) ID shown on the Overview page — you'll need it below.

  7. In the left nav, go to Authentication → Add a platform → Mobile and desktop applications → check the https://login.microsoftonline.com/common/oauth2/nativeclient box → Configure.

  8. Still on the Authentication page, scroll down to Advanced settings and set "Allow public client flows" to Yes. Save.

  9. In the left nav, go to API permissions → Add a permission → Microsoft Graph → Delegated permissions → add Mail.ReadWrite, MailboxSettings.Read, User.Read, offline_access (offline_access is usually pre-added). Click Add permissions. (No admin consent needed for a personal account signing into their own app.)

That's it — no client secret needed, this is a "public client."

Related MCP server: email-mcp

2. Install

cd outlook-mcp
pip install -e .

3. Configure

Set the client ID from step 1:

export OUTLOOK_MCP_CLIENT_ID="<your-application-client-id>"

(Put this in your shell profile so it persists.)

4. Add to Claude Desktop / Cowork

Edit your Claude Desktop MCP config (Settings → Developer → Edit Config, or directly at ~/Library/Application Support/Claude/claude_desktop_config.json on macOS) and add:

{
  "mcpServers": {
    "outlook-personal": {
      "command": "outlook-mcp",
      "env": {
        "OUTLOOK_MCP_CLIENT_ID": "<your-application-client-id>"
      }
    }
  }
}

Restart Claude Desktop. The first time you call a tool, the server prints a device-login URL and code — open the URL in a browser, enter the code, sign in with your outlook.com account, and approve. After that, tokens refresh silently and you won't be prompted again (cached in ~/.outlook_mcp_token_cache.json, permissions 600).

Notes / limitations

  • delete_message is a soft delete (moves to Deleted Items), matching how Graph's message DELETE actually behaves — nothing is purged permanently by this tool.

  • create_reply_draft only creates a draft; it never sends mail on its own.

  • This is a personal single-user tool: the token cache is a plain JSON file on disk, meant for your own machine, not a shared/multi-user deployment.

  • If you ever want to turn this into a shareable connector, the gap to close is: move off device-code flow to a proper auth-code + PKCE flow with a redirect, host it somewhere, get Microsoft's app verification for the requested scopes, and register it in Claude's MCP directory.

Available Tools

21 tools
archive_messageB

Move a message (by ref or raw id) to the Archive folder.

Inputs: message_id (required).

bulk_archive_messagesB

Move many messages (refs or raw ids) to the Archive folder in one call.

Inputs: message_ids (required).

bulk_by_queryA

Find every message matching a query and apply one action to all of them in a single call — the message ids never enter the conversation, so this is by far the cheapest way to triage in bulk.

action: one of archive, delete, mark_read, mark_unread, move (move requires destination_folder, which may be a folder display name). folder / filter_query / search: same matching semantics as list_messages (fetches all matches up to max_results). received_before / received_after: ISO dates (e.g. "2026-01-01"); applied client-side AFTER matching, so they compose with search — which Graph itself won't combine with a date $filter. Use these for "old " sweeps, e.g. search="delivery" + received_before to clear old shipping mail. only_newsletters: keep only bulk/newsletter mail (messages with a List-Unsubscribe header) among the matches, e.g. archive all newsletters older than a week. Costs an extra batched header pass over the matches. Note this is a bulk-sender signal, not a junk one — plenty of wanted mail (order updates, voucher codes, statements) carries the header too. senders_only: keep only matches from these sending addresses (exact, case-insensitive). Graph rejects a sender $filter combined with $orderby, so this is applied client-side — it is the supported way to act per sender. Pair it with sender_summary to pick the addresses. on_protected: what to do about matches from protected senders (see protected_senders): "exclude" (default, skip them and report), "error" (do nothing at all and report), "include" (ignore the list). dry_run: TRUE by default — returns how many messages would be affected plus a small sample of subjects/senders, and does nothing. Review it, then call again with dry_run=False to actually run the action. This guards against a bad filter nuking the wrong mail.

Inputs: action (required), folder, search, dry_run, +8 more.

bulk_delete_messagesA

Move many messages (refs or raw ids) to Deleted Items in one call, marking them read first (mark_as_read=False to keep them unread).

Refuses and deletes nothing if any message is from a protected sender (see protected_senders) — re-call with allow_protected=True to override. Senders are only known for messages this server has already listed or read; refs it has never seen cannot be checked.

Inputs: message_ids (required), mark_as_read, allow_protected.

bulk_mark_readB

Mark many messages (refs or raw ids) read/unread in one call (Graph $batch).

Inputs: message_ids (required), is_read.

bulk_move_messagesB

Move many messages (refs or raw ids) to a folder (id or well-known name) in one call.

Inputs: message_ids (required), destination_folder (required).

create_draftA

Compose a brand-new draft email (NOT a reply). It is saved to Drafts and never sent — you review and send it from Outlook.

Args: to: recipient email addresses. subject: subject line. body: message body (plain text by default; set html=True to send HTML). cc: optional cc email addresses. html: treat body as HTML instead of plain text.

Inputs: to (required), body (required), subject (required), cc, +1 more.

create_folderB

Create a mail folder. parent_folder (id or display name) nests it; omit for a top-level folder. Useful before moving mail into a new folder.

Inputs: display_name (required), parent_folder.

create_reply_draftA

Create a draft reply to a message (by ref or raw id). Does NOT send it; a human reviews/sends from Outlook.

Inputs: message_id (required), comment.

delete_messageA

Move a message (by ref or raw id) to Deleted Items — recoverable from there until you empty it. Marks it read first (mark_as_read=False to keep it unread) so deleted mail doesn't linger in your unread count.

Inputs: message_id (required), mark_as_read.

find_newslettersA

Scan a folder for bulk mail (messages carrying a List-Unsubscribe header) and report how each sender can be unsubscribed.

Grouped by sender by default, because unsubscribing is per sender while the underlying listing is per message — the ungrouped form makes the model dedupe 200 rows by hand to reach the ~50 decisions that actually exist. Each row carries read/unread counts so a sender can be judged on engagement rather than on what its name suggests.

IMPORTANT: the List-Unsubscribe header marks a bulk sender, not junk. Order confirmations, delivery updates, statements and voucher codes all carry it. Treat this as a list of candidates to show the user, never as a list to sweep.

Returns {checked, headers_ok, header_fetch_failed, newsletter_messages, senders: [...]}. The header counts are there so a discrepancy between this and bulk_by_query(only_newsletters=True) is visible rather than mysterious: header sub-requests that fail are silently dropped from the scan.

Args: folder: folder id or well-known name. max_check: how many recent messages to scan. group_by_sender: set False for the raw per-message rows.

Inputs: folder, max_check, group_by_sender.

get_messageA

Get one message by ref (or raw id). Body is returned as plaintext and truncated to max_chars to keep it token-cheap.

Args: message_id: a short ref from list_messages (e.g. "m12"), or a raw Graph id. include_body: set False to get metadata only (subject/from/date), no body. max_chars: truncate the plaintext body to this many characters (0 = no limit).

Inputs: message_id (required), max_chars, include_body.

inbox_summaryA

Quick counts for the inbox: total messages and unread messages.

Inputs: no named parameters.

list_foldersA

List all mail folders (Inbox, Archive, Deleted Items, custom folders, etc.) with their ids and display names.

Inputs: no named parameters. Returns: result

list_messagesA

List messages in a folder, newest first (unless searching).

Returns compact rows keyed by a short ref handle (not the raw Graph id) — pass that ref to get_message / move / delete / the bulk_* tools.

Args: folder: folder id or well-known name (inbox, archive, deleteditems, sentitems, drafts, junkemail). top: max number of messages to return per page (ignored if fetch_all is True). skip: number of messages to skip, for manual paging (ignored if fetch_all is True). filter_query: raw OData $filter, e.g. "receivedDateTime le 2026-01-01T00:00:00Z" or "isRead eq false". search: free-text search (Graph $search); when set, filter_query/order are ignored. fetch_all: if True, follow pagination automatically and return up to max_results messages instead of a single page of top. Use this for bulk operations over a whole folder. max_results: cap on messages returned when fetch_all is True (safety limit, default 500). include_keywords: attach a short salient-keyword list per message (subject+preview) for triage. include_preview: attach the full plaintext preview per message. Prefer include_keywords for triage and get_message for a full read — a preview per message across a big folder is costly.

Inputs: top, skip, folder, search, +5 more. Returns: result

mark_readB

Mark a message (by ref or raw id) as read or unread.

Inputs: message_id (required), is_read.

move_messageB

Move a message (by ref or raw id) to a folder (id or well-known name).

Inputs: message_id (required), destination_folder (required).

protected_sendersA

Read or edit the keep-list of senders that bulk operations won't touch.

Patterns are matched case-insensitively against the sending address: one containing * or ? is a glob over the whole address ("*@edfenergy.com"), one without is a substring test ("dwp"). Use this for the mail that would be expensive to lose — benefits, legal, medical, bills, anything with a case number — so a broad sweep can't reach it.

bulk_by_query excludes protected senders by default and says how many it held back; bulk_delete_messages refuses outright. Both can be overridden per call once you've looked.

Call with no arguments to just read the list.

Inputs: add, remove.

sender_summaryA

Group a whole folder by sending address and report, per sender, how many messages there are and how many were actually opened.

This is the tool to reach for before proposing anything for deletion. A sender's read rate is measured evidence of whether the mailbox owner wants their mail; guessing from the brand name is not, and gets it wrong.

Returns rows {sender, brand, domain, count, read, unread, read_pct, newest, oldest, sample_ref}, biggest sender first. brand is a heuristic display label — never group or delete by it. brand_shared: true marks a row whose brand label also belongs to another address in the result (e.g. a billing subdomain and a marketing subdomain of one company): those are different senders and must stay separate.

Args: folder: folder id or well-known name. min_count: drop senders with fewer than this many messages. top: return at most this many sender rows (after sorting by count). max_results: cap on messages scanned. unread_only: summarise only unread mail.

Inputs: top, folder, min_count, max_results, +1 more.

unsubscribeA

Unsubscribe from the bulk sender of a message (ref or raw id).

Reads the message's List-Unsubscribe headers and:

  • method "one-click": with execute=True, performs the RFC 8058 one-click POST and returns the HTTP status — no browser needed.

  • method "mailto": with execute=True, creates a DRAFT unsubscribe email to the sender's unsubscribe address for you to send (our mail scope can create but not send mail).

  • method "weblink": returns the URL for you to open in a browser; not auto-fetched, since blindly GETting links embedded in email is unsafe.

With execute=False (default) it only reports the available method/target so you can decide. Caveat: unsubscribing confirms your address is live, so do it for legitimate senders — for actual spam, prefer delete/block instead.

Inputs: message_id (required), execute.

unsubscribe_manyA

Unsubscribe from many bulk senders in one call.

Deduplicates on the unsubscribe target, never on the sender: LinkedIn job alerts all arrive from one address but carry a different savedSearchId each, so skipping by sender leaves most streams subscribed while reporting success. Two messages for the same stream still carry different per-message tokens and so both get posted — a wasted request is cheaper than a missed unsubscribe.

Same per-message semantics as unsubscribe(), but the header fetch is batched and the whole sweep is one tool call instead of one per sender.

Returns {attempted, unsubscribed, needs_browser, drafted, failed, results: [...]}. needs_browser collects the senders whose only working route is a URL a human must open — including one-click endpoints that rejected the POST — so nothing fails silently.

Inputs: message_ids (required), execute.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A3.5/5.0

    Scored across 21 tools

    Disambiguation3/5

    The core distinction between single-message and bulk tools is mostly clear, but bulk_by_query overlaps heavily with the dedicated bulk_* tools and with archive_message/move_message/delete_message/mark_read. archive_message also largely duplicates move_message to Archive, and find_newsletters overlaps with bulk_by_query(only_newsletters=True), so an agent has several plausible routes for the same operation.

    Naming Consistency3/5

    Most tools use snake_case and are readable, but the naming convention is mixed: many are verb_noun (list_messages, move_message, create_draft), while others are noun-centric or phrase-based (inbox_summary, sender_summary, bulk_by_query, protected_senders). It is not chaotic, but the pattern is not predictable enough for a high score.

    Tool Count3/5

    At 21 tools, the server is in the heavy borderline range. The domain is complex enough to justify many operations, but there is noticeable duplication between general bulk actions, dedicated bulk tools, and single-message action tools, which inflates the surface.

    Completeness4/5

    The tool set covers the main mail triage lifecycle well: folders, listing/reading messages, summaries, drafts and reply drafts, single and bulk move/delete/archive/mark operations, newsletter discovery/unsubscribe, and protected senders. Minor gaps remain, such as sending mail, attachment handling, folder rename/delete, and draft editing, but core workflows are covered.

    Maintenance

    ActivityNo data
    ResponsivenessOutdated data

    Related MCP Connectors

    Related MCP Servers

    • F
      license
      A
      quality
      D
      maintenance
      A lightweight MCP server for personal Microsoft Outlook/Hotmail accounts, enabling email search, reading, attachment management, and folder operations via Microsoft Graph API with OAuth device-code flow.
      6
      1
      -
    • A
      license
      A
      quality
      D
      maintenance
      Local MCP server for multi-account IMAP/SMTP email (iCloud + Gmail via app-specific passwords). Never marks mail read. Cross-folder search, idempotent sends, TLS verified.
      8
      22 PyPI
      MIT
    • A
      license
      A
      quality
      D
      maintenance
      A local MCP server that connects Claude Desktop to a personal Hotmail/Outlook.com mailbox via Microsoft Graph API, enabling email management, rule handling, and composing messages.
      25
      MIT
    • A
      license
      Not graded
      quality
      D
      maintenance
      MCP server providing full control over Outlook.com, Hotmail, Live, or Microsoft 365 email via Microsoft Graph API, enabling reading, searching, sending, and managing messages and folders securely.
      1
      MIT