home / mcp / microsoft 365 mcp server

Microsoft 365 MCP Server

Provides programmatic access to Microsoft 365 data and actions via MCP using Graph API across personal and organization clouds.

Installation
Add the following to your MCP client configuration file.

Configuration

View docs
{
  "mcpServers": {
    "softeria-ms-365-mcp-server": {
      "url": "http://localhost:3000/mcp",
      "headers": {
        "READ_ONLY": "true",
        "MS365_MCP_ORG_MODE": "true",
        "MS365_MCP_CLIENT_ID": "00000000-0000-0000-0000-000000000000",
        "MS365_MCP_TENANT_ID": "common",
        "MS365_MCP_CLOUD_TYPE": "global",
        "MS365_MCP_OAUTH_TOKEN": "<token>",
        "MS365_MCP_KEYVAULT_URL": "https://myvault.vault.azure.net",
        "MS365_MCP_OAUTH_SCOPES": "https://graph.microsoft.com/.default",
        "MS365_MCP_CLIENT_SECRET": "<secret>",
        "MS365_MCP_OUTPUT_FORMAT": "toon"
      }
    }
  }
}

You can run a Microsoft 365 MCP Server to access Microsoft Graph data and actions from your applications. It supports multiple clouds, offers both local (stdio) and HTTP-based operation modes, and includes configurable authentication and output formats to fit your use case.

How to use

Use an MCP client to connect to the Microsoft 365 MCP Server and perform operations such as reading emails, managing calendars, accessing OneDrive files, and more. You can operate in personal account mode or organization mode to access work or school resources. The server supports two output formats and can run in local (stdio) mode or HTTP mode for remote access.

To begin, run the server in one of the following ways, then connect your MCP client to the provided endpoints.

How to install

