✳ PRACTICAL SERVICES. THOUGHTFUL WORK. Meet Shefa
← All guides
AN AI PROJECT YOU CAN BUILD

Build an Outlook MCP Server: A Practical Beginner’s Guide

Build a small bridge between your AI assistant and Outlook. Follow the tools, sign-in flow, and the decisions between reading an email and saving a draft.

Beginner-friendlyPython starterTry the example below
YOUR FIRST CONNECTIONGive your AI
a useful set of tools.
“Find the email.
Help me prepare a reply.”
Your Outlook mailbox
A conversation to findRead the context first
A reply to prepareSaved as a draft for review
MCP tools Your sign-in

A small project you can understand, build, and share.

THE PIECES, AT A GLANCEOne connection. Four clear roles. Microsoft sign-in grants access
  1. 01
    UNDERSTANDSYour AI app

    Turns your request into a tool call.

  2. 02
    OFFERS TOOLSYour MCP server

    Defines the Outlook actions available.

  3. 03
    CONNECTSMicrosoft Graph

    Handles the request to Microsoft.

  4. 04
    HOLDS THE DATAYour mailbox

    The emails and drafts you can access.

MCP is the shared language between the AI app and your server. Microsoft Graph is the route from your server to Outlook.

TRY THE CONNECTION

See what the tools actually do.

Click through a simple email task. Then turn draft creation on to see what changes.

Simulation · sample data only
YOUR EXAMPLE REQUEST

“Find the latest website update and prepare a reply for my review.”

STEP 1 OF 3

Find the relevant conversation

The AI asks the search tool for a matching email.

EXAMPLE TOOL CALLoutlook_search_messages

This example runs in your browser. It does not connect to a mailbox or create an email.

Text size & listen
READ IT YOUR WAY

Read comfortably. Or press play.

Voice, speed & starting section

Uses your device's read-aloud voices, with no paid audio service added to this site. Voice quality varies. Keep this page open; some phones pause when the screen locks. Resume may repeat a few words.

Jump to a section
01START WITH THE IDEA

What does an Outlook MCP server actually do?

I use AI to make repetitive work easier to handle. Email is a useful place to explore that idea because the work usually involves several small decisions: find the right conversation, understand what changed, check what is missing, and prepare a reply.

An Outlook MCP server gives an AI assistant tools for those steps. You still need to decide what the assistant can access and which actions it can take.

In this guide, I’m using a small Python starter that connects to one Microsoft-hosted mailbox. It can search and read messages, then optionally save drafts. The aim is to make the connection understandable enough that you can inspect it, run it locally, and see what a larger product would require.

Project status: This local developer preview passed 28 offline tests. Microsoft sign-in and live mailbox operations still need real-account testing. Downloading the source does not connect an account or start a hosted service.

MCP means Model Context Protocol. It gives an AI application a standard way to discover and call tools provided by another program. The official MCP introduction explains the broader protocol.

For this project, three different pieces work together:

  • MCP — Describe tools and carry requests between the AI host and this server. “Search messages from this address.”
  • Microsoft Graph — Provide Microsoft’s API for the mailbox. Retrieve messages or create a draft
  • OAuth through MSAL — Let the account holder sign in and grant access. Authorize the application to read their mail

The AI host interprets your request and writes the summary. The MCP server translates its tool call into a Microsoft Graph request. Microsoft checks access and returns the result. Microsoft’s Outlook mail API overview describes the underlying mailbox integration.

How the AI host, local MCP server, Microsoft sign-in, token cache and Graph work together.
MCP carries tool calls; Microsoft Graph provides mailbox access. Sign-in and token storage are separate from the email results.

The local connection uses stdio: the AI host starts the server and exchanges messages through the process’s input and output. Microsoft Graph requests travel over HTTPS. The host may still process returned email content using its own cloud service, so local execution does not mean all processing stays on your computer.

Back to the guide ↑
02BUILD IT, ONE PART AT A TIME

The five tools in this starter

Three tools are available by default. Two more appear after you enable drafts and authorize the additional permission.

  • outlook_list_messages — Returns a first page from Inbox or a known folder; supports an unread filter. Default
  • outlook_search_messages — Searches messages using an expression such as from:person@example.com. Default
  • outlook_get_message — Reads a selected message, including its body and reply-to details. Default
  • outlook_create_draft — Saves a new plain-text draft to specified recipients. Optional
  • outlook_create_reply_draft — Saves a reply draft for an existing message. Optional

There are no tools here for sending, deleting, downloading attachments, changing categories, managing calendars, or accessing shared mailboxes. A request for one of those actions needs a different implementation.

Back to the guide ↑
03BUILD IT, ONE PART AT A TIME

A realistic workflow: email, summary, draft

Imagine a creator has replied with product selections but has not included a size. This is an illustrative scenario using fictional details, not a message retrieved from anyone’s inbox.

