Claude-Read-Outlook-Attachments
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
A remote MCP server for Claude that reads Outlook emails and deeply parses email attachments through the Microsoft Graph API.
Supported attachment handling now includes PDF, scanned PDF with OCR, Word, PowerPoint, Excel, CSV, plain text, images, archives, and Outlook .msg files.
Status: Early Windows-based testing version. Functional for personal use and private workflows, but not yet a production multi-user service.
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.
What It Does
This server sits between Claude and Microsoft 365 as a remote HTTP MCP endpoint. It:
Authenticates with Microsoft 365 via device code flow
Lists Outlook emails and their attachments through Microsoft Graph
Downloads attachments on the backend
Parses file contents and returns structured text and image blocks directly to Claude
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 |
The image handling is a key differentiator: the server can return standalone image attachments as MCP image blocks, extract embedded images from DOCX and PPTX files, and fall back to OCR for scanned PDFs when no text layer exists.
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 |
These short tool names are aliases for the underlying m365_* tools registered by the server.
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."
Executive Reporting
"Read the weekly board report attachment from the latest CFO email and summarize the charts and key metrics."
HR / Recruiting
"Find emails from recruiting@company.com with attachments, read each resume PDF, and create a comparison table of candidates."
Supply Chain / Procurement
"Read the latest supplier quote archive, extract the spreadsheets inside it, and compare unit prices against the previous quote."
Architecture
Claude Chat -> Cloudflare Tunnel -> Local Express Server -> Microsoft Graph API
(public URL) (localhost:8080) (Outlook data)
|
Parse attachments
(pdf-parse, tesseract.js,
mammoth, xlsx, adm-zip,
msgreader, archive tools)For local testing, Cloudflare Quick Tunnel exposes the local server to the internet. Claude connects via a Custom Connector pointed at the tunnel URL.
Prerequisites
Windows 10/11 with PowerShell
Node.js
A Microsoft 365 / Outlook account
A Claude account with Custom Connector support
Setup
1. Create a Microsoft Entra App Registration
Go to Microsoft Entra admin center -> App registrations -> New registration.
Name:
m365-mcp-remoteSupported account types: Accounts in any organizational directory and personal Microsoft accounts
Then:
Copy the Application (client) ID and Directory (tenant) 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 consent
2. Clone and Install
git clone https://github.com/Zacccck/MCP.git
cd MCP
npm install3. Configure Environment
cp .env.example .envEdit .env and fill in your Application client ID:
M365_CLIENT_ID=your-application-client-id-here
M365_TENANT_ID=common4. Start the Server
npm startYou should see:
Custom M365 HTTP MCP server listening at http://127.0.0.1:8080/mcp5. Expose via Cloudflare Tunnel
In a new PowerShell window:
winget install --id Cloudflare.cloudflaredThen run:
cloudflared tunnel --url http://127.0.0.1:8080Copy the generated https://xxxxx.trycloudflare.com URL.
6. Add to Claude as a Custom Connector
In Claude Chat:
Click the
+button near the input areaOpen Connectors -> Add connector -> Custom Connector
Enter URL:
https://xxxxx.trycloudflare.com/mcp
Use https:// and include /mcp at the end. Do not use http://127.0.0.1:8080/mcp.
7. Authenticate
In Claude, say:
Please call begin_authClaude will return a login URL and a device code. Open the URL, enter the code, and complete the Microsoft login. Then verify with:
Please call auth_status8. Use It
Show me my recent outlook emails with attachmentsSummarize the contents of the attachments from the emailImportant Limitations
Single-user: Auth state is stored in memory. One server instance equals one Microsoft account.
Two processes required: Both
node server.mjsandcloudflared tunnelmust stay running during use.Quick Tunnel is for testing only: The Cloudflare URL changes every time you restart
cloudflared.Manual setup required: Azure app registration,
.envconfiguration, and connector setup are still manual.
Troubleshooting
Problem | Solution |
Claude cannot find MCP tools | Check that both the Node server and Cloudflare tunnel are still running. The tunnel URL may have changed after restart. |
| Re-check your app registration: supported account types, allow public client flows enabled, and |
Device code not showing | Make sure |
Want to switch accounts | Stop the Node server, restart with |
Project Structure
MCP/
|-- server.mjs
|-- package.json
|-- .env.example
|-- .gitignore
|-- LICENSE
`-- README.mdRoadmap
Easier first-time setup
Account logout and switching without restart
Windows background service mode
Production deployment guide
Multi-user session architecture
Deeper OCR language coverage and better large-file summarization
Security Notes
This is a local testing and prototype implementation. It is not production-ready for public deployment. Before deploying publicly, you would need authentication in front of /mcp, per-user session isolation, secure token storage, rate limiting, and proper infrastructure.
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