Claude-Read-Outlook-Attachments
This server enables Claude Desktop to authenticate with Microsoft 365 and read Outlook emails along with their attachment contents via the Microsoft Graph API.
Health Check (
health_check): Verify the server is running and check the current authentication state.Start Authentication (
begin_auth): Initiate a Microsoft 365 device-code login flow.Check Auth Status (
auth_status): Confirm whether the login process has completed successfully.List Recent Emails (
list_recent_messages): Retrieve recent Outlook emails from a specified folder (default: Inbox), with options to filter by sender, subject, limit results (1–50), and show only emails with attachments.List Attachments (
list_email_attachments): List all attachments for a specific email by its message ID.Read Attachment Content (
read_email_attachment): Download and parse attachment content, supporting:Documents: PDF (with OCR for scanned), DOCX, DOC, MSG, PPTX/PPT and variants
Spreadsheets: XLSX, XLS, CSV (all sheets converted to CSV)
Images: JPG, PNG, GIF, WEBP, BMP, TIFF (returned as image blocks for visual analysis)
Archives: ZIP, RAR, 7Z (with recursive content parsing)
Text/Code: TXT, MD, JSON, XML, HTML
Uses Cloudflare Tunnel to expose the local MCP server to the internet, allowing Claude to connect to the server via a public URL for remote access during testing and development.
M365 Attachment Reader MCP Local
A local stdio MCP server for Claude Desktop that reads Outlook emails and its attachments through the Microsoft Graph API.
Status: Functional for personal single-user local use with Claude Desktop.
Why This Exists
Claude's built-in Microsoft 365 connector can list emails, read message bodies, and check calendars. But it cannot read the actual content inside email attachments.
That means when you say "What does the PDF in my latest email say?", Claude can see the attachment metadata, but not the text, tables, images, or nested documents inside it.
This project fills that gap — running entirely on your local machine over stdio, with no public endpoints or tunnels required.
Recognition / Distribution
Listed in
punkpeye/awesome-mcp-servers, a major community-curated registry of MCP servers.Indexed by Glama with an MCP server score badge.
What It Does
This server runs as a local MCP process started by Claude Desktop. It:
Authenticates with Microsoft 365 via device code flow
Lists Outlook emails and their attachments through Microsoft Graph
Downloads and parses attachment contents locally
Returns structured text and image blocks directly to Claude Desktop
Supported Formats
Format | What Gets Extracted |
Full text content | |
Scanned PDF | OCR text, plus optional rendered page images |
DOCX | Text and embedded images |
DOC | Text content |
PPTX / PPTM / PPSX / POTX | Slide text, notes, and embedded images |
PPT | Best-effort legacy text extraction |
XLSX / XLS / CSV | All sheets converted to CSV |
JPG / JPEG / PNG / GIF / WEBP / BMP / TIFF | Returned as MCP image blocks for visual analysis |
ZIP / RAR / 7Z | Archive contents recursively parsed file by file |
MSG | Subject, sender, body, and embedded attachments |
TXT / MD / JSON / XML / HTML | Raw text |
Outlook | Text content |
MCP Tools
Tool | Description |
| Check if the server is alive |
| Start device code login flow |
| Check authentication status |
| List recent Outlook emails |
| List attachments for a specific email |
| Download, parse, and return attachment content |
Real-World Use Cases
Retail / Sales Operations
"Pull the last 5 Daily Dashboard emails, read the Excel attachments, and analyze the sales trend across all store locations over the past week."
Finance / Accounting
"Find the latest email from our vendor with 'Invoice' in the subject, read the PDF attachment, and extract the total amount, due date, and line items."
Legal / Contract Review
"Open the most recent email from legal@partner.com, read the Word or PowerPoint attachment, and summarize the key terms."
HR / Recruiting
"Find emails from recruiting@company.com with attachments, read each resume PDF, and create a comparison table of candidates."
Prerequisites
Windows 10/11, macOS, or Linux
Claude Desktop
A Microsoft 365 / Outlook account
A Microsoft Entra app registration (see Step 1 below)
Setup
1. Create a Microsoft Entra App Registration
Go to Microsoft Entra admin center → App registrations → New registration.
Name: anything you like, e.g.
m365-mcp-localSupported account types: Accounts in any organizational directory and personal Microsoft accounts
Then:
Copy the Application (client) ID from the Overview page
Go to Authentication → enable Allow public client flows → Save
Go to API permissions → Add a permission → Microsoft Graph → Delegated permissions → add
User.ReadandMail.Read→ Grant admin consentGo to Manifest → find
requestedAccessTokenVersion(it may be nested insideapi) → set it to2→ Save
Why step 4? When your app supports personal Microsoft accounts, Microsoft Entra requires access tokens to be v2. The portal doesn't always set this automatically, and the
commonendpoint will fail withAADSTS50059if the token version is stillnullor1. If you skip this step you will getinvalid_granterrors duringbegin_auth.
Using v1 API integrations? Only set this to
2if all your Graph/API permissions support v2 tokens (all Microsoft Graph delegated permissions do). If you're integrating custom APIs that only accept v1 tokens, useM365_TENANT_ID=consumers(personal accounts only) or a specific tenant ID instead ofcommon, and leaverequestedAccessTokenVersionat its default.
2. Clone and Install
git clone https://github.com/Zacccck/Claude-MCP-Read-Email-Attachments.git
cd Claude-MCP-Read-Email-Attachments
npm install3. Configure Environment Variables
Copy the example file:
cp .env.example .envEdit .env and fill in your client ID:
M365_CLIENT_ID=your-application-client-id-here
M365_TENANT_ID=common
M365_AUTO_OPEN_BROWSER=trueVariable reference:
Variable | Required | Description |
| ✅ Yes | Your Entra app's Application (client) ID |
| No | Default |
| No | Set |
| No | Custom path for auth cache; auto-detected if omitted |
4. Find Your Node.js Path
You'll need the full path to node.exe (Windows) or node (macOS/Linux) in the next step.
# Windows
where.exe node
# macOS / Linux
which nodeExample output: C:\Program Files\nodejs\node.exe
5. Open Claude Desktop's Config File
Locate and open the config file for your platform:
Platform | Path |
Windows (standard) |
|
Windows (Store) |
|
macOS |
|
If the file does not exist yet, create it.
6. Add the Server to Claude Desktop
Add the following entry to claude_desktop_config.json:
{
"mcpServers": {
"m365-attachment-reader-local": {
"command": "C:\\Program Files\\nodejs\\node.exe",
"args": [
"C:\\path\\to\\Claude-MCP-Read-Email-Attachments\\server.mjs"
],
"env": {
"M365_CLIENT_ID": "your-client-id",
"M365_TENANT_ID": "common",
"M365_AUTO_OPEN_BROWSER": "true"
}
}
}
}Tips:
Use the full absolute path from Step 4 for
command.Replace
args[0]with the actual path toserver.mjson your machine.If you already have other MCP servers in the config, merge this entry into the existing
mcpServersobject — do not overwrite the whole file.
7. Restart Claude Desktop
Completely quit Claude Desktop and reopen it. Claude Desktop starts the MCP server automatically — you do not need to run node server.mjs manually.
8. Authenticate with Microsoft 365
In Claude Desktop, type:
Please call begin_authA browser window will open (or you'll receive a login URL + device code). Complete the Microsoft login flow, then verify:
Please call auth_statusYou should see your Microsoft account listed as authenticated.
9. Verify It Works
Run a quick health check:
Please call health_checkThen try a real request:
Show me my recent Outlook emails with attachmentsSummarize the contents of the attachments from the latest emailSuggested Claude Prompts
Please call begin_authPlease call auth_statusShow me my recent Outlook emails with attachmentsSummarize the contents of the attachments from the emailFind the latest invoice email and extract the total amount, due date, and line items from the PDF attachmentTroubleshooting
Problem | Solution |
Claude cannot find MCP tools | Restart Claude Desktop completely. Check that |
| Almost always a token-version or account-type mismatch on the Entra app. See the next two rows. |
| Your app does not support the |
| Open the Entra app → Manifest → set |
Device code not showing | Make sure |
Want to switch Microsoft accounts | Restart Claude Desktop and call |
Debug log location |
|
Manual Development Run
For debugging outside Claude Desktop, start the server manually:
cd Claude-MCP-Read-Email-Attachments
node .\server.mjsNote: Do not type into that terminal. It is a
stdioMCP process and expects an MCP client on standard input/output.
Docker
A Dockerfile is included for containerized testing:
docker build -t m365-attachment-reader-mcp-local .
docker run --rm -i `
-e M365_CLIENT_ID=your-client-id `
-e M365_TENANT_ID=common `
-e M365_AUTO_OPEN_BROWSER=false `
m365-attachment-reader-mcp-localThe container still runs as a
stdioserver. For everyday Claude Desktop use, the directnodeapproach in Step 6 is simpler.
Project Structure
Claude-MCP-Read-Email-Attachments/
├── server.mjs
├── package.json
├── manifest.json
├── server.json
├── glama.json
├── Dockerfile
├── .env.example
├── .gitignore
├── LICENSE
└── README.mdLimitations
Single-user only — one server instance supports one Microsoft account at a time
Auth state is in-memory — restarting the server requires re-authenticating
You must create your own Entra app and supply your own client ID
Very large images may be downscaled or skipped to stay within Claude Desktop payload limits
Legacy
.xlsparsing is best-effort and less reliable than.xlsxNot suitable for public or multi-user hosting
License
MIT
Latest Blog Posts
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/Zacccck/Claude-MCP-Read-Email-Attachments'
If you have feedback or need assistance with the MCP directory API, please join our Discord server