Get the FREE Ultimate OpenClaw Setup Guide →

office-365

A Model Context Protocol (MCP) server for Microsoft 365 integration. Provides 24 consolidated tools for email, calendar, Teams, planner, and notifications through the Microsoft Graph API.

Installation
Run this command in your terminal to add the MCP server to Claude Code.
Run in terminal:
Command
claude mcp add --transport stdio hvkshetry-office-365-mcp-server node server.js \
  --env HTTP_HOST="127.0.0.1" \
  --env HTTP_PORT="3333" \
  --env USE_TEST_MODE="false" \
  --env TRANSPORT_TYPE="stdio" \
  --env OFFICE_CLIENT_ID="your-azure-app-client-id" \
  --env OFFICE_TENANT_ID="common" \
  --env ONEDRIVE_SYNC_PATH="/path/to/your/onedrive/sync" \
  --env OFFICE_REDIRECT_URI="http://localhost:3000/auth/callback" \
  --env OFFICE_CLIENT_SECRET="your-azure-app-client-secret" \
  --env SHAREPOINT_SYNC_PATH="/path/to/your/sharepoint/sync" \
  --env TEMP_ATTACHMENTS_PATH="/path/to/temp/attachments" \
  --env SHAREPOINT_SYMLINK_PATH="/path/to/sharepoint/symlink"

How to use

This MCP server provides a comprehensive integration with Microsoft 365 services via the Microsoft Graph API. It exposes each Microsoft 365 domain (mail, calendar, teams, files, contacts, planner, todo, groups, directory, etc.) as individual tools that can be invoked with operation-based routing to minimize large context usage for LLMs. After initial authentication, the server runs in headless mode with automatic token refresh and silent background operation. Use the built-in authentication flow to register an Azure app and authorize access, and then leverage the consolidated tools to perform tasks such as listing emails, reading calendar events, managing OneDrive/SharePoint files, handling Teams meetings, and more. Claude Desktop can connect to these tools to perform actions within your Microsoft 365 tenant. The server includes centralized error handling and actionable hints when Graph API errors occur, as well as support for shared mailboxes and advanced search capabilities.

How to install

Prerequisites:

  • Node.js 16 or higher
  • npm (comes with Node.js)
  • An Azure App Registration with the required Graph permissions as listed in the README
  • Access to a working Microsoft 365 account

Installation steps:

  1. Clone the repository
git clone https://github.com/yourusername/office-mcp.git
cd office-mcp
  1. Install dependencies
npm install
  1. Copy the environment template and configure
cp .env.example .env
  1. Edit the .env file (or rely on the provided MCP config) to include:
  • OFFICE_CLIENT_ID
  • OFFICE_CLIENT_SECRET
  • OFFICE_TENANT_ID
  • OFFICE_REDIRECT_URI
  • SHAREPOINT_SYNC_PATH
  • ONEDRIVE_SYNC_PATH
  • TEMP_ATTACHMENTS_PATH
  • SHAREPOINT_SYMLINK_PATH
  • USE_TEST_MODE
  • TRANSPORT_TYPE
  • HTTP_PORT
  • HTTP_HOST
  1. Run initial authentication (server will guide you to authenticate via browser)
npm run auth-server
# Visit http://localhost:3000/auth and sign in
  1. Start the MCP server
npm start

If you prefer running via the MCP config directly, ensure the node entry (e.g., server.js) points correctly and run with the embedded environment variables.

Additional notes

Tips and notes:

  • Ensure the Azure app registration has all required permissions listed in the README and that admin consent has been granted where needed.
  • For headless operation, make sure the redirect URI is reachable during initial authentication and that token storage is accessible by the server.
  • If you encounter token expiration, rely on the automatic token refresh and verify that the token storage path has proper write permissions.
  • Configure SHARPOINT and OneDrive sync paths to valid local directories; permissions issues here are common sources of startup errors.
  • The HTTP_PORT and HTTP_HOST can be adjusted for different deployment environments; firewalls may require open ports.
  • When running on Windows with Task Scheduler, refer to TASK_SCHEDULER_SETUP.md for setup steps to run the server in background without an active browser session.

Related MCP Servers

Sponsor this space

Reach thousands of developers