M

Microsoft365 MCP Server

by sapientsai · io.github.sapientsai/microsoft365-mcp-server

An MCP server that lets an AI assistant work in a user's Microsoft 365: mail, calendar, contacts, OneDrive and SharePoint files, Teams chats and channels, Planner, OneNote and To Do, all through Microsoft Graph. It signs in as the user (delegated OAuth), so it reaches only what that user can already reach. Run it locally over stdio, or host it as a remote server with per-user sign-in.

npm Local · stdio GlamaOfficial MCP Registry High confidence

Install

Add to ~/Library/Application Support/Claude/claude_desktop_config.json

Windows / Linux path
Windows: %APPDATA%\Claude\claude_desktop_config.json
Linux: ~/.config/Claude/claude_desktop_config.json
{
  "mcpServers": {
    "io-github-sapientsai-microsoft365-mcp-server": {
      "command": "npx",
      "args": [
        "-y",
        "microsoft365-mcp-server"
      ],
      "env": {
        "MS365_CLIENT_ID": "<VALUE>",
        "MS365_TENANT_ID": "<VALUE>",
        "MS365_CLIENT_SECRET": "<YOUR_VALUE>",
        "MS365_CERT_PATH": "<VALUE>",
        "MS365_CERT_PASSWORD": "<YOUR_VALUE>",
        "MS365_ACCESS_TOKEN": "<YOUR_VALUE>",
        "MS365_AUTH_MODE": "interactive",
        "MS365_OAUTH_BASE_URL": "<VALUE>",
        "MS365_READ_ONLY": "false",
        "MS365_ENABLED_TOOLS": "<VALUE>",
        "MS365_PRESETS": "<VALUE>",
        "MS365_ORG_MODE": "false",
        "TRANSPORT_TYPE": "<VALUE>",
        "MS365_REQUIRE_DRAFT": "false",
        "MS365_USE_DEVICE_CODE": "false",
        "MS365_ALLOWED_MAILBOXES": "<VALUE>"
      }
    }
  }
}

Restart Claude Desktop to activate the new server.

Add to .cursor/mcp.json (project) or ~/.cursor/mcp.json (global)

Windows / Linux path
Windows: .cursor\mcp.json (project) or %USERPROFILE%\.cursor\mcp.json (global)
Linux: .cursor/mcp.json (project) or ~/.cursor/mcp.json (global)
{
  "mcpServers": {
    "io-github-sapientsai-microsoft365-mcp-server": {
      "command": "npx",
      "args": [
        "-y",
        "microsoft365-mcp-server"
      ],
      "env": {
        "MS365_CLIENT_ID": "<VALUE>",
        "MS365_TENANT_ID": "<VALUE>",
        "MS365_CLIENT_SECRET": "<YOUR_VALUE>",
        "MS365_CERT_PATH": "<VALUE>",
        "MS365_CERT_PASSWORD": "<YOUR_VALUE>",
        "MS365_ACCESS_TOKEN": "<YOUR_VALUE>",
        "MS365_AUTH_MODE": "interactive",
        "MS365_OAUTH_BASE_URL": "<VALUE>",
        "MS365_READ_ONLY": "false",
        "MS365_ENABLED_TOOLS": "<VALUE>",
        "MS365_PRESETS": "<VALUE>",
        "MS365_ORG_MODE": "false",
        "TRANSPORT_TYPE": "<VALUE>",
        "MS365_REQUIRE_DRAFT": "false",
        "MS365_USE_DEVICE_CODE": "false",
        "MS365_ALLOWED_MAILBOXES": "<VALUE>"
      }
    }
  }
}

Cursor usually picks up config changes automatically; if the server does not appear, reload the window.

Add to .mcp.json (project) or ~/.claude.json (global)

