ms-graph-mcp
This server exposes Microsoft Graph capabilities as MCP tools, letting an AI agent read the user's Microsoft 365 data (mail, calendar, files, people, contacts, and unified search) via read-only tools, so deep, and no offline operations are enabled by default.
Calendar: list upcoming/range events, get event details, attendee responses, free/busy lookup, and meeting-time suggestions.
Mail: search emails, list recent or flagged messages, read full conversation threads, and inspect attachments metadata.
Files: search OneDrive/SharePoint, list trending/recent/shared files, and extract text content from documents.
People & contacts: search org people, look up profiles by email, get own profile, and search/list personal Outlook contacts.
Unified search: one-call search across mail, calendar events, files, SharePoint sites/lists, and people with KQL support.
Read-only: by default only exposes 23 read tools; write/internal tools require explicit opt-in and are not visible.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@ms-graph-mcp List my upcoming calendar events for tomorrow."
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
ms-graph-mcp
A Model Context Protocol server for Microsoft Graph — 85 tools across mail, calendar, meetings (including transcripts), Teams chat, files, SharePoint, search, people, contacts, directory, tasks and OneNote, over stdio or Streamable HTTP.
Signs you in with your own Microsoft account — browser SSO, no token to paste, no client secret.

No
msgraph-sdk, noazure-identity— the Graph client is rawhttpx2, so the dependency tree stays small and the wire behaviour is inspectable.Read/write separation is enforced, not advisory — write tools are hidden and refused unless the caller explicitly opts in.
Auth-agnostic by default — tools receive an already-acquired Graph token via the request context. The server can also perform its own on-behalf-of exchange when you want it to act as a proper OAuth resource server.
Status: early. Extracted from a production agent platform where it has been running against a real tenant. The code is battle-tested; the packaging and public API surface are newer. Expect the config surface to move before 1.0.
Install
Requires Python 3.12+. Two paths — pick the one that matches what you want to do.
A. Use the package
Nothing to clone. uv runs it straight from PyPI:
uvx --from ms-graph-mcp ms-graph-mcp # stdio, for an MCP client
uvx --from ms-graph-mcp ms-graph-mcp-http # Streamable HTTPor install it into an environment:
pip install ms-graph-mcpRelease candidates are published too. pip skips them unless you ask:
pip install --pre ms-graph-mcp # newest, including candidates
pip install ms-graph-mcp==0.3.0rc1 # a specific one; no --pre needed for an exact pinA container image is on GHCR for the HTTP transport — see docs/hosting.md.
Also listed on the official MCP registry as
io.github.nitin27may/ms-graph-mcp.
TestPyPI is not a distribution channel. Every release is published there first, but that is a rehearsal of the publishing process: it can be wiped without notice and does not mirror PyPI, so installing from it needs
--extra-index-url https://pypi.org/simple/just to resolve ordinary dependencies. Use PyPI, or--pre.
B. Run from source
For hacking on it, forking it, or running an unreleased change:
git clone https://github.com/nitin27may/ms-graph-mcp
cd ms-graph-mcp
uv sync # creates .venv and installs everything
uv run ms-graph-mcp # check it startsuv sync is the only setup step. See
CONTRIBUTING.md before
opening a pull request — the tool allowlists and the tier separation have invariants that are
enforced rather than advisory.
To point an MCP client at your clone, you need its absolute path — clients do not inherit your
working directory and most do not expand ~:
cd ms-graph-mcp && pwd
# /Users/you/workspace/ms-graph-mcpThen use the source form of the config in Configure your MCP client below.
Related MCP server: ms-teams-mcp
Set up the Entra app
You need an Entra ID app registration — about two minutes. Do not create a client secret: this registers as a public client, which signs you in through your browser using PKCE. A secret on a program running on your own machine would be readable by anyone with the config file, which is why the flow is designed not to need one. Nothing goes into a config file except two ids, neither of which is sensitive.
In the Entra portal → App registrations → New registration:
Name: anything, e.g.
ms-graph-mcpSupported account types: Accounts in this organizational directory only
Redirect URI: select Public client/native, value
http://localhost
Leave Certificates & secrets alone — you do not need anything from it.
Then, on the new app:
Authentication → enable Allow public client flows
API permissions → Add a permission → Microsoft Graph → Delegated permissions, and add what you want the agent to reach. A sensible read-only starting set:
User.Read Mail.Read Calendars.Read Files.Read.All People.Read Chat.Read Tasks.Read Notes.Read Contacts.ReadThe complete copy-paste consent sets — and which permission each individual tool needs — are in docs/permissions.md.
Copy the Application (client) ID and Directory (tenant) ID from the Overview page. That is everything you need.
Configure your MCP client
Every MCP client that speaks stdio takes the same three things — a command, its arguments, and an environment block:
{
"command": "uvx",
"args": ["--from", "ms-graph-mcp", "ms-graph-mcp"],
"env": {
"GRAPH_MCP_CLIENT_ID": "<application-client-id>",
"GRAPH_MCP_TENANT_ID": "<directory-tenant-id>"
}
}Where that block goes, and what the surrounding key is called, differs:
Client | Config file | Key |
VS Code |
|
|
Claude Code |
| — |
Claude Desktop | macOS |
|
Cursor |
|
|
Windsurf |
|
|
MCP Inspector | command line, | — |
The first sign-in opens your browser for normal Microsoft 365 SSO — including MFA and conditional
access. The result is cached in ~/.ms-graph-mcp/token_cache.json, owner-readable only, so it does
not prompt again.
VS Code
{
"inputs": [
{ "id": "clientId", "type": "promptString", "description": "Entra application (client) ID" },
{ "id": "tenantId", "type": "promptString", "description": "Entra directory (tenant) ID" }
],
"servers": {
"ms-graph": {
"type": "stdio",
"command": "uvx",
"args": ["--from", "ms-graph-mcp", "ms-graph-mcp"],
"env": {
"GRAPH_MCP_CLIENT_ID": "${input:clientId}",
"GRAPH_MCP_TENANT_ID": "${input:tenantId}"
}
}
}
}Reload the window. VS Code prompts once for the two ids and remembers them, so this file is safe to
commit. Open the Chat view, switch to Agent mode, and the tools appear under the tools picker —
that is the panel in the screenshot above. Confirm with MCP: List Servers, which shows status
and output if it does not connect.
Claude Code
claude mcp add ms-graph \
--env GRAPH_MCP_CLIENT_ID=<application-client-id> \
--env GRAPH_MCP_TENANT_ID=<directory-tenant-id> \
-- uvx --from ms-graph-mcp ms-graph-mcpConfirm with /mcp inside Claude Code — it lists the server and its tools.
Claude Desktop
{
"mcpServers": {
"ms-graph": {
"command": "uvx",
"args": ["--from", "ms-graph-mcp", "ms-graph-mcp"],
"env": {
"GRAPH_MCP_CLIENT_ID": "<application-client-id>",
"GRAPH_MCP_TENANT_ID": "<directory-tenant-id>"
}
}
}
}Confirm by quitting Claude Desktop fully — not just closing the window — reopening it, and looking for the tools icon in the composer.
Cursor and Windsurf
Both use the same mcpServers shape as Claude Desktop, in the file named in the table above.
MCP Inspector
The quickest way to check the server independently of any client:
npx @modelcontextprotocol/inspector \
uvx --from ms-graph-mcp ms-graph-mcp \
-e GRAPH_MCP_CLIENT_ID=<application-client-id> \
-e GRAPH_MCP_TENANT_ID=<directory-tenant-id>Needs Node 22.19+. It opens a browser UI where you can list tools and call them by hand — worth
doing before blaming your client. There is a scriptable --cli mode too; see
docs/testing.md.
Pass variables with
-e, not from your shell. Inspector does not give the server it spawns your environment, soGRAPH_MCP_CLIENT_ID=… npx @modelcontextprotocol/inspector …starts the server with no client id. The-eflags go after the server command.
Running from source instead
Same blocks as above — swap the command and args for your clone's absolute path:
"command": "uv",
"args": ["run", "--directory", "/Users/you/workspace/ms-graph-mcp", "ms-graph-mcp"]Two things catch people out here:
uv must be on the client's PATH. GUI apps launched from Finder or the Dock do not inherit your
shell's PATH, so a client can fail to start the server with an unhelpful error. If that happens, put
the output of which uv in "command" instead of the bare name.
--directory is not optional. Without it, uv run resolves against whatever directory the
client happened to launch from, which will not be the project.
Something not working?
docs/troubleshooting.md covers the Entra errors, Conditional Access, corporate TLS proxies, and the "server disconnected" that is almost always a startup error your client is hiding.
Configuration
Two settings get you running; everything else has a working default.
Env var | Purpose |
| Entra application (client) id. Enables interactive sign-in. |
| Entra directory (tenant) id. Defaults to |
| Comma-separated delegated scopes to request. Defaults to a read-only set. |
| Which tool profiles to expose. Defaults to |
|
|
|
|
|
|
Every setting, both deployment shapes, and the hosted/OBO options are in docs/configuration.md. For running it as a service, see docs/hosting.md.
Toolset profiles
85 tools is a lot to put in front of a model. GRAPH_MCP_TOOLSETS selects named profiles, each a
group of namespaces:
Profile | Namespaces | Read tools | Approx. tokens |
| search, mail, calendar, files, people | 23 | ~4,200 |
| 5 | ~800 | |
| calendar | 6 | ~1,500 |
| meetings, calendar | 13 | ~2,900 |
| files | 6 | ~900 |
| chat | 7 | ~1,000 |
| people | 5 | ~750 |
| directory, people | 12 | ~1,900 |
| tasks | 5 | ~830 |
| notes | 4 | ~570 |
| search | 1 | ~290 |
| everything | 53 | ~9,200 |
Combine them with commas:
GRAPH_MCP_TOOLSETS=mail,calendar,taskscore is the default, so some tools are not advertised unless you ask for them. If you want
Teams chat, Planner, OneNote, meeting transcripts or directory lookups, name those profiles — or set
GRAPH_MCP_TOOLSETS=all to expose everything.
Over HTTP a caller may send X-Toolsets to narrow further for one request. It can only narrow.
The startup value is a ceiling, so a client asking for all gains nothing the deployment did not
already enable. This filters visibility, not authority — the write-scope and internal-tier gates
are what actually stop a call.
Tool surface
Three tiers, one auth seam.
Tier | Count | Exposed when | Examples |
Read | 53 | always |
|
Write | 23 |
|
|
Internal | 9 |
|
|
The internal tier is not part of the agent surface. A model sees 76 agent-visible tools. By namespace: mail 11 · tasks 11 · calendar 10 · files 10 · chat 8 · directory 7 · meetings 7 · people 6 · notes 5 · search 1.
Tool names are namespaced by Graph permission family rather than by Microsoft product, because real
questions cross product boundaries — files_ covers OneDrive and SharePoint document libraries,
which are the same driveItem resource underneath.
Every tool declares MCP annotations (readOnlyHint, destructiveHint, idempotentHint) so clients
know what needs confirming, and every description names the delegated permission it requires.
Renamed in 0.2.0. Every pre-0.2.0 tool name still works as an alias, and will keep working until 0.4.0. Aliases are honoured by
tools/callbut never advertised intools/list, so they cost no context.
Documentation
Published as a searchable site at https://nitinksingh.com/ms-graph-mcp/.
Everything below, searchable and cross-linked | |
Every environment variable, split by deployment shape | |
Every tool and the delegated permission it needs, plus copy-paste consent sets | |
Streamable HTTP, headers, Docker and GHCR | |
Entra errors, Conditional Access, corporate TLS proxies | |
Logs, error codes, and the auth failures people actually hit | |
What this covers of the Graph v1.0 surface, what it does not, and what is out of scope | |
What is not done yet | |
Running the suite, how it is arranged, and MCP Inspector | |
Dev setup, the add-a-tool checklist, and the invariants enforced by tests | |
Reporting vulnerabilities, and what to change before exposing this beyond localhost | |
Release history | |
Architecture and the non-obvious traps, for coding agents and new contributors alike |
What's next
SharePoint sites and lists are the largest gap; directory completion, file move/delete, and mail drafts follow. Sovereign clouds (GCC High / 21Vianet) are unsupported today. The full list, and what is deliberately out of scope, is in docs/roadmap.md.
Getting help
Setup and app-registration questions → Discussions
Bugs → Issues, with the output of running the server in a terminal
Security vulnerabilities → never a public issue; see SECURITY.md
Never paste an access token, client secret or shared secret into any of them.
Contributing
Issues and pull requests are welcome. Start with CONTRIBUTING.md; participation is governed by the Code of Conduct.
uv sync
uv run pytest -q # full suite, offline, about two seconds
uv run ruff check .
uv run ruff format .License
MIT — see LICENSE.
Available Tools
23 toolscalendar_find_meeting_timesARead-onlyIdempotent
Ask Microsoft Graph to suggest meeting times when the given attendees are free, ranked by how likely everyone is to attend. Returns candidate slots with a confidence percentage and per-attendee availability. This reads calendars and books nothing — pass a chosen slot to calendar_create_event to actually schedule it. Requires Calendars.Read.Shared.
Inputs: attendees, time_zone, window_end, window_start, +3 more.
calendar_get_eventARead-onlyIdempotent
Get one calendar event in full by its id: subject, times, organiser, location, agenda preview, the Teams join URL and the complete attendee list with each person's response status. Takes an event id from calendar_list_upcoming_events or calendar_list_events_in_range. Use calendar_get_event_attendees when only the attendee list is needed. Requires Calendars.Read.
Inputs: meeting_id (required).
calendar_get_event_attendeesARead-onlyIdempotent
List who was invited to a calendar event and how each person replied — accepted, declined, tentative or no response. Returns email, display name and response status per attendee. Use this when the question is about who is coming; calendar_get_event returns the same list alongside the event's other detail. Requires Calendars.Read.
Inputs: meeting_id (required).
calendar_get_free_busyARead-onlyIdempotent
Look up whether people are free or busy across a time window, without seeing what their meetings are. Returns per-person busy periods and a slot-by-slot free/tentative/busy/out of office breakdown. Use to answer 'when is X available'; calendar_find_meeting_times is better when the goal is a slot that suits a whole group. Requires Calendars.ReadBasic.
Inputs: end (required), start (required), emails (required), time_zone, +1 more.
calendar_list_events_in_rangeARead-onlyIdempotent
List calendar events between two dates, in chronological order. Use for any window that is not simply 'the next few days' — last week's meetings, a specific month, or a range the user names. Dates are ISO 8601 (2026-01-15) and the whole of both end days is included. Returns id, subject, times and organiser. Requires Calendars.Read.
Inputs: end_date (required), start_date (required), max_results.
calendar_list_upcoming_eventsARead-onlyIdempotent
List the signed-in user's upcoming calendar events for the next N days, soonest first. Returns id, subject, start and end times, organiser and whether it is online. This is the tool for 'what's on my calendar'. Use calendar_list_events_in_range for a specific window, and calendar_get_event for full detail including the join URL. Requires Calendars.Read.
Inputs: days_ahead, max_results.
files_get_contentARead-onlyIdempotent
Read the text content of a file in OneDrive or SharePoint, given a drive id and item id from files_search or files_list_recent. Works for text, Office documents and PDFs; binary files return a placeholder instead of bytes. Output is truncated to a caller-specified character limit. Requires Files.Read.All.
Inputs: item_id (required), drive_id (required), max_chars.
files_get_group_driveARead-onlyIdempotent
Get the document library backing a Microsoft 365 group or Teams team, given a group id from directory_search_groups. Returns the drive id and web URL, which is what the other file tools need to read or write inside a team's shared files. Requires Files.Read.All and Group.Read.All.
Inputs: group_id (required).
files_list_recentARead-onlyIdempotent
List files the signed-in user has recently opened or edited, most recent first. Returns id, name, drive id and web URL. Use for 'the document I was working on yesterday' — files_search is better when the name or a keyword is known, and files_list_trending covers what colleagues are working on. Requires Files.Read.
Inputs: max_results.
files_list_trendingARead-onlyIdempotent
List documents currently trending around the signed-in user — files their colleagues are actively working on, ranked by Microsoft 365 activity signals rather than by the user's own history. Use for 'what is the team working on'. files_list_recent is the tool for what this user personally touched. Requires Files.Read.All.
Inputs: max_results.
files_searchARead-onlyIdempotent
Search the signed-in user's OneDrive and the SharePoint sites they can reach, by filename or content keyword. Returns id, name, drive id, size, last-modified date and web URL. OneDrive and SharePoint document libraries are the same underlying resource, so one search covers both. Requires Files.Read.All.
Inputs: query (required), max_results.
mail_get_threadARead-onlyIdempotent
Read every message in one email conversation, oldest first, given a conversation id from any of the mail listing tools. Returns full message bodies rather than previews, so it is the tool for understanding what was actually discussed before replying or summarising. Requires Mail.Read.
Inputs: conversation_id (required), max_results.
mail_list_attachmentsARead-onlyIdempotent
List the file attachments on one email — name, content type and size in bytes. Returns metadata only and never file contents, so it is safe to call on messages with very large attachments. Inline images such as signature logos are excluded. Requires Mail.Read.
Inputs: message_id (required).
mail_list_flaggedARead-onlyIdempotent
List emails the signed-in user has flagged for follow-up, newest first. Returns id, subject, sender, date and preview. Flags are the user's own marker for 'come back to this', so use it for 'what do I still need to deal with' rather than mail_list_recent, which returns everything regardless of state. Requires Mail.Read.
Inputs: max_results.
mail_list_recentARead-onlyIdempotent
List the signed-in user's most recent emails from the last N days, newest first. Returns id, subject, sender, date and a preview snippet. Use for 'what came in today' or catching up after time away; mail_search is the tool when specific keywords or a sender are known. Requires Mail.Read.
Inputs: days_back, max_results.
mail_searchARead-onlyIdempotent
Search the signed-in user's mailbox by keyword, subject or sender name. Returns id, subject, sender, date and a preview snippet, newest first. Searchable folders are inbox, sentitems, drafts, or all. Use mail_list_recent when the ask is time-based rather than keyword-based, and mail_get_thread to read a whole conversation. Requires Mail.Read.
Inputs: query (required), folder, max_results.
people_getARead-onlyIdempotent
Look up one person in the organisation by their exact email address and return their profile: display name, job title, department, office location and phone numbers. Use when the address is already known — people_search is the tool for finding someone by partial or approximate name. Fails if the address does not belong to a tenant account. Requires User.Read.All.
Inputs: email (required).
people_get_my_profileARead-onlyIdempotent
Get the signed-in user's own profile — their name, email address, job title, department and office. Call this first when a request says 'me', 'my' or 'I' and the user's own identity or email address is needed to answer it, for example before filtering a calendar or addressing a message. Takes no arguments. Requires User.Read.
Inputs: no named parameters.
people_list_contactsARead-onlyIdempotent
List the signed-in user's saved Outlook contacts, with names, email addresses and phone numbers. This is the user's personal address book and is the only place external contacts live — people with no account in the tenant, invisible to people_search and directory_search_users. Use it for phone numbers. Requires Contacts.Read.
Inputs: max_results.
people_searchARead-onlyIdempotent
Find colleagues the signed-in user actually works with, ranked by relevance from their own mail and meeting history — so it finds the right 'Priya' without exact spelling. Returns name, email, title and department. Use directory_search_users to search the whole tenant instead, or people_list_contacts for the saved address book. Requires People.Read.
Inputs: query (required), max_results.
people_search_contactsARead-onlyIdempotent
Search the signed-in user's saved Outlook contacts by name or company, returning emails and phone numbers. Searches the personal address book only — use people_search for colleagues the user works with, or directory_search_users to search the whole tenant. This is the one that finds external contacts. Requires Contacts.Read.
Inputs: query (required), max_results.
search_queryARead-onlyIdempotent
Search across Microsoft 365 in one call — email, calendar events, files, SharePoint sites and lists, and people. Best first move for a vague request, since it spans workloads no other single tool covers. Supports KQL such as 'budget filetype:xlsx'. Each entity type needs its own permission. Requires Mail.Read, Calendars.Read, Files.Read.All, Sites.Read.All and People.Read.
Inputs: query (required), max_results, entity_types.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 23 tools
Each tool targets a distinct resource and action: calendar tools are split by range/detail/attendees/free-busy, mail tools by search/recent/flagged/thread, files tools by search/recent/trending/shared/content, and people tools by search/contacts/profile. The descriptions clearly suss out overlaps, e.g., calendar_list_upcoming_events vs calendar_list_events_in_range, and mail_search vs mail_list_recent. No two tools appear to do the same thing.
Tool names follow a consistent verb_noun pattern with a resource prefix, such as calendar_list_upcoming_events, mail_get_thread, files_search, people_get_my_profile. All names use snake_case and the verb is consistently placed before the object. One minor deviation is 'search_query' which lacks a domain prefix, but it's a cross-resource tool and still readable.
With 23 tools, the server sits slightly above the typical well-scoped range, but the breadth of Microsoft 365 workloads (calendar, mail, files, people, global search) justifies it. Each domain has a reasonable set of read operations without excessive redundancy. A few tools could be consolidated, but the count isn't unreasonable for the coverage.
The tool set is heavily read-oriented and misses write operations like creating or updating calendar events, sending mail, or editing files, which are only hinted at in descriptions (e.g., calendar_create_event referenced but not implemented). More critically, files_get_group_drive depends on directory_search_groups, which is not among the tools, creating a dead end for that workflow. Several other referenced tools (directory_search_users) are also missing, so an agent following descriptions will hit gaps.
Maintenance
Related MCP Connectors
Manage Microsoft 365 email, calendar, contacts and inbox rules via the Graph API with OAuth 2.0.
Nifty's MCP server — exposes tasks, projects, messages, and files as tools for AI agents.
One OAuth connector for your team's remote MCP servers, with Tool Packs, guardrails and logs.
Toolstile is a managed MCP gateway that connects remote MCP servers behind one endpoint, with per-agent permissions, shared accounts and activity logs. Connect at https://mcp.toolstile.com/mcp over Streamable HTTP with OAuth; sign in at https://toolstile.com, select a workspace and connect your upstream servers. Available tools, resources and prompts depend on that workspace and the agent's granted access.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceA Model Context Protocol server that gives Claude Code (or any MCP client) controlled access to Microsoft 365 through the Microsoft Graph API: mail, calendar, contacts, files, notes, tasks, Teams, SharePoint, and the full tenant-admin surface.65 npm1MIT
- AlicenseBqualityDmaintenanceMCP server for Microsoft Teams that exposes 73 tools to manage teams, channels, chats, messages, meetings, planner, calendar, apps, tabs, scheduling, search, and authentication via the Graph API.739 npmMIT
- AlicenseNot gradedqualityDmaintenanceRemote MCP server for Microsoft Graph with delegated OAuth support, enabling interaction with Microsoft 365 services like mail, calendar, OneDrive, SharePoint, Teams, and more via natural language.MIT
- AlicenseAqualityDmaintenanceA local stdio MCP server that enables reading, sending, and searching emails, as well as listing calendar events via Microsoft Graph API, using device-code authentication.1081 npmMIT