Prerequisites you need before installing and running the MCP server:

    Install and run the server using one of the supported execution methods shown below.

    HTTP mode setup (Open WebUI integration)

    To expose the MCP server over HTTP and enable dynamic client registration for the Open WebUI, start the server with HTTP mode and dynamic registration enabled.

    npx @softeria/ms-365-mcp-server --http --enable-dynamic-registration

    Connect the HTTP endpoint from your MCP client using the URL you configure, typically including the /mcp path. When integrating with Open WebUI, follow the steps to register the MCP client and verify the connection.

    stdio mode setup (local development)

    You can run the server locally using the standard command line invocation. The following example runs the server with the MCP package using the npx runner.

    # Personal account example
    npx -y @softeria/ms-365-mcp-server
    
    # Organization/work account example (enable organization mode)
    npx -y @softeria/ms-365-mcp-server --org-mode
    
    # China 21Vianet organization example
    npx -y @softeria/ms-365-mcp-server --org-mode --cloud china

    In Claude Desktop or other integrations, you can configure the server using the same base command with additional flags as needed. For example, to enable organization mode in Claude Desktop, specify the command and arguments exactly as shown.

    Additional configuration and features

    Authentication supports multiple methods. Device Code Flow is the default for interactive login. In HTTP mode, OAuth 2.1 is advertised and tokens are required for MCP requests. You can also supply a pre-existing OAuth token with BYOT (Bring Your Own Token) mode when needed.

    Tool presets help reduce startup overhead by enabling only selected categories of tools. You can request presets like mail, calendar, files, or all tools, depending on your needs.

    Azure Key Vault integration allows storing secrets outside the environment variables for production deployments. You can point the server to a Key Vault URL and map secrets to client IDs, tenant IDs, and client secrets as needed.

    Examples

    Examples show how to configure the server in different environments, including personal and organization modes, as well as how to integrate with Claude Desktop. Use these as practical references to tailor the MCP server for your setup.

    Open WebUI quick-start

    Open WebUI supports MCP servers via HTTP transport with OAuth 2.1. Start the server with HTTP mode and dynamic registration, then add the MCP connection in WebUI under Admin Settings. Quick test setup demonstrates a default Azure app and a local URL like http://localhost:3000/mcp.

    Local development

    For local development, you can run the server and test with CLI tools or adapt the provided samples for your environment.

    # Claude Code CLI example for personal account
    claude mcp add ms365 -- npx -y @softeria/ms-365-mcp-server
    
    # Work/School account example with organization mode
    claude mcp add ms365 -- npx -y @softeria/ms-365-mcp-server --org-mode

    Authentication and security

    You must authenticate before using tools. Choose from Device Code Flow, OAuth Authorization Code Flow (HTTP mode), or BYOT. In HTTP mode, login/logout tools are disabled by default and can be enabled with a flag if required.

    Azure Key Vault integration notes

    Store secrets in Azure Key Vault for production deployments. Map Key Vault secrets to environment variables, and configure access policies for your deployment. The server automatically uses DefaultAzureCredential to obtain credentials from multiple sources.

    Troubleshooting and support

    If you encounter issues, start by verifying authentication status, ensuring the correct mode (stdio or http), and checking the configured output format. For help, create an issue, start a discussion, or reach out via email, Discord, or other provided contact options.

    Available tools

    login

    Authenticate using device code flow. Checks existing tokens and prompts for login if needed.

    logout

    Clear saved credentials and sign out from the MCP server.

    verify-login

    Verify the current login status without starting the server.

    list-todos

    List tasks created in Microsoft To Do.

    list-mail-messages

    List email messages in a mailbox.

    list-mail-folders

    List folders within a mailbox.

    get-mail-message

    Retrieve a specific email message by ID.

    send-mail

    Send an email message.

    list-calendars

    List calendars in the account.

    list-calendar-events

    List events in a calendar.

    get-calendar-event

    Get details for a specific calendar event.

    create-calendar-event

    Create a new calendar event.

    list-drives

    List OneDrive drives in the account.

    get-drive-root-item

    Get the root item of a OneDrive drive.

    list-folder-files

    List files in a folder in OneDrive.

    download-onedrive-file-content

    Download content of a OneDrive file.

    upload-file-content

    Upload content to a OneDrive file.

    upload-new-file

    Upload a new file to OneDrive.

    delete-onedrive-file

    Delete a file from OneDrive.

    list-excel-worksheets

    List worksheets in an Excel workbook.

    get-excel-range

    Get a range value from an Excel worksheet.

    create-excel-chart

    Create a chart in Excel.

    format-excel-range

    Format a range in Excel.

    sort-excel-range

    Sort data in an Excel range.

    list-onenote-notebooks

    List OneNote notebooks.

    list-onenote-notebook-sections

    List sections within a OneNote notebook.

    list-onenote-section-pages

    List pages within a OneNote section.

    get-onenote-page-content

    Get content of a OneNote page.

    create-onenote-page

    Create a new OneNote page.

    list-todo-task-lists

    List To Do task lists.

    list-todo-tasks

    List tasks in a To Do list.

    get-todo-task

    Get details for a To Do task.

    create-todo-task

    Create a new To Do task.

    update-todo-task

    Update an existing To Do task.

    delete-todo-task

    Delete a To Do task.

    list-planner-tasks

    List Planner tasks.

    get-planner-plan

    Get Planner plan details.

    list-plan-tasks

    List tasks in a Planner plan.

    get-planner-task

    Get Planner task details.

    create-planner-task

    Create a Planner task.

    list-outlook-contacts

    List contacts in Outlook.

    get-outlook-contact

    Get a specific Outlook contact.

    create-outlook-contact

    Create an Outlook contact.

    update-outlook-contact

    Update a contact in Outlook.

    delete-outlook-contact

    Delete an Outlook contact.

    get-current-user

    Retrieve information about the signed-in user.

    search-query

    Perform a search across Microsoft 365 data.

    list-sharepoint-site-items

    List items in a SharePoint site.

    get-sharepoint-site-drive-by-id

    Get a SharePoint site drive by ID.

    search-sharepoint-sites

    Search SharePoint sites.

    list-sharepoint-site-lists

    List lists within a SharePoint site.

    list-sharepoint-site-items

    List items in a SharePoint site.

    get-sharepoint-site-item

    Get a specific SharePoint site item.

    get-sharepoint-site

    Get a SharePoint site by URL.

    list-sharepoint-sites-delta

    Get delta changes for SharePoint sites.