Windows / Linux path
Windows: .mcp.json (project) or %USERPROFILE%\.claude.json (global)
Linux: .mcp.json (project) or ~/.claude.json (global)
{
  "mcpServers": {
    "io-github-sapientsai-microsoft365-mcp-server": {
      "command": "npx",
      "args": [
        "-y",
        "microsoft365-mcp-server"
      ],
      "env": {
        "MS365_CLIENT_ID": "<VALUE>",
        "MS365_TENANT_ID": "<VALUE>",
        "MS365_CLIENT_SECRET": "<YOUR_VALUE>",
        "MS365_CERT_PATH": "<VALUE>",
        "MS365_CERT_PASSWORD": "<YOUR_VALUE>",
        "MS365_ACCESS_TOKEN": "<YOUR_VALUE>",
        "MS365_AUTH_MODE": "interactive",
        "MS365_OAUTH_BASE_URL": "<VALUE>",
        "MS365_READ_ONLY": "false",
        "MS365_ENABLED_TOOLS": "<VALUE>",
        "MS365_PRESETS": "<VALUE>",
        "MS365_ORG_MODE": "false",
        "TRANSPORT_TYPE": "<VALUE>",
        "MS365_REQUIRE_DRAFT": "false",
        "MS365_USE_DEVICE_CODE": "false",
        "MS365_ALLOWED_MAILBOXES": "<VALUE>"
      }
    }
  }
}

The server will be available in the next Claude Code session.

Add to .vscode/mcp.json

Windows / Linux path
Windows: .vscode\mcp.json
Linux: .vscode/mcp.json
{
  "servers": {
    "io-github-sapientsai-microsoft365-mcp-server": {
      "command": "npx",
      "args": [
        "-y",
        "microsoft365-mcp-server"
      ],
      "env": {
        "MS365_CLIENT_ID": "<VALUE>",
        "MS365_TENANT_ID": "<VALUE>",
        "MS365_CLIENT_SECRET": "<YOUR_VALUE>",
        "MS365_CERT_PATH": "<VALUE>",
        "MS365_CERT_PASSWORD": "<YOUR_VALUE>",
        "MS365_ACCESS_TOKEN": "<YOUR_VALUE>",
        "MS365_AUTH_MODE": "interactive",
        "MS365_OAUTH_BASE_URL": "<VALUE>",
        "MS365_READ_ONLY": "false",
        "MS365_ENABLED_TOOLS": "<VALUE>",
        "MS365_PRESETS": "<VALUE>",
        "MS365_ORG_MODE": "false",
        "TRANSPORT_TYPE": "<VALUE>",
        "MS365_REQUIRE_DRAFT": "false",
        "MS365_USE_DEVICE_CODE": "false",
        "MS365_ALLOWED_MAILBOXES": "<VALUE>"
      }
    }
  }
}

Reload the VS Code window to activate.

Add to ~/.codeium/windsurf/mcp_config.json

Windows / Linux path
Windows: %USERPROFILE%\.codeium\windsurf\mcp_config.json
Linux: ~/.codeium/windsurf/mcp_config.json
{
  "mcpServers": {
    "io-github-sapientsai-microsoft365-mcp-server": {
      "command": "npx",
      "args": [
        "-y",
        "microsoft365-mcp-server"
      ],
      "env": {
        "MS365_CLIENT_ID": "<VALUE>",
        "MS365_TENANT_ID": "<VALUE>",
        "MS365_CLIENT_SECRET": "<YOUR_VALUE>",
        "MS365_CERT_PATH": "<VALUE>",
        "MS365_CERT_PASSWORD": "<YOUR_VALUE>",
        "MS365_ACCESS_TOKEN": "<YOUR_VALUE>",
        "MS365_AUTH_MODE": "interactive",
        "MS365_OAUTH_BASE_URL": "<VALUE>",
        "MS365_READ_ONLY": "false",
        "MS365_ENABLED_TOOLS": "<VALUE>",
        "MS365_PRESETS": "<VALUE>",
        "MS365_ORG_MODE": "false",
        "TRANSPORT_TYPE": "<VALUE>",
        "MS365_REQUIRE_DRAFT": "false",
        "MS365_USE_DEVICE_CODE": "false",
        "MS365_ALLOWED_MAILBOXES": "<VALUE>"
      }
    }
  }
}

Restart Windsurf (or refresh its MCP servers panel) to activate the new server.

Windsurf Next uses ~/.codeium/windsurf-next/mcp_config.json. Devin Desktop (the Windsurf rebrand) uses ~/.config/devin/mcp_config.json and imports the Windsurf file.

Add to ~/Library/Application Support/Code/User/globalStorage/saoudrizwan.claude-dev/settings/cline_mcp_settings.json

Windows / Linux path
Windows: %APPDATA%\Code\User\globalStorage\saoudrizwan.claude-dev\settings\cline_mcp_settings.json
Linux: ~/.config/Code/User/globalStorage/saoudrizwan.claude-dev/settings/cline_mcp_settings.json
{
  "mcpServers": {
    "io-github-sapientsai-microsoft365-mcp-server": {
      "command": "npx",
      "args": [
        "-y",
        "microsoft365-mcp-server"
      ],
      "env": {
        "MS365_CLIENT_ID": "<VALUE>",
        "MS365_TENANT_ID": "<VALUE>",
        "MS365_CLIENT_SECRET": "<YOUR_VALUE>",
        "MS365_CERT_PATH": "<VALUE>",
        "MS365_CERT_PASSWORD": "<YOUR_VALUE>",
        "MS365_ACCESS_TOKEN": "<YOUR_VALUE>",
        "MS365_AUTH_MODE": "interactive",
        "MS365_OAUTH_BASE_URL": "<VALUE>",
        "MS365_READ_ONLY": "false",
        "MS365_ENABLED_TOOLS": "<VALUE>",
        "MS365_PRESETS": "<VALUE>",
        "MS365_ORG_MODE": "false",
        "TRANSPORT_TYPE": "<VALUE>",
        "MS365_REQUIRE_DRAFT": "false",
        "MS365_USE_DEVICE_CODE": "false",
        "MS365_ALLOWED_MAILBOXES": "<VALUE>"
      }
    }
  }
}

Cline reloads cline_mcp_settings.json automatically; if the server does not appear, reload the VS Code window.

Open it from Cline's MCP Servers panel → Configure. Roo Code uses a different file and format.

Configuration

Environment variables this server reads. Secrets stay on your machine.

NameRequiredDescription
MS365_CLIENT_ID Yes The application (client) ID of the Microsoft Entra ID app registration.
MS365_TENANT_ID No The Microsoft Entra tenant ID. Use common for multi-tenant/personal accounts, or a tenant ID to lock sign-in to one organization.
MS365_CLIENT_SECRET secret No The client secret used for oauth-proxy hosting or client-secret automation.
MS365_CERT_PATH No Path to the certificate used by certificate mode.
MS365_CERT_PASSWORD secret No Password for the certificate at MS365_CERT_PATH, if it has one.
MS365_ACCESS_TOKEN secret No A Graph access token supplied directly (client-token mode).
MS365_AUTH_MODE No The sign-in mode: interactive, oauth-proxy, client-token, client-secret, or certificate. Default: interactive
MS365_OAUTH_BASE_URL No The public base URL for oauth-proxy mode; required when hosting remotely with MS365_CLIENT_ID and MS365_CLIENT_SECRET.
MS365_READ_ONLY No Set to true to hide every tool that writes. Default: false
MS365_ENABLED_TOOLS No Load only the tools whose names match this regex.
MS365_PRESETS No Load only selected areas: personal, collaboration, productivity, rag, or all.
MS365_ORG_MODE No Set to true to expose the tools that need a work or school tenant. Default: false
TRANSPORT_TYPE No Transport: 'stdio' (the default, and what this npm package is listed as) or 'httpStream' for remote/Docker deployments.
MS365_REQUIRE_DRAFT No Set to true to remove direct email sending; the assistant can only create drafts for review or approval with send_draft. Default: false
MS365_USE_DEVICE_CODE No Set to true on a headless machine to use device-code sign-in instead of opening a browser. Default: false
MS365_ALLOWED_MAILBOXES No Limit which other people's or shared mailboxes the server may open.

Similar servers