Graph Mail MCP

Graph Mail MCP

Enables controlled Microsoft 365 mail workflows including search, read, thread, attachment, and managed draft operations through Microsoft Graph, without sending or modifying messages.

Category
Visit Server

README

Graph Mail MCP

A local stdio Model Context Protocol server for Microsoft 365 mail. It provides controlled Outlook/Exchange Online search, read, thread, attachment, and draft workflows through Microsoft Graph.

It never sends, deletes, moves, copies, archives, or marks messages as read. Raw Graph URLs, raw OData, and unrestricted Graph requests are not exposed.

Requirements

  • Windows with Microsoft Edge
  • Node.js 22+
  • A Microsoft 365 work or school account with Exchange Online
  • Delegated Mail.ReadWrite permission

Personal Microsoft accounts are disabled by default. Shared mailboxes additionally require Exchange delegation and Mail.ReadWrite.Shared.

Install

git clone https://github.com/hanhandly/graph-mail-mcp.git
Set-Location graph-mail-mcp
npm ci
npm run build
Copy-Item config.example.json config.local.json

config.local.json is ignored by Git. Review it before authentication, especially tenant, allowedMailboxScopes, and shared-mailbox settings.

Authenticate

node dist\cli.js -c config.local.json doctor
node dist\cli.js -c config.local.json auth login --account-hint user@contoso.com
node dist\cli.js -c config.local.json auth status

Login opens an isolated Microsoft Edge profile and uses Graph Explorer for delegated authentication. Playwright clicks Sign in, selects the hinted account, and checks whether the required mail permission is already consented. If it is, authentication continues automatically; otherwise the CLI tells the user which permission must be granted. Playwright never clicks Consent. MFA and consent confirmation remain user-controlled. auth status returns metadata, unexpected-scope warnings, and a next action, but never displays the token.

Graph Explorer can return permissions previously granted to its shared application. The default unexpectedTokenScopePolicy: "warn" keeps the local workflow usable while reporting scopes beyond the configured mail and sign-in allowlist. Set it to "reject" for strict environments; a dedicated app registration is the recommended way to obtain a genuinely least-privilege token.

Configure an MCP client

Use absolute paths in the client's MCP configuration:

{
  "mcpServers": {
    "graph-mail": {
      "command": "node",
      "args": [
        "C:\\Tools\\graph-mail-mcp\\dist\\cli.js",
        "-c",
        "C:\\Tools\\graph-mail-mcp\\config.local.json",
        "serve"
      ],
      "cwd": "C:\\Tools\\graph-mail-mcp"
    }
  }
}

Some clients use a different outer key, but the command, args, and cwd values are the same. Keep -c <config-path> before serve. The server uses stdio and does not open a network port.

Restart the MCP client, then call:

  1. mail_auth_status
  2. mail_list_folders
  3. mail_search_messages

Tools

Area Tools
Authentication and folders mail_auth_status, mail_list_folders
Search and read mail_search_messages, mail_get_message, mail_get_thread
Attachments mail_list_attachments, mail_get_attachment
Managed drafts mail_create_draft, mail_update_draft

Draft updates are limited to drafts created and registered by this MCP. There is no send tool.

bodyMode is enforced consistently: none omits body content and previews, preview returns bodyPreview, and text or html returns the message body. Responses are bounded by maxMessageBodyCharacters per message and maxTotalBodyCharacters overall; truncated messages carry bodyTruncated: true and the response provenance records the limit.

Security

The Graph transport uses a deny-by-default policy firewall and typed request compiler. Tokens are stored outside the repository and protected with Windows DPAPI by default. Logs and tool responses must not expose access tokens, cookies, or authorization headers.

The server accepts delegated tokens only, always rejects Mail.Send, reports unexpected scopes by default, and can reject them in strict mode. Its request firewall limits runtime operations, but deployments requiring a strictly least-privilege bearer token should use a dedicated app registration or constrained authentication provider.

See Security, Tool reference, Configuration example, and Architecture.

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured