Microsoft 365 MCP server — Mail, Calendar, OneDrive, SharePoint, Contacts, and Teams via the Microsoft Graph API, with multi-account support.
mcp-microsoft is a Model Context Protocol server that gives Claude (and any other MCP client) full access to your Microsoft 365 account. It covers six surface areas of the Microsoft Graph API: email, calendar, OneDrive file storage, SharePoint, contacts, and Teams — 93 tools in total.
The server works with both personal Microsoft accounts (Outlook.com, Live) and enterprise accounts (Azure AD / Entra ID) using a single App Registration. Teams and SharePoint require a work or school account and are gated behind feature flags (MCP_ENABLE_TEAMS / MCP_ENABLE_SHAREPOINT). On manual installs, they auto-enable for corporate-oriented tenant values (common, organizations, or a specific tenant ID). In Claude Desktop / MCPB, the installer toggles remain authoritative. You can always override the default with the environment flags to force either service on or off. Teams meeting transcripts/recordings and Copilot AI insights are separate explicit opt-ins so the server does not request those additional scopes unless you enable them.
Multi-account support is a first-class feature. Named profiles let you configure separate client IDs for each account and switch between them on any tool call by passing profile="work". Profiles and MSAL token caches are stored in ~/.microsoft-mcp/ and survive server restarts without re-authentication.
The server ships as an MCPB bundle (mcp-microsoft.mcpb) for zero-friction installation through the Claude Desktop Extension installer. It can also be run from source or wired directly into claude_desktop_config.json. Built with FastMCP, MSAL, and async httpx.
list_emails— list messages from any folder with pagination and unread filterread_email— fetch the full body of a message by ID (supports summary mode)search_emails— search using Microsoft Graph KQL$searchsyntax (max 25 results)filter_emails— find emails by sender, recipient, subject, date range, or attachments with full paginationsend_email— compose and send a new message (to/cc/bcc, HTML or plain text)reply_email— reply or reply-all to an existing messageforward_email— forward a message to one or more recipientsmark_as_read/mark_as_unread— toggle read statemove_email— move to any folder by well-known name or folder IDtrash_email— soft-delete to Deleted Items (recoverable)delete_email— permanently delete a message (irreversible)bulk_move_emails— move multiple messages to a folder in one operationbulk_trash_emails— move multiple messages to Deleted Itemsbulk_delete_emails— permanently delete multiple messages (irreversible)create_draft/get_draft/list_drafts/update_draft/send_draft— full draft lifecyclelist_folders/create_folder/delete_folder— manage mailbox folderslist_attachments/download_attachment— inspect and save attachments
list_calendars— enumerate all calendars in the mailboxlist_events— list events from a calendar with optional date filteringlist_upcoming_events— list events using calendarView with recurring-instance expansionget_event— fetch full event details including attendees, body, and recurrencecreate_event— create an event (subject, datetime, timezone, attendees, location, online meeting flag)update_event/delete_event— modify or remove an eventrsvp_event— accept, tentatively accept, or decline an invitationget_free_busy— check availability for one or more people in a time windowfind_meeting_times— get meeting time suggestions for a set of attendees
list_drive_items— browse files and folders by path or item IDget_drive_item— get metadata for a specific file or foldersearch_drive— full-text search across OneDriveupload_file— upload a local file (auto-switches to resumable upload for files over 4 MB)download_file— download a file to a local pathcreate_drive_folder— create a new folder at any pathmove_or_copy_item— move or copy items within OneDrivedelete_drive_item— delete a file or folder (moves to recycle bin)
SharePoint tools require a work or school account (Azure AD / Entra ID). They are not available for personal Outlook.com / Live accounts, which do not support the
Sites.ReadWrite.AllGraph permission.Sites.ReadWrite.Allrequires one-time admin consent in enterprise tenants.
search_sharepoint_sites— search or list SharePoint sites the user can accessget_sharepoint_site— get details of a specific sitelist_site_libraries— list document libraries in a sitelist_site_files/get_site_file— browse files in a document libraryupload_to_site/download_from_site— transfer files to/from SharePointlist_site_lists— list all SharePoint lists in a siteget_list_items/create_list_item/update_list_item/delete_list_item— manage list records
list_contacts— list contacts with optional folder scope and field selectionget_contact— retrieve a single contact by IDcreate_contact— create a new contact with name, email, phone, org, and notesupdate_contact— update any subset of contact fieldsdelete_contact— delete a contact by ID (irreversible)list_contact_folders— enumerate contact folders in the mailboxsearch_contacts— search contacts by display name or emailget_contact_photo— fetch a contact's profile photo as base64 or save to disk
Teams tools require a work or school account (Azure AD / Entra ID) with a specific tenant ID. They are not available for personal Outlook.com / Live accounts.
teams_list_joined/teams_get— list and inspect teamsteams_list_channels/teams_get_channel/teams_create_channel— manage channelsteams_list_channel_messages/teams_get_channel_message/teams_send_channel_message— read and post channel messagesteams_reply_to_channel_message/teams_list_message_replies— manage channel threadsteams_list_chats/teams_get_chat/teams_list_chat_messages/teams_send_chat_message/teams_create_chat— 1:1 and group chatsteams_create_meeting/teams_get_meeting/teams_find_meeting_by_url/teams_list_meetings— online meetings with join URLsteams_list_meeting_transcripts/teams_get_meeting_transcript— Teams meeting transcript metadata and VTT contentteams_list_meeting_recordings/teams_download_meeting_recording— Teams meeting recording metadata and downloadsteams_list_meeting_ai_insights/teams_get_meeting_ai_insight— Copilot meeting recap/insight metadata and full detail
Teams meeting transcripts and recordings require explicit opt-in via
MCP_ENABLE_TEAMS_MEETING_ARTIFACTSplus the delegated permissionsOnlineMeetingTranscript.Read.AllandOnlineMeetingRecording.Read.All. Teams AI insights require explicit opt-in viaMCP_ENABLE_TEAMS_AI_INSIGHTS, the delegated permissionOnlineMeetingAiInsight.Read.All, and Microsoft 365 Copilot licensing.
list_ms_profiles— list all configured profiles and which is the defaultadd_ms_profile— add a new account (name, client_id, tenant_id)remove_ms_profile— remove a profile and delete its cached tokensauthenticate_ms_profile— trigger interactive OAuth for a profileset_default_ms_profile— change which profile is used when none is specified
npx @anthropic-ai/mcpb install mcp-microsoft-0.6.0.mcpbThe installer prompts for your Azure App Registration details (see Azure Setup):
| Prompt | Description |
|---|---|
| Azure Client ID | Application (client) ID from your App Registration |
| Tenant ID | common for personal + work, consumers for personal only, or your org's tenant ID/domain |
| Credentials Directory | Optional. Defaults to ~/.microsoft-mcp/ |
| Enable Teams Tools | Toggle Teams tools on/off (requires work/school account) |
| Enable Teams Meeting Artifacts | Toggle Teams transcript/recording tools on/off (requires work/school account and extra Graph permissions) |
| Enable Teams AI Insights | Toggle Teams Copilot AI insight tools on/off (requires work/school account, extra Graph permissions, and Copilot licensing) |
| Enable SharePoint Tools | Toggle SharePoint tools on/off (requires work/school account) |
A default profile is created automatically from these values.
git clone https://github.com/guilhermeinacio/mcp-microsoft.git
cd mcp-microsoft
uv sync
export MS365_CLIENT_ID=your-client-id
export MS365_TENANT_ID=common
# Optional overrides:
# export MCP_ENABLE_SHAREPOINT=false
# export MCP_ENABLE_TEAMS=false
# export MCP_ENABLE_TEAMS_MEETING_ARTIFACTS=true
# export MCP_ENABLE_TEAMS_AI_INSIGHTS=true
uv run mcp-microsoft{
"mcpServers": {
"mcp-microsoft": {
"command": "uv",
"args": ["run", "--directory", "/path/to/mcp-microsoft", "mcp-microsoft"],
"env": {
"MS365_CLIENT_ID": "your-client-id",
"MS365_TENANT_ID": "common"
}
}
}
}You need an Azure App Registration to get a client_id. This is a one-time step.
- Go to portal.azure.com → Azure Active Directory → App registrations → New registration.
- Name it anything (e.g.,
mcp-microsoft). - Under Supported account types, choose based on your use case:
- Personal Microsoft accounts only — Outlook.com / Live users
- Accounts in any organizational directory and personal Microsoft accounts — personal and work
- Under Redirect URI, select Mobile and desktop applications and enter
http://localhost. - Under Authentication, enable Allow public client flows (required for the interactive loopback OAuth flow — no client secret needed).
- Go to API permissions → Add a permission → Microsoft Graph → Delegated permissions and add:
Mail.ReadWriteMail.SendCalendars.ReadWriteContacts.ReadWriteFiles.ReadWriteoffline_access(usually pre-added)
- If you want to enable SharePoint tools, also add
Sites.ReadWrite.All. - If you want to enable Teams tools, also add:
Team.ReadBasic.AllChannel.ReadBasic.AllChannel.CreateChannelMessage.Read.AllChannelMessage.SendChat.ReadWriteChat.CreateOnlineMeetings.ReadWrite
- If you want to enable Teams meeting transcripts and recordings, also add:
OnlineMeetingTranscript.Read.AllOnlineMeetingRecording.Read.All
- If you want to enable Teams Copilot AI insights, also add:
OnlineMeetingAiInsight.Read.AllAll users of applications that call this API need a Microsoft 365 Copilot license.
- For admin-restricted permissions such as
Sites.ReadWrite.All, click Grant admin consent. Your IT administrator must approve this once per tenant. - From the Overview page, copy the Application (client) ID and, if targeting a specific tenant, the Directory (tenant) ID.
For a detailed walkthrough with screenshots, see docs/azure-setup.md.
| Module | Personal (Outlook.com/Live) | Work/School (Azure AD/Entra) |
|---|---|---|
| Yes | Yes | |
| Calendar | Yes | Yes |
| OneDrive | Yes | Yes |
| Contacts | Yes | Yes |
| SharePoint | No | Yes (admin consent required) |
| Teams | No | Yes |
Personal accounts use tenant_id=consumers. For access to both personal and work accounts via a single profile, use tenant_id=common. Teams transcript/recording and AI-insight APIs remain work-account-only and are additional explicit opt-ins on top of the base Teams tools.
The server supports multiple Microsoft 365 accounts as named profiles. Each profile has its own client_id, tenant_id, and MSAL token cache.
Bootstrap: On first start, if MS365_CLIENT_ID is set (via the MCPB installer or environment variable), a default profile is created and persisted to profiles.json automatically. If the variable is not set, the server starts with zero profiles and you must call add_ms_profile.
Add accounts:
add_ms_profile(name="personal", client_id="...", tenant_id="consumers")
add_ms_profile(name="work", client_id="...", tenant_id="mycompany.onmicrosoft.com")
Use a specific profile on any tool call:
list_emails(folder="Inbox", profile="work")
search_drive(query="Q1 report", profile="personal")
Authenticate (opens a browser window for OAuth the first time):
authenticate_ms_profile(profile="work")
List profiles:
list_ms_profiles()
Change the default:
set_default_ms_profile(profile="work")
Profiles are stored in ~/.microsoft-mcp/profiles.json. Token caches are stored as ~/.microsoft-mcp/msal_cache_{name}.bin and encrypted at rest via OS-native APIs (DPAPI on Windows, Keychain on macOS, libsecret on Linux) using msal-extensions. Legacy plaintext caches from older versions are migrated automatically on first run. After the first interactive login, MSAL handles token refresh silently.
Security note:
profiles.jsoncontains the client/tenant IDs only — it has no secrets but is restricted to mode0600on POSIX. Themsal_cache_*.binfiles hold encrypted refresh tokens; do not commit either to version control.MS365_CLIENT_IDis not a secret and can be committed.Disabling destructive tools: set
MCP_DISABLE_DELETION_TOOLS=1to suppress registration of all permanent-delete tools (delete_email,bulk_delete_emails,delete_event,delete_contact,delete_folder,delete_drive_item,delete_list_item,remove_ms_profile). Recoverable variants such astrash_emailremain available.
| Variable | Required | Default | Description |
|---|---|---|---|
MS365_CLIENT_ID |
Yes (for bootstrap) | — | Azure App Registration client ID for the default profile |
MS365_TENANT_ID |
No | common |
Tenant ID for the default profile |
MS365_CREDENTIALS_DIR |
No | ~/.microsoft-mcp/ |
Directory for profiles.json and token caches |
MCP_ENABLE_SHAREPOINT |
No | auto-detect | Set to true to force-enable SharePoint tools or false to force-disable them |
MCP_ENABLE_TEAMS |
No | auto-detect | Set to true to force-enable Teams tools or false to force-disable them |
MCP_ENABLE_TEAMS_MEETING_ARTIFACTS |
No | false |
Set to true to register Teams transcript and recording tools and request the related delegated scopes |
MCP_ENABLE_TEAMS_AI_INSIGHTS |
No | false |
Set to true to register Teams Copilot AI insight tools and request OnlineMeetingAiInsight.Read.All |
MCP_DISABLE_DELETION_TOOLS |
No | false |
Set to true to suppress registration of all permanent-delete tools (recoverable trash variants remain) |
MS365_CLIENT_ID, MS365_TENANT_ID, and MS365_CREDENTIALS_DIR are only used to bootstrap the default profile on first run. MCP_ENABLE_TEAMS and MCP_ENABLE_SHAREPOINT participate in the existing auto-detection behavior; MCP_ENABLE_TEAMS_MEETING_ARTIFACTS and MCP_ENABLE_TEAMS_AI_INSIGHTS are explicit opt-ins only.
# Install dependencies
uv sync
# Start the MCP server (stdio mode)
uv run mcp-microsoft
# Run the test suite
uv run pytest -q
# Rebuild the MCPB bundle
npx @anthropic-ai/mcpb packTool implementations are organized by surface area under src/mcp_microsoft/tools/: mail.py, drafts.py, folders.py, attachments.py, calendar.py, onedrive.py, sharepoint.py, contacts.py, teams.py, profiles.py. Authentication is handled by MSAL with a per-profile serializable token cache. HTTP calls go through a shared async httpx client initialized at server startup.
MIT