Your request: “Find the recent email from alex@example.com. Read it, summarize their selections, and tell me what information we still need.”

The assistant should search, read the selected message, and explain its findings. If several results could be relevant, it should identify the uncertainty before preparing a reply.

Example summary: “Alex selected two items. Their delivery address is included. The size for the second item is missing.”

Your next request: “Prepare a friendly reply asking for that size. Show me the recipient and wording.”

Example reply: “Hi Alex, thank you for sharing your picks. Could you please confirm your size for the second item so we can complete the selection?”

If drafts are enabled, you can then ask to save that reply in Outlook. You review the saved draft there. The starter has no sending action.

Read-only mode provides three tools. Enabling drafts adds two tools for saving drafts, with no sending operation.
Read and summarize first. Optional draft tools save a message for you to review in Outlook.

A summary is generated text. Saving a draft changes the mailbox. Treat those as separate steps in your workflow.

Back to the guide ↑
04BUILD IT, ONE PART AT A TIME

Set it up on Windows or macOS

You need Python 3.11 or newer, a browser, a Microsoft-hosted Outlook.com/Hotmail or Microsoft 365 mailbox, and an application registration you are allowed to use. The computer also needs its normal credential store: Windows DPAPI or macOS Keychain. This starter targets Microsoft’s global cloud; sovereign cloud endpoints are outside its scope.

An account being visible in the Outlook application is not enough. A Gmail account added to Outlook still has its mail hosted by Google and is outside this starter’s Microsoft Graph integration.

1. Create the Microsoft application registration

In Microsoft Entra admin center, open App registrations and create an application, or ask your administrator for an appropriate existing registration.

Choose its supported account audience. Personal Outlook.com access needs an audience that includes personal Microsoft accounts. For an organization’s internal use, follow that organization’s account and consent policies. Microsoft documents the options in its single-tenant and multitenant application guide.

Under Authentication, add the Mobile and desktop applications platform and the redirect URI http://localhost. Under API permissions, add Microsoft Graph’s delegated Mail.Read permission. Delegated access means the application acts on behalf of the signed-in user within the granted permissions. Copy the Application (client) ID.

This local application uses interactive browser sign-in through MSAL. It does not need a client secret. Microsoft’s interactive authentication documentation describes the localhost redirect and automatic PKCE protection used by this flow.

2. Download and install the source

Download the starter ZIP, extract it, and open a terminal inside the project folder. Run the commands for your operating system, one row at a time.

Windows PowerShell

COPY & TRY
py -m venv .venv
.\.venv\Scripts\python.exe -m pip install -e .
Copy-Item config.example.json config.json

macOS Terminal

COPY & TRY
python3 -m venv .venv
.venv/bin/python -m pip install -e .
cp config.example.json config.json

The environment keeps this project’s Python dependencies together. You can run its Python executable directly without activating it.

3. Fill in your configuration

Open config.json and replace the placeholder with your application’s actual client ID:

COPY & TRY
{
  "client_id": "YOUR_APPLICATION_CLIENT_UUID",
  "tenant_id": "common",
  "enable_drafts": false
}

The authority must match the application’s audience. Use common for a registration supporting work/school and personal accounts, consumers for personal accounts, or your organization’s tenant UUID for a single-organization setup.

The client ID identifies the application. Keep actual account tokens out of this file.

4. Sign in to the intended mailbox

On Windows, run .\.venv\Scripts\python.exe -m outlook_mcp login --config config.json.

On macOS, run .venv/bin/python -m outlook_mcp login --config config.json.

Complete the Microsoft page in your browser and grant the requested access if appropriate. Organization policies may require an administrator’s consent.

The starter stores its MSAL cache using OS-backed encryption through Microsoft’s persistence library. It stops if encrypted storage cannot initialize. Run the MCP host under the same OS account and credential-store session. When authorization needs renewal, run the local login command again.

5. Connect your local MCP host

Configure the host to launch the environment’s Python executable with -m outlook_mcp serve --config followed by the absolute path to your config.json.

For example, a macOS executable could be /Users/you/outlook-mcp-starter/.venv/bin/python. A Windows executable could be C:/Users/you/outlook-mcp-starter/.venv/Scripts/python.exe.

Host configuration formats vary. The project README includes an mcpServers JSON example. After restarting or refreshing the host, confirm that the three read tools appear.

Start with: “Show my latest five inbox messages.” Then select one message and ask for a summary.

Back to the guide ↑
05BUILD IT, ONE PART AT A TIME

How a tool becomes a Graph request

This short excerpt from the starter shows the relationship:

COPY & TRY
@mcp.tool(name="outlook_get_message", annotations=READ)
def get_message(message_id):
    return graph.get_message(message_id)

