
MSGraph MCP
io.github.timfurlongPublished by GitHub account timfurlongv0.5.1Updated Oct 24, 2026
MCP server for Microsoft Graph: Outlook mail and calendar, plus read-only Microsoft Teams
Overview
Lets an assistant read and manage your Outlook mail, calendar, and read-only Teams messages through Microsoft Graph as the signed-in user.
- What you can do
- A local stdio MCP server for Microsoft Graph that exposes Outlook mail and calendar plus read-only Teams message history. Mail tools cover listing, searching, reading, sending, replying, forwarding, drafts, folders, rules, flags, and batch actions on up to 1000 messages. Calendar tools list, create, update, cancel, and respond to events and find meeting times. Teams tools list chats, joined teams, channels, channel messages, replies, and hosted content. Responses are trimmed for agents, with optional full bodies or raw Graph payloads.
- When to use it
- Use it when an assistant should work with a Microsoft 365 mailbox or calendar, for example triaging and searching mail, drafting or sending replies, managing folders and rules, scheduling or responding to meetings, or reading Teams chat and channel history. It acts as the signed-in user, so it only reaches what that account can reach.
- Requirements
- Python 3.11 or newer, installed via uv tool or pip, or run with uvx. An Entra (Azure AD) app registration with public client flows enabled, the nativeclient redirect URI, and delegated Graph permissions for mail, calendar, and Teams; ChannelMessage.Read.All and some shared permissions need tenant admin consent. Set MSGRAPH_MCP_CLIENT_ID and MSGRAPH_MCP_TENANT_ID, run the one-time device code sign-in, and optionally set MSGRAPH_MCP_TOKEN_CACHE_PATH. Desktop only, over stdio.
Installation
In SourceWeft
- Open MSGraph MCP in the dashboard and add it to a workspace.
- Enable the server for the chats that should use its tools.
Desktop only via STDIO. STDIO servers start a local process, so they need the SourceWeft desktop host.
Other MCP clients
Follow the launch instructions in the repository.
README
MSGraph MCP
[PyPI] [Python versions] [CI] [License: MIT]
A Model Context Protocol (MCP) server for Microsoft Graph. It exposes Microsoft Outlook mail and calendar, plus read-only Microsoft Teams message history, to AI agents via the Microsoft Graph SDK. It acts as the signed-in user, using delegated permissions and MSAL device code flow, so it can only reach what that user can reach.
Install
You need Python ≥ 3.11 and an Entra (Azure AD) app registration. The app registration takes about ten minutes and may need an administrator, so do that first: see the Entra setup section below.
The package is msgraph-mcp-server. It installs three commands: msgraph-mcp and its alias msgraph-mcp-server, which both start the stdio server, plus msgraph-mcp-login for the one-time sign-in.
Setup
1. Set your Entra app credentials.
2. Sign in once. This prints a URL and a code; visit the URL and enter the code. No client secret is involved or stored.
A token cache is written to ~/.msgraph-mcp/token_cache.bin.
3. Wire the server into your MCP host.
Claude Code:
Any other host, over stdio:
To run without installing, use "command": "uvx" with "args": ["msgraph-mcp-server"]. Note that uvx does not put msgraph-mcp-login on your PATH, so sign in with the uvx --from form shown in step 2.
MSGRAPH_MCP_TOKEN_CACHE_PATH optionally overrides the cache location. All three variables can also come from a .env file in the working directory; the process environment wins over it.
Entra setup
The app registration requires:
- Account type: single tenant (multi-tenant works too; set
MSGRAPH_MCP_TENANT_IDtocommon,organizations, orconsumers) - Redirect URI (public client):
https://login.microsoftonline.com/common/oauth2/nativeclient - Allow public client flows: Yes, under Authentication → Advanced settings. Device code flow fails without it.
- Delegated permissions (Microsoft Graph):
- Mail:
Mail.ReadWrite,Mail.ReadWrite.Shared,Mail.Send - Rules:
MailboxSettings.ReadWrite(Graph requires this for themessageRulesendpoints) - Calendar:
Calendars.ReadWrite,Calendars.ReadWrite.Shared - Identity:
User.Read - Teams:
Chat.Read,Team.ReadBasic.All,Channel.ReadBasic.All,ChannelMessage.Read.All
- Mail:
ChannelMessage.Read.All always needs tenant admin consent, and the *.Shared permissions may need it depending on your tenant.
The scope list is all-or-nothing. Sign-in requests every scope at once, so without admin consent for
ChannelMessage.Read.Allthe login fails outright and mail and calendar are unavailable too. For the same reason, adding scopes later means re-runningmsgraph-mcp-login; until you do, every tool fails withNotAuthenticatedError, not just the ones needing the new scope.
Tools
Behavior shared across tools:
- Trimmed responses. Results are reshaped for agents, and message and event bodies are replaced by a short
snippet. Passinclude_body=truetoget_message,list_chat_messages,list_channel_messages, orlist_message_repliesfor the full body, which for Teams is also what surfaces Adaptive Card content. Passinclude_raw=trueto any tool returning a Graph object to get the full payload alongside the trimmed one; thebatch_*tools return per-message status only and do not accept it. - Other mailboxes. Every mail and calendar tool takes an optional
mailbox(email or user ID) to target a shared or delegated mailbox. Omit it for your own. Teams tools are read-only, cover only your own chats, and take nomailbox. - Pagination. List and search tools take
limit(1-100, default 25) andpage_token, exceptlist_channel_messagesandlist_message_replies, which Graph caps at 50.list_folders,list_rules,list_attachments, andlist_calendarsreturn the whole collection and take neither. Onlist_joined_teamsandlist_channels,limitis applied after fetching because Graph rejects$topthere, so it saves tokens rather than round-trips. - Batch actions. The
batch_*tools apply one action to up to 1000 messages via Graph's$batchendpoint, returning a per-message result plus a{total, succeeded, failed}summary. - Downloads.
download_attachmentanddownload_hosted_contentreturn images as native MCP image blocks the agent can view. Passsave_path(a file, or an existing directory) to write bytes to disk and get back a path instead. - Finding mail.
list_messagesdefaults to the inbox; passfolder_idfor another folder,unread_only=true, or a raw ODatafilterfor predicates KQL cannot express.search_messagespasses your query to Graph's$searchas KQL.
Outgoing attachments are capped at 3 MB total per message; chunked upload is not supported. SharePoint-backed Teams file attachments cannot be downloaded, only inline hosted content.
Security
The token cache holds your refresh token, which can mint access tokens for your mail, calendar, and Teams data. Treat the file as a credential. It lives at ~/.msgraph-mcp/token_cache.bin with mode 0600 inside a 0700 directory.
To revoke access, or to switch accounts, delete the cache and sign in again:
The second path matters if you ever ran this server under its former name outlook-mcp: that cache is still used as a fallback when the current one is absent, so deleting only the first file leaves a working refresh token on disk. To revoke fully, also remove the app at https://account.microsoft.com or in your organization's identity portal.
Troubleshooting
NotAuthenticatedError: Not authenticated— runmsgraph-mcp-login. If it recurs immediately, a requested scope has not been consented yet; see the note under Entra setup.ConfigError: Missing required env var— set it in your shell, in a.envin the working directory, or in your MCP host's env config.Graph API 403: ErrorAccessDenied— the Entra app is missing a delegated permission, or it needs admin consent. Check the list above, then re-consent and sign in again.Graph API 400: BadRequest — Syntax errorfromsearch_messages— the query goes to Graph's$searchas KQL. Quote literal phrases ("weekly report") or use fielded forms (from:alice). For predicates KQL cannot express, uselist_messageswithfilter=.- The host starts the server but lists no tools — confirm it launches
msgraph-mcp(oruvx) over stdio and can find that binary on itsPATH.
Development
See CONTRIBUTING.md.
Source: README.md at commit e541cdb
Tools
0Version history
2- v0.5.1LatestSep 21, 2026
- v0.3.2Sep 16, 2026
Score
50% of the applicable checks met
How complete this listing is, computed from the registry entry, the endpoint and public sources. Not a rating of the server and not a statement that it is safe or working today: reachability is a dated check, and no installs or reviews go into the score.
- Reached in the last 30 days25 pts
Keep the endpoint answering the MCP handshake; SourceWeft probes it every 30 days.
- Auth declared10 pts
Declare the credential headers in the registry entry, or keep the endpoint answering the probe so its auth can be classified.
- Tools listed15 pts
Answer tools/list without a credential, or ship a package that starts in a sandbox without one.
- DescriptionRequired15 pts
- Logo10 pts
- Documentation15 pts
- License10 pts

