MCP Microsoft Office
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@MCP Microsoft OfficeWhat do I have on my calendar for tomorrow?"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
MCP Microsoft Office
One MCP server. Multiple users. Real Microsoft 365 traffic on your test tenant.
The Problem
Test tenants sit empty. Static test data does not exercise real workflows. When you need agents that send real emails, schedule real meetings, and collaborate in real Teams channels, mocks and stubs fall short.
What This Solves
This project connects any MCP-compatible AI client to Microsoft 365 through the Graph API. Each agent authenticates as a distinct tenant user and performs real operations against real data.
117 tools across 12 modules: Mail, Calendar, Files, Excel, Word, PowerPoint, Teams, Contacts, To-Do, Groups, People, Search
Multi-user: one server supports your entire team, each with isolated data
Real Graph API calls: every operation hits the actual tenant, not a mock
Secure: tokens encrypted at rest, no credentials stored on third-party servers
Architecture
┌──────────────────┐
│ MCP Client │
│ (Claude, etc.) │
└────────┬─────────┘
│ JSON-RPC (stdin/stdout)
┌────────▼─────────┐
│ MCP Adapter │
│ (runs locally) │
└────────┬─────────┘
│ HTTP + Bearer Token
┌────────▼─────────┐
│ MCP Server │
│ (local or │
│ remote) │
└────────┬─────────┘
│ Microsoft Graph API
┌────────▼─────────┐
│ Microsoft 365 │
│ (your tenant) │
└──────────────────┘Three parts:
MCP Client -- the AI you interact with
MCP Adapter -- a Node.js process that translates MCP protocol to HTTP requests (runs on the same machine as the client)
MCP Server -- handles authentication and calls the Microsoft Graph API (runs locally or on a remote server)
Permissions
The server requires 18 Microsoft Graph delegated permissions. Twelve work without admin consent. Six require a tenant administrator to grant consent.
No Admin Consent Required
Permission | Tools Unlocked |
| Authentication, user profile |
| readMail, readMailDetails, markEmailRead, flagMail, getMailAttachments, addMailAttachment, removeMailAttachment |
| sendMail, replyToMail |
| getEvents, createEvent, updateEvent, cancelEvent, acceptEvent, tentativelyAcceptEvent, declineEvent, getAvailability, findMeetingTimes, getRooms, getCalendars, addAttachment, removeAttachment |
| listFiles, uploadFile, downloadFile, getFileMetadata, getFileContent, setFileContent, updateFileContent, createSharingLink, getSharingLinks, removeSharingPermission, listChannelFiles, uploadFileToChannel, readChannelFile, all Excel workbook tools, all Word/PowerPoint tools |
| listContacts, getContact, createContact, updateContact, deleteContact, searchContacts |
| listTaskLists, getTaskList, createTaskList, updateTaskList, deleteTaskList, listTasks, getTask, createTask, updateTask, deleteTask, completeTask |
| listChats, createChat, getChatMessages, sendChatMessage |
| listTeamChannels, getChannelMessages |
| sendChannelMessage, replyToMessage |
| createTeamChannel |
| createOnlineMeeting, getOnlineMeeting, listOnlineMeetings, getMeetingByJoinUrl |
Requires Admin Consent
Permission | Additional Tools Unlocked |
| Resolve user IDs across Teams, People search |
| findPeople, getRelevantPeople, getPersonById |
| listGroups, getGroup, listGroupMembers, listMyGroups |
| addChannelMember |
| Read channel message history |
| getMeetingTranscripts, getMeetingTranscriptContent |
Without admin consent, you get Mail, Calendar, Files, Excel workbooks, Word documents, PowerPoint presentations, Contacts, To-Do, Chat, and basic Teams channel operations. With admin consent, you add People directory search, Groups, channel member management, and meeting transcripts.
Quick Start
Prerequisites
Node.js 18+ (download)
Claude Desktop (download) or another MCP client
Microsoft 365 account (work, school, or personal)
Step 1: Azure App Registration
Go to Azure Portal > Microsoft Entra ID > App registrations > New registration
Name it
MCP-Microsoft-Office, register with your preferred account typeCopy the Application (client) ID and Directory (tenant) ID
Go to API permissions > Add a permission > Microsoft Graph > Delegated permissions
Add the 18 permissions listed above
If you are a tenant admin, click Grant admin consent
Go to Authentication > Add a platform > Web
Redirect URI:
http://localhost:3000/api/auth/callbackEnable Allow public client flows
Step 2: Clone and Configure
git clone https://github.com/Aanerud/MCP-Microsoft-Office.git
cd MCP-Microsoft-Office
npm installCopy .env.example to .env and fill in your Azure app details:
MICROSOFT_CLIENT_ID=your-client-id
MICROSOFT_TENANT_ID=your-tenant-idStep 3: Start the Server and Authenticate
npm run dev:webOpen http://localhost:3000 in your browser. Click Login with Microsoft, sign in, and grant permissions. Then click Generate MCP Token and copy the token.
Step 4: Configure Claude Desktop
Edit your Claude Desktop config:
macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
Windows: %APPDATA%\Claude\claude_desktop_config.json
Claude Desktop has a practical limit of ~55 tools per MCP server. This project exposes 117 tools, so we split them across three servers that share the same adapter and backend:
{
"mcpServers": {
"microsoft-365": {
"command": "node",
"args": ["/path/to/MCP-Microsoft-Office/mcp-adapter.cjs"],
"env": {
"MCP_SERVER_URL": "http://localhost:3000",
"MCP_BEARER_TOKEN": "paste-your-token-here",
"MCP_MODULES": "search,mail,calendar,files,people,contacts,groups,query"
}
},
"microsoft-365-teams": {
"command": "node",
"args": ["/path/to/MCP-Microsoft-Office/mcp-adapter.cjs"],
"env": {
"MCP_SERVER_URL": "http://localhost:3000",
"MCP_BEARER_TOKEN": "paste-your-token-here",
"MCP_MODULES": "teams,todo"
}
},
"microsoft-365-office": {
"command": "node",
"args": ["/path/to/MCP-Microsoft-Office/mcp-adapter.cjs"],
"env": {
"MCP_SERVER_URL": "http://localhost:3000",
"MCP_BEARER_TOKEN": "paste-your-token-here",
"MCP_MODULES": "excel,word,powerpoint,files"
}
}
}
}MCP_MODULES filters which modules the adapter exposes. Omit it to expose all 117 tools (works with clients that have no tool cap).
Set MCP_DEBUG=1 in the env block to enable diagnostic logging to stderr — useful for troubleshooting tool dispatch issues.
Restart Claude Desktop. Ask: "What's on my calendar today?" or "Create an Excel workbook with a budget table."
Tools (117)
Mail (9)
Tool | Description |
| Read inbox messages |
| Send an email |
| Reply to an email |
| Get full email content |
| Mark email as read/unread |
| Flag or unflag an email |
| List email attachments |
| Add attachment to email |
| Remove attachment from email |
Calendar (13)
Tool | Description |
| Get calendar events |
| Create a meeting or event |
| Modify an existing event |
| Cancel an event |
| Accept a meeting invitation |
| Tentatively accept |
| Decline a meeting invitation |
| Check free/busy times |
| Find optimal meeting slots |
| Find meeting rooms |
| List all calendars |
| Add attachment to event |
| Remove event attachment |
Files (10)
Tool | Description |
| List OneDrive files |
| Upload a file |
| Download a file |
| Get file info |
| Read file contents |
| Write file contents |
| Update existing file |
| Create a sharing link |
| List sharing links |
| Remove sharing access |
Excel (30)
Work directly with Excel workbooks stored in OneDrive or SharePoint — no file download needed. All operations go through Microsoft Graph's workbook API with transparent session management.
Tool | Description |
| Open a workbook session (persistent or temporary) |
| Close an active workbook session |
| List all worksheets in a workbook |
| Add a new worksheet |
| Get a worksheet by name or ID |
| Rename, reposition, or hide a worksheet |
| Delete a worksheet |
| Read cell values, formulas, and formatting |
| Write values to a cell range |
| Get formatting (font, fill, borders) |
| Set formatting (bold, colors, number formats) |
| Sort cells in a range |
| Merge cells |
| Unmerge cells |
| List all tables in a worksheet |
| Create a table from a range |
| Rename or restyle a table |
| Delete a table |
| List all rows in a table |
| Add a row to a table |
| Delete a row by index |
| List all columns in a table |
| Add a column to a table |
| Delete a column |
| Sort a table by column |
| Apply a filter to a table column |
| Clear a column filter |
| Convert a table back to a plain range |
| Call any of 300+ Excel functions (SUM, VLOOKUP, PMT, etc.) |
| Recalculate all formulas |
Word (5)
Create, read, and convert Word documents. Documents are created from structured JSON and stored in OneDrive. Reading uses a multi-library fallback chain: mammoth (best HTML for .docx) → word-extractor (handles both .doc and .docx) → webUrl fallback. Binary downloads use the Graph beta /contentStream endpoint for reliable binary transfer.
Tool | Description |
| Create a .docx from structured content (headings, paragraphs, tables, lists, images) |
| Read a document as HTML and plain text |
| Get title, author, dates, keywords |
| Convert document content to HTML |
| Convert a Word document to PDF |
Note: Some SharePoint tenants convert uploaded .docx files to OLE2 binary format within seconds of upload. When this happens, client-side parsing libraries cannot read the file. The server gracefully falls back to returning the
webUrlso the user can open the document in the browser.
PowerPoint (4)
Create, read, and convert PowerPoint presentations. Presentations are built from structured slide data and stored in OneDrive. Reading uses Graph HTML conversion with jszip fallback for slide-level text extraction.
Tool | Description |
| Create a .pptx with title, content, and blank slides |
| Read slide content (text elements per slide) |
| Get title, author, slide count, dates |
| Convert a presentation to PDF |
Teams (21)
Tool | Description |
| List Teams chats |
| Create a new chat |
| Read chat messages |
| Send a chat message |
| List your teams |
| List team channels |
| Create a channel |
| Add member to channel |
| Read channel messages |
| Post to a channel |
| Reply to a channel message |
| List files in a channel |
| Upload file to channel |
| Read a channel file |
| Create a Teams meeting |
| Get meeting details |
| List online meetings |
| Find meeting by join URL |
| Get meeting transcripts |
| Read transcript content |
(Note: addChannelMember applies to private channels only. Standard channels auto-include all team members.)
Contacts (6)
Tool | Description |
| List contacts |
| Get contact details |
| Create a contact |
| Update contact info |
| Delete a contact |
| Search contacts |
To-Do (11)
Tool | Description |
| List task lists |
| Get a task list |
| Create a task list |
| Rename a task list |
| Delete a task list |
| List tasks |
| Get task details |
| Create a task |
| Update a task |
| Delete a task |
| Mark task complete |
Groups (4)
Tool | Description |
| List Microsoft 365 groups |
| Get group details |
| List group members |
| List your groups |
People (3)
Tool | Description |
| Search the directory |
| Get frequent contacts |
| Get person details |
Search (1)
Tool | Description |
| Unified search across emails, files, events, and chat messages |
Multi-User
Each user authenticates independently. The server isolates all data by user identity.
Alice (alice@contoso.com) Bob (bob@contoso.com)
├─ Her own Microsoft tokens ├─ His own Microsoft tokens
├─ Her own session ├─ His own session
└─ Claude Desktop (her laptop) └─ Claude Desktop (his PC)
Complete data isolation.
Alice never sees Bob's data.For automated testing with multiple agents, use the ROPC (Resource Owner Password Credentials) flow to authenticate programmatically:
# Start the server
npm run dev:web
# Run the E2E test suite (authenticates 3 users via ROPC)
node tests/run-all.cjsThe test suite authenticates multiple users, then exercises all 117 tools across 12 modules plus 5 cross-module workflows. See tests/ for the full implementation.
E2E Test Suite
The project includes a comprehensive test suite covering all 117 tools.
# Run all tests (requires server running)
node tests/run-all.cjs
# Run a single module
node tests/run-all.cjs --bucket mail --buckets-only
# Run only workflows
node tests/run-all.cjs --workflows-onlyTest structure:
tests/
lib/ Shared auth, HTTP client, reporter
buckets/ One file per module (12 files, 117 tools)
workflows/ Cross-module tests (5 files)
run-all.cjs Master runnerTests authenticate via ROPC (no manual token management) and run in ~100 seconds.
Environment Variables
Copy .env.example to .env and configure:
Variable | Required | Description |
| Yes | Azure App Client ID |
| Yes | Azure Tenant ID |
| No | OAuth callback URL (default: |
| Production | 32-byte encryption key for token storage |
| Production | Secret for signing JWT tokens |
| Production | Comma-separated allowed origins |
| No | Server port (default: |
| No |
|
Deployment
Local (Recommended for Getting Started)
npm install
npm run dev:webAzure App Service
See docs/azure-deployment.md for CI/CD deployment with GitHub Actions.
Security
Encrypted storage: all Microsoft tokens encrypted at rest with AES-256
No client secrets: uses public client flow (PKCE) for desktop authentication
Token isolation: each user's tokens stored separately with different encryption keys
Rate limiting: built-in rate limiting protects against abuse
CORS protection: origin allowlist in production
Session expiry: sessions expire after 24 hours
Production Checklist
Set
NODE_ENV=productionSet
DEVICE_REGISTRY_ENCRYPTION_KEY(32 bytes)Set
JWT_SECRET(strong random string)Set
CORS_ALLOWED_ORIGINSUse HTTPS with a valid certificate
Project Structure
MCP-Microsoft-Office/
├── mcp-adapter.cjs MCP protocol adapter (runs locally with Claude Desktop)
├── src/
│ ├── api/ Express routes and controllers
│ ├── auth/ MSAL authentication (OAuth2, ROPC, token exchange)
│ ├── core/ Services (cache, storage, tools, error handling)
│ ├── graph/ Microsoft Graph API services
│ │ ├── graph-client.cjs HTTP client with retry, binary support, sessions
│ │ ├── files-service.cjs OneDrive file operations
│ │ ├── excel-service.cjs Workbook API (sessions, ranges, tables, functions)
│ │ ├── word-service.cjs Word create/read (docx + mammoth + word-extractor)
│ │ └── powerpoint-service.cjs PPT create/read (pptxgenjs + jszip)
│ └── modules/ Feature modules (mail, calendar, excel, word, powerpoint, etc.)
├── public/ Web UI for authentication
└── tests/ E2E test suite (gitignored)Contributing
Fork the repository
Create a feature branch
Make your changes
Submit a pull request
License
MIT License -- see LICENSE file.
This server cannot be installed
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
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/Aanerud/MCP-Microsoft-Office'
If you have feedback or need assistance with the MCP directory API, please join our Discord server