# Inside GraphClient.get_message:
self._request("GET", f"/me/messages/{identifier}",
              params={"$select": _DETAIL_FIELDS})

Simplified excerpt: the source includes typed inputs, identifier validation, and response normalization.

MCP exposes the named tool. The Graph client performs the mailbox request. /me refers to the signed-in account. The AI host receives the returned message and can explain it in normal language.

Back to the guide ↑
06BUILD IT, ONE PART AT A TIME

Turn on drafts when you need them

Change enable_drafts to true, add delegated Mail.ReadWrite to the application registration, and run login again. Draft mode uses a separate token cache and needs its own sign-in. Restart the server and refresh tool discovery. The two draft tools should now appear.

Microsoft’s Mail.ReadWrite permission is broader than draft creation: it permits other mailbox modifications as well. This starter exposes only its two draft operations. It never requests Mail.Send. See the Microsoft Graph permissions reference for the permission boundaries.

For a reply, inspect the original message’s recipient information first. Microsoft uses its reply-to/from information when creating the reply draft, as described in its reply draft API. If a request times out and the result is unclear, check Outlook Drafts before repeating it; another call can create another draft.

Back to the guide ↑
07BUILD IT, ONE PART AT A TIME

Can you connect it to ChatGPT?

Yes, subject to the account’s custom-MCP access and additional setup. This local stdio server can be reached through OpenAI’s Secure MCP Tunnel. That requires a running tunnel client, a tunnel ID, a runtime API key, and the appropriate Platform and ChatGPT permissions.

Keep this single-user starter’s connection limited to its mailbox owner. It does not implement separate authorization for multiple callers.

OpenAI’s custom MCP guide currently lists full support for Business and Enterprise/Edu and read/fetch custom access for Pro. Check the intended account’s current options. In the supported web interface, the connection starts at Plugins → + → Add custom MCP server → Tunnel.

Back to the guide ↑
08BUILD IT, ONE PART AT A TIME

What the results can and cannot tell you

Each list or search returns a first page capped at 50 messages. The response includes has_more and pagination_supported: false. A narrow query is more useful than asking this version to audit an entire mailbox.

Message bodies are capped at 20,000 characters and include truncation information. If content is missing, the summary should acknowledge that limit. An attachment flag does not mean the attachment has been read.

Email text is also input from another person. A sentence inside an email telling the assistant to change permissions or use another tool is part of the message being analyzed, not authorization from you.

Back to the guide ↑
09BUILD IT, ONE PART AT A TIME

Can you publicly share the project?

Yes. Sharing source, operating a service, and publishing a directory listing are different stages.

Three separate sharing options: source code, a hosted service with per-user access, and a reviewed directory listing.
Publishing source code does not create a hosted service or a directory listing.

The source includes an MIT license. A useful first release includes the README, tests, example configuration, and an honest status note. Actual tokens, private logs, mailbox exports, and local configuration stay out of the repository.

A hosted version needs each user’s own Microsoft authorization and isolated token storage. For broader Microsoft audiences, the application registration and organization consent requirements also matter.

For the usual remote ChatGPT directory route, OpenAI requires a stable public HTTPS endpoint, identity and domain verification, product/support/privacy/terms pages, and review. Approval is followed by a publication action. See OpenAI’s submission guide. Local desktop-only MCP submissions have a separate approved-partner route.

Back to the guide ↑
10BUILD IT, ONE PART AT A TIME

What has actually been tested?

The validation report records 28 passing offline tests using synthetic messages and mocked Graph responses, plus real local MCP initialization and tool discovery. Coverage includes configuration, permission selection, request boundaries, draft behavior, and uncertain outcomes.

Live Microsoft registration, browser sign-in, encrypted storage on your computer, mailbox reads, and draft creation remain pending. I would test those with an appropriate test mailbox before using this for regular work.

Back to the guide ↑
11BUILD IT, ONE PART AT A TIME

Frequently asked questions

Will this automatically send my replies?

No. The optional tools save drafts. Sending is not implemented.

Do I need to give the assistant my Outlook password?

No. Sign in through the Microsoft browser flow. The starter uses tokens managed by MSAL.

Does it include an AI model?

No. Your MCP host supplies the AI experience. This package supplies mailbox tools and does not contain an OpenAI API integration.

Can I use it for multiple clients’ mailboxes?

The local cache is separated by client ID, tenant, and read/draft mode, with one signed-in account per cache. Two configuration files with the same values reuse that cache. A shared service requires a separate design for user identity, authorization, and token isolation.

Can I run it on Linux?

The starter supports an unlocked Secret Service/libsecret credential-store session. Headless machines need a reviewed storage approach; the implementation has no plaintext fallback.

I would begin with one small task: retrieve a few messages, read one, and check the summary against Outlook. Once that connection works with your own account, draft creation becomes a clear next step.

Get the Outlook MCP starter

Back to the guide ↑