Skip to main content
Glama

microsoft-outlook-mcp

MCP (Model Context Protocol) server exposing Microsoft 365 surfaces — Outlook email, calendar, and OneDrive — over Microsoft Graph. Supports both personal Microsoft accounts (consumer) and business/school (365) work accounts.

  • Transport: JSON-RPC 2.0 over stdio (streamable-HTTP can be added later)

  • Auth: MSAL public client; device code flow by default (headless), loopback redirect for local development

  • License: MIT — see LICENSE

Requirements

  • Python 3.12+

  • A public-client Microsoft app registration (no client secret) for each mode you intend to use

  • An account: personal Microsoft account, or a work/school account (business)

Related MCP server: Microsoft Graph MCP Server

Install

pip install -e .          # runtime dependencies
pip install -e ".[dev]"   # plus lint/test tooling

Start the server:

microsoft-outlook-mcp

Configuration

One environment variable shape covers both auth modes.

Variable

Required

Default

Meaning

OUTLOOK_MCP_MODE

yes

—

personal or business

OUTLOOK_MCP_PERSONAL_CLIENT_ID

in personal mode

—

app registration client id

OUTLOOK_MCP_BUSINESS_CLIENT_ID

in business mode

—

app registration client id

OUTLOOK_MCP_BUSINESS_TENANT

no

common

tenant id (business mode only)

OUTLOOK_MCP_CACHE_DIR

no

~/.microsoft-outlook-mcp

token cache directory

OUTLOOK_MCP_AUTH_FLOW

no

device

device or loopback

OUTLOOK_MCP_LOOPBACK_PORT

no

8400

loopback redirect port

Scopes requested in both modes: Mail.ReadWrite, Calendars.ReadWrite, Files.ReadWrite, offline_access.

Authentication

Both modes use the MSAL device code flow by default, which is friendly to headless sidecars:

  1. Start the server and call the authenticate tool.

  2. The device code message (URL + code) is printed to stderr.

  3. On any device, open the URL, enter the code, sign in, and accept the consent prompt.

  4. Tokens are persisted to a per-(mode, client id) cache file with 0600 permissions under OUTLOOK_MCP_CACHE_DIR.

check-auth-status reports whether a cached silent token currently works. authenticate with force: true deletes the cache and re-runs the flow.

Tools

Email (19): about, authenticate, check-auth-status, list-emails, search-emails, read-email, send-email, draft-email, mark-as-read, delete-email, list-folders, create-folder, move-emails, list-rules, create-rule, edit-rule-sequence, list-attachments, read-attachment, download-attachment.

Calendar (7): list-events, create-event, update-event, delete-event, cancel-event, decline-event, check-availability.

OneDrive (8): onedrive-list, onedrive-search, onedrive-download, onedrive-upload, onedrive-upload-large, onedrive-share, onedrive-create-folder, onedrive-delete.

Security

  • Token and refresh tokens are stored on disk as JSON under OUTLOOK_MCP_CACHE_DIR with 0600 permissions. Restrict access to that directory accordingly; encrypted-at-rest caching is a follow-up.

  • All token/credential diagnostics are written to stderr only. The MCP wire is stdout and is never polluted with secrets.

  • read-email strips HTML to visible text by default; raw HTML is only returned when explicitly requested.

Development

Gate for every commit (all must pass):

ruff check .
mypy src
pytest

Tests are unit tests against a mocked Graph client; no live credentials are used anywhere in the test suite.

Available Tools

19 tools
aboutAboutA
Read-only

Returns information about this M365 Assistant server.

Inputs: no named parameters. Returns: result

authenticateAuthenticateC

Authenticate with Microsoft Graph API to access Outlook data.

Inputs: force. Returns: result

check-auth-statusCheck auth statusA
Read-only

Check the current authentication status with Microsoft Graph API.

Inputs: no named parameters. Returns: result

create-folderCreate folderC

Creates a new mail folder

Inputs: name (required), parentFolder. Returns: result

create-ruleCreate ruleC

Creates a new inbox rule

Inputs: name (required), sequence, isEnabled, markAsRead, +4 more. Returns: result

delete-emailDelete emailA

Deletes an email by moving it to Deleted Items (trash). Use permanent=true to hard delete.

Inputs: id (required), permanent. Returns: result

download-attachmentDownload attachmentB

Downloads an email attachment to a local file

Inputs: id (required), outPath (required), attachmentId (required). Returns: result

draft-emailDraft emailB

Creates and saves an email draft in Outlook

Inputs: cc, to, bcc, body, +2 more. Returns: result

edit-rule-sequenceEdit rule sequenceC

Changes the execution order of an existing inbox rule

Inputs: ruleName (required), sequence (required). Returns: result

list-attachmentsList attachmentsB
Read-only

Lists the attachments of a specific email

Inputs: id (required). Returns: result

list-emailsList emailsC
Read-only

Lists recent emails from your inbox

Inputs: count, folder. Returns: result

list-foldersList foldersC
Read-only

Lists mail folders in your Outlook account

Inputs: includeChildren, includeItemCounts. Returns: result

list-rulesList rulesB
Read-only

Lists inbox rules in your Outlook account

Inputs: includeDetails. Returns: result

mark-as-readMark as readC

Marks an email as read or unread

Inputs: id (required), isRead. Returns: result

move-emailsMove emailsC

Moves emails from one folder to another

Inputs: emailIds (required), targetFolder (required), sourceFolder. Returns: result

read-attachmentRead attachmentA
Read-only

Reads an attachment from an email. Text content is returned as text; binary content is returned base64-encoded.

Inputs: id (required), attachmentId (required). Returns: result

read-emailRead emailA
Read-only

Reads the content of a specific email. HTML bodies are sanitized to visible text unless includeRawHtml is true.

Inputs: id (required), includeRawHtml. Returns: result

search-emailsSearch emailsC
Read-only

Search for emails using various criteria

Inputs: query (required), to, from, count, +4 more. Returns: result

send-emailSend emailC

Composes and sends a new email. Supports plain text and HTML.

Inputs: to (required), body (required), subject (required), cc, +4 more. Returns: result

Tool Schema Changelog

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

Loading tool schema changelog…

    TDQS

    B3.2/5.0

    Scored across 19 tools

    Disambiguation4/5

    Most tools target a distinct resource+action (read-email, send-email, draft-email, list-folders, create-folder, mark-as-read), so selection is usually clear. The one genuinely confusable pair is read-attachment vs download-attachment, which both retrieve the same attachment and differ only in output destination; list-attachments vs read-attachment is also close but separable.

    Naming Consistency4/5

    There is a predictable kebab-case verb-noun convention (list-emails, create-rule, delete-email, move-emails) used consistently across the bulk of the surface. Minor deviations are 'about' (no verb/object) and 'authenticate'/'check-auth-status', which don't fit the verb-noun pattern but remain readable.

    Tool Count4/5

    19 tools is on the high side, but the surface spans four sub-domains (auth, mail, folders, rules, attachments) and each tool maps to a real operation rather than a duplicate. A couple of tools (about, download-attachment) are marginal, but none feel gratuitous.

    Completeness3/5

    Core email lifecycle is covered: list/search/read/send/draft/delete/move, plus folders, rules, and attachments. However, reply and forward are missing (agents must compose a fresh email and lose threading), and the rules and folder surfaces are asymmetric — rules can be created and resequenced but not deleted or edited, and folders can be created but not renamed or deleted.

    Related MCP Connectors

    Related MCP Servers