Microsoft MCP

Microsoft MCP

A powerful MCP server that enables AI assistants to interact with Microsoft Graph API for managing Outlook emails, Calendar events, OneDrive files, and Contacts through natural language commands.

Category
访问服务器

Tools

list_accounts

List all signed-in Microsoft accounts

read_emails

Read emails from any folder (set include_body=False for subject/sender only)

get_email

Get full email details including attachments list

reply_to_email

Reply to an email maintaining thread context

mark_email_read

Mark email as read or unread

move_email

Move email to another folder (drafts, sentitems, deleteditems, etc)

download_attachment

Download email attachment as base64

send_email

Send email with optional CC and attachments (attachments = [{"name": "file.txt", "content_base64": "..."}])

get_calendar_events

Get calendar events with full details

check_availability

Check free/busy availability for scheduling

create_event

Create calendar event with full details

update_event

Update existing calendar event

delete_event

Delete/cancel calendar event

respond_to_event

Respond to meeting invitation (accept, decline, tentativelyAccept)

get_contacts

Get contacts/people with email addresses

list_files

List files with pagination support (returns items and @odata.nextLink)

download_file

Download file content as base64

upload_file

Upload file to OneDrive

delete_file

Delete file or folder

search

Search across emails, files, events, and people

README

Microsoft MCP

Powerful MCP server for Microsoft Graph API - a complete AI assistant toolkit for Outlook, Calendar, OneDrive, and Contacts.

Features

  • Email Management: Read, send, reply, manage attachments, organize folders
  • Calendar Intelligence: Create, update, check availability, respond to invitations
  • OneDrive Files: Upload, download, browse with pagination
  • Contacts: Search and list contacts from your address book
  • Multi-Account: Support for multiple Microsoft accounts (personal, work, school)
  • Unified Search: Search across emails, files, events, and people

Quick Start with Claude Desktop

# Add Microsoft MCP server (replace with your Azure app ID)
claude mcp add microsoft-mcp -e MICROSOFT_MCP_CLIENT_ID=your-app-id-here -- uvx --from git+https://github.com/elyxlz/microsoft-mcp.git microsoft-mcp

# Start Claude Desktop
claude

Usage Examples

# Email examples
> read my latest emails with full content
> reply to the email from John saying "I'll review this today"
> send an email with attachment to alice@example.com

# Calendar examples  
> show my calendar for next week
> check if I'm free tomorrow at 2pm
> create a meeting with Bob next Monday at 10am

# File examples
> list files in my OneDrive
> upload this report to OneDrive
> search for "project proposal" across all my files

# Multi-account
> list all my Microsoft accounts
> send email from my work account

Available Tools

Email Tools

  • read_emails - Read emails with full body content
  • get_email - Get specific email with attachments
  • reply_to_email - Reply maintaining thread context
  • send_email - Send with CC/BCC and attachments
  • mark_email_read - Mark emails as read/unread
  • move_email - Move between folders
  • download_attachment - Download email attachments

Calendar Tools

  • get_calendar_events - List events with full details
  • check_availability - Check free/busy times
  • create_event - Create with location and attendees
  • update_event - Reschedule or modify events
  • delete_event - Cancel events
  • respond_to_event - Accept/decline invitations

Contact & File Tools

  • get_contacts - Search or list contacts
  • list_files - Browse OneDrive with pagination
  • upload_file - Upload files to OneDrive
  • download_file - Download file content
  • delete_file - Delete files or folders

Utility Tools

  • search - Universal search across all services
  • list_accounts - Show authenticated accounts

Manual Setup

1. Azure App Registration

  1. Go to Azure Portal → Microsoft Entra ID → App registrations
  2. New registration → Name: microsoft-mcp
  3. Supported account types: Personal + Work/School
  4. Authentication → Allow public client flows: Yes
  5. API permissions → Add these delegated permissions:
    • Mail.ReadWrite
    • Calendars.ReadWrite
    • Files.ReadWrite
    • Contacts.Read
    • People.Read
    • User.Read
  6. Copy Application ID

2. Installation

git clone https://github.com/elyxlz/microsoft-mcp.git
cd microsoft-mcp
uv sync

3. Authentication

# Set your Azure app ID
export MICROSOFT_MCP_CLIENT_ID="your-app-id-here"

# Run authentication script
uv run authenticate.py

# Follow the prompts to authenticate your Microsoft accounts

4. Claude Desktop Configuration

Add to your Claude Desktop configuration:

macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
Windows: %APPDATA%\Claude\claude_desktop_config.json

{
  "mcpServers": {
    "microsoft": {
      "command": "uvx",
      "args": ["--from", "git+https://github.com/elyxlz/microsoft-mcp.git", "microsoft-mcp"],
      "env": {
        "MICROSOFT_MCP_CLIENT_ID": "your-app-id-here"
      }
    }
  }
}

Or for local development:

{
  "mcpServers": {
    "microsoft": {
      "command": "uv",
      "args": ["--directory", "/path/to/microsoft-mcp", "run", "microsoft-mcp"],
      "env": {
        "MICROSOFT_MCP_CLIENT_ID": "your-app-id-here"
      }
    }
  }
}

Multi-Account Support

All tools support an optional account_id parameter:

# Use default account
send_email("user@example.com", "Subject", "Body")

# Use specific account  
send_email("user@example.com", "Subject", "Body", account_id="account-id-here")

# List accounts to get IDs
list_accounts()

Development

# Run tests
uv run pytest tests/ -v

# Type checking
uv run pyright

# Format code
uvx ruff format .

# Lint
uvx ruff check --fix --unsafe-fixes .

Example: AI Assistant Scenarios

Smart Email Management

# Read latest emails with full content
emails = read_emails(count=10, include_body=True)

# Reply maintaining thread
reply_to_email(email_id, "Thanks for your message. I'll review and get back to you.")

# Forward with attachments
email = get_email(email_id)
attachments = [download_attachment(email_id, att["id"]) for att in email["attachments"]]
send_email("boss@company.com", f"FW: {email['subject']}", email["body"]["content"], attachments=attachments)

Intelligent Scheduling

# Check availability before scheduling
availability = check_availability("2024-01-15T10:00:00Z", "2024-01-15T18:00:00Z", ["colleague@company.com"])

# Create meeting with details
create_event(
    "Project Review",
    "2024-01-15T14:00:00Z", 
    "2024-01-15T15:00:00Z",
    location="Conference Room A",
    body="Quarterly review of project progress",
    attendees=["colleague@company.com", "manager@company.com"]
)

Security Notes

  • Tokens are cached locally in ~/.microsoft_mcp_token_cache.json
  • Use app-specific passwords if you have 2FA enabled
  • Only request permissions your app actually needs
  • Consider using a dedicated app registration for production

Troubleshooting

  • Authentication fails: Check your CLIENT_ID is correct
  • "Need admin approval": Use MICROSOFT_MCP_TENANT_ID=consumers for personal accounts
  • Missing permissions: Ensure all required API permissions are granted in Azure
  • Token errors: Delete ~/.microsoft_mcp_token_cache.json and re-authenticate

License

MIT

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选