
Microsoft Office 桥接器
STDIO连接LLM与Microsoft 365的MCP桥接器
连接LLM与Microsoft 365的MCP桥接器
A production-ready bridge connecting LLMs to Microsoft 365 via the Model Context Protocol (MCP)
This project is a comprehensive MCP server that enables Claude (and other LLM clients) to seamlessly interact with your Microsoft 365 data - emails, calendar events, files, and contacts - through natural language. Built as a Windsurf Vibe Code project, it demonstrates enterprise-grade architecture with proper authentication, error handling, and modular design.
Simply put: We are a bridge between Microsoft Graph API and MCP-compatible LLMs, handling authentication, data normalization, and tool orchestration so Claude can work with your Microsoft 365 data as naturally as it works with text.
Claude/LLM ←→ MCP Adapter ←→ Express API ←→ Graph Services ←→ Microsoft 365
getMail
- Read emails from inboxsendMail
- Send emails with attachmentssearchMail
- Search emails by queryflagMail
- Flag/unflag emailsaddMailAttachment
- Add attachments to emailsremoveMailAttachment
- Remove email attachmentsgetCalendar
- View calendar eventscreateEvent
- Create new eventsupdateEvent
- Modify existing eventsdeleteEvent
- Cancel eventsacceptEvent
- Accept meeting invitationsdeclineEvent
- Decline meeting invitationstentativelyAcceptEvent
- Tentatively accept invitationsaddAttachment
- Add files to calendar eventsremoveAttachment
- Remove event attachmentsgetAvailability
- Check free/busy timesfindMeetingTimes
- Find optimal meeting slotsscheduleMeeting
- Smart meeting schedulinglistFiles
- Browse OneDrive/SharePointuploadFile
- Upload files to cloud storagedownloadFile
- Download file contentgetFileMetadata
- Get file informationshareFile
- Share files with permissionsfindPeople
- Find contacts by name/emailsearchPeople
- Search organization directorygetRelevantPeople
- Get frequently contacted peoplequery
- Natural language queries across all Microsoft 365 datarequired: true
inPath: true
for URL parameters, proper validation schemasClone & Install
git clone https://github.com/Aanerud/MCP-Microsoft-Office.git cd MCP-Microsoft-Office npm install
Azure App Registration
http://localhost:3000/api/auth/callback
User.Read
, Mail.Read
, Mail.Send
, Calendars.ReadWrite
, Files.Read
, People.Read
Environment Setup
# Create .env file MICROSOFT_CLIENT_ID=your_client_id MICROSOFT_TENANT_ID=your_tenant_id LLM_PROVIDER=claude # or openai CLAUDE_API_KEY=your_claude_api_key OPENAI_API_KEY=your_openai_api_key
Start the Server
# Development mode (full logging) npm run dev # Production mode (minimal logging) npm start
Authenticate
http://localhost:3000
Configure Claude Desktop
Edit ~/Library/Application Support/Claude/claude_desktop_config.json
:
{ "mcpServers": { "microsoft365": { "command": "node", "args": ["/absolute/path/to/mcp-adapter.cjs"], "restrictions": {} } } }
Start Using
npm run dev
)src/
├── api/ # Express controllers & routes
├── auth/ # Microsoft OAuth & MSAL
├── core/ # Error handling, logging, tools
├── graph/ # Microsoft Graph API services
├── modules/ # Business logic (mail, calendar, files, people)
├── main/ # Electron main process
└── renderer/ # Electron UI
This is a complete, working MCP server ready for production use. Future enhancements could include:
This project demonstrates enterprise-grade MCP development. Key patterns to follow:
MIT License - Build amazing things with Microsoft 365 and MCP!
Built with as a Windsurf Vibe Code project - demonstrating how to build production-ready MCP servers that bridge LLMs with enterprise APIs.