Skip to main content
Glama

Microsoft 365 MCP 个人助理服务 (v0.1.0)

这是一个基于 Model Context Protocol (MCP) 标准构建的个人生产力助手。通过直接集成 Microsoft Graph API,它赋予大语言模型(LLM)管理您 Microsoft 365 账户(日历、待办事项、电子邮件)的能力。

🎯 定位:私密、安全、高效

本服务专为个人使用优化,移除了所有可能导致意外向外部发送信息的复杂功能(如会议邀请、参与者管理、线上会议创建),确保 LLM 作为一个纯粹的“个人秘书”在您的私有域内工作。


Related MCP server: Microsoft Graph MCP Server

🌟 核心特性

1. 深度个人化集成

  • 日历 (Calendar): 增删改查个人日程。支持查询忙闲状态(自动锁定当前用户),支持自定义提醒设置。

  • 待办 (Tasks): 完整支持 Microsoft To Do。可管理截止日期、优先级、分类及提醒。

  • 邮件 (Email): 快速查阅收件箱、发送个人邮件、清理过期邮件。

2. 完美的时区方案 (UTC+8)

  • 原生东八区支持: 服务器在请求头中硬编码 Prefer: outlook.timezone="China Standard Time",确保所有返回的时间数据均为北京时间。

  • 时区禁转原则: 通过系统提示词严格限制 LLM 进行 UTC 转换,杜绝因时区计算错误导致的日程偏移。

3. 智能任务规划

  • 提示词优化: 针对中文大模型优化的全中文指令集。

  • 工具引导: 强制 LLM 在查询“是否有空”时优先使用 get_user_schedules 而非低效的列表扫描。

  • 动态适配: 根据您启用的模块(日历/任务/邮件),自动调整 LLM 的系统指令。


🚀 快速开始

1. Azure 应用注册 (必选)

  1. 访问 Azure Portal 并创建一个新应用。

  2. 应用类型选择:Mobile and desktop applications。

  3. 添加重定向 URI:https://login.microsoftonline.com/common/oauth2/nativeclient。

  4. 在 API 权限 中添加以下 Delegated 权限:

    • User.Read

    • Calendars.ReadWrite

    • Tasks.ReadWrite

    • Mail.ReadWrite

    • Mail.Send

2. 本地安装与认证 (必须先执行一次)

无论使用哪种运行方式,您都必须先在本地完成首次认证以生成 Token 文件。

# 克隆仓库
git clone https://github.com/xyz50270/Microsoft-Calendar-MCP.git
cd Microsoft-Calendar-MCP

# 安装依赖
uv pip install -e .

# 执行交互式认证 (根据提示在浏览器登录)
uv run m365-auth

3. 配置 MCP 客户端 (以 Claude Desktop 为例)

方案 A: 通过 GitHub 地址直接运行 (推荐)

这种方式由 uv 自动管理环境,无需手动进入目录。

{
  "mcpServers": {
    "m365": {
      "command": "uv",
      "args": [
        "run",
        "--with", "git+https://github.com/xyz50270/Microsoft-Calendar-MCP.git",
        "m365-mcp"
      ],
      "env": {
        "MS_GRAPH_CLIENT_ID": "您的 Azure 客户端 ID",
        "MS_GRAPH_TOKEN_PATH": "C:/Users/您的用户名/graph_token.json",
        "MS_GRAPH_REDIRECT_URI": "https://login.microsoftonline.com/common/oauth2/nativeclient",
        "ENABLE_CALENDAR": "true",
        "ENABLE_TASKS": "true",
        "ENABLE_EMAIL": "true"
      }
    }
  }
}

方案 B: 本地源码运行

指向您克隆到本地的代码目录。这是开发调试最常用的方式。

{
  "mcpServers": {
    "m365": {
      "command": "uv",
      "args": [
        "--directory", "F:/develop/Microsoft-Calendar-MCP",
        "run",
        "m365-mcp"
      ],
      "env": {
        "MS_GRAPH_CLIENT_ID": "您的 Azure 客户端 ID",
        "MS_GRAPH_TOKEN_PATH": "F:/develop/Microsoft-Calendar-MCP/graph_token.json",
        "MS_GRAPH_REDIRECT_URI": "https://login.microsoftonline.com/common/oauth2/nativeclient"
      }
    }
  }
}

⚙️ 环境变量配置

变量名

说明

默认值

MS_GRAPH_CLIENT_ID

Azure 应用客户端 ID

必填

MS_GRAPH_TOKEN_PATH

Token 缓存文件的绝对路径

graph_token.json

MS_GRAPH_REDIRECT_URI

注册时填写的重定向 URI

https://login.microsoftonline.com/...

ENABLE_CALENDAR

是否启用日历模块

true

ENABLE_TASKS

是否启用待办模块

true

ENABLE_EMAIL

是否启用邮件模块

true


🛠️ 工具箱 (Tools)

📅 日历

  • list_calendar_events: 列出日程。

  • create_calendar_event: 创建日程(支持设置 reminder_minutes)。

  • update_calendar_event: 修改日程。

  • delete_calendar_event: 删除日程。

  • get_user_schedules: [推荐] 查询自己是否有空。

✅ 待办 (To Do)

  • list_tasks: 查看待办列表。

  • create_task: 新建任务(支持 due_date, importance, reminder_date)。

  • update_task: 更新任务状态或内容。

  • complete_task: 快速完成任务。

  • delete_task: 删除任务。

📧 邮件

  • list_emails: 查看最近邮件。

  • send_email: 发送邮件。

  • delete_email: 删除邮件。

⚙️ 系统

  • get_current_time: 获取当前精确的本地时间(LLM 处理相对时间的前提)。


💡 使用建议

为了获得最佳体验,建议在与 LLM 对话开始时输入:

“请先获取 m365-assistant 提示词,并检查我当前的时间。”

这会让 LLM 明确:

  1. 哪些工具当前可用。

  2. 必须遵守 ISO 8601 格式和 UTC+8 时区。

  3. 在处理日程冲突时优先调用忙闲查询工具。


🔒 安全说明

  • secrets.dat: 该文件包含加密的开发环境配置,仅供内部开发使用。

  • Token 安全: graph_token.json 包含您的访问凭据,请确保其路径安全且不被上传至公开仓库。

📄 开源协议

MIT

Available Tools

14 tools
complete_taskC

将任务标记为已完成。

参数: task_id (str): 待完成任务的唯一 ID。

Inputs: task_id (required).

create_calendar_eventA

在主日历中创建新日程 (UTC+8)。

参数: subject (str): 日程标题。 start (str): 开始时间。ISO 8601 格式 (如 '2025-12-25T09:00:00')。必须是本地时间。 end (str): 结束时间。ISO 8601 格式 (如 '2025-12-25T10:00:00')。必须是本地时间。 body (str, 可选): 日程内容描述。 body_type (str, 可选): 内容类型,可选 'Text' 或 'HTML'。默认为 'HTML'。 location (str, 可选): 地点名称。 is_all_day (bool, optional): 是否为全天事件。默认为 False。 importance (str, optional): 重要程度:'low' (低), 'normal' (普通), 'high' (高)。默认为 'normal'。 categories (List[str], optional): 关联的分类名称列表。 is_reminder_on (bool, optional): 是否设置提醒。默认为 True。 reminder_minutes (int, optional): 开始前多少分钟发出提醒。默认为 15。

Inputs: end (required), start (required), subject (required), body, +7 more.

create_taskA

在 Microsoft To Do 中创建新任务 (UTC+8)。

参数: title (str): 任务标题。 body (str, 可选): 任务内容描述。 body_type (str, 可选): 'text' (纯文本) 或 'html'。默认为 'text'。 categories (List[str], 可选): 任务关联的分类。 due_date (str, 可选): 截止日期。ISO 8601 格式 (如 '2025-12-31T23:59:59')。必须是东八区本地时间 (UTC+8)。 start_date (str, 可选): 开始日期。ISO 8601 格式。必须是东八区本地时间 (UTC+8)。 reminder_date (str, 可选): 提醒日期/时间。ISO 8601 格式。必须是东八区本地时间 (UTC+8)。 importance (str, 可选): 重要程度:'low' (低), 'normal' (普通), 'high' (高)。 status (str, 可选): 任务状态:'notStarted', 'inProgress', 'completed', 'waitingOnOthers', 'deferred'。 completed_date (str, 可选): 任务完成日期。ISO 8601 格式。必须是东八区本地时间 (UTC+8)。

Inputs: title (required), body, status, due_date, +6 more.

delete_calendar_eventC

删除日历事件。

参数: event_id (str): 待删除事件的唯一 ID。

Inputs: event_id (required).

delete_emailC

删除电子邮件。

参数: message_id (str): 待删除邮件的唯一 ID。

Inputs: message_id (required).

delete_taskC

删除任务。

参数: task_id (str): 待删除任务的唯一 ID。

Inputs: task_id (required).

get_current_timeA

获取当前本地时间 (UTC+8)。处理相对时间请求时,请【必须】先调用此工具以获取参考时间。

Inputs: no named parameters.

get_user_schedulesA

[首选] 检查当前用户在特定时间段内是否有空 (UTC+8)。 当用户询问“我是否有空?”、“是否有冲突?”或“检查我的忙闲”时,请务必【优先】使用此工具而非 list_calendar_events。 它能更高效、更直观地提供时间段的占用情况。

参数: start (str): 查询范围的开始时间。ISO 8601 格式 (如 '2025-12-23T00:00:00')。必须是本地时间。 end (str): 查询范围的结束时间。ISO 8601 格式 (如 '2025-12-23T23:59:59')。必须是本地时间。 availability_view_interval (int, 可选): 响应中每个时间槽的持续分钟数。默认为 30。

Inputs: end (required), start (required), availability_view_interval.

list_calendar_eventsA

列出用户主日历中的事件。 [注意] 调用前请务必先执行 get_current_time 获取当前时间。 [时区] 所有日期字符串必须使用本地时间 (UTC+8)。

参数: start_date (str, 可选): 查询范围的开始时间。ISO 8601 格式 (如 '2025-12-23T00:00:00')。必须是本地时间。 end_date (str, 可选): 查询范围的结束时间。ISO 8601 格式 (如 '2025-12-23T23:59:59')。必须是本地时间。

Inputs: end_date, start_date.

list_emailsB

列出收件箱中的最近邮件 (UTC+8)。

参数: limit (int, 可选): 返回邮件的最大数量。默认为 10。

Inputs: limit.

list_tasksB

列出用户默认待办事项列表中的任务。

Inputs: no named parameters.

send_emailC

发送电子邮件。

参数: to (str): 收件人邮箱地址。 subject (str): 邮件主题。 body (str): 邮件正文内容。

Inputs: to (required), body (required), subject (required).

update_calendar_eventA

更新现有的日历事件 (UTC+8)。仅更新提供的字段。

参数: event_id (str): 待更新事件的唯一 ID。 subject (str, 可选): 新标题。 start (str, 可选): 新开始时间 (ISO 8601)。必须是本地时间。 end (str, 可选): 新结束时间 (ISO 8601)。必须是本地时间。 body (str, 可选): 新内容描述。 body_type (str, 可选): 'Text' 或 'HTML'。 location (str, 可选): 新地点。 is_all_day (bool, 可选): 是否更新为全天事件。 importance (str, 可选): 重要程度:'low', 'normal', 'high'。 categories (List[str], 可选): 新的分类列表。 is_reminder_on (bool, 可选): 是否开启提醒。 reminder_minutes (int, 可选): 提醒提前分钟数。

Inputs: event_id (required), end, body, start, +8 more.

update_taskB

更新 Microsoft To Do 中现有的任务 (UTC+8)。

参数: task_id (str): 待更新任务的唯一 ID。 title (str, 可选): 新标题。 body (str, 可选): 新内容描述。 body_type (str, 可选): 'text' 或 'html'。 categories (List[str], 可选): 新分类列表。 due_date (str, 可选): 新截止日期 (ISO 8601)。必须是东八区本地时间 (UTC+8)。 start_date (str, 可选): 新开始日期 (ISO 8601)。必须是东八区本地时间 (UTC+8)。 reminder_date (str, 可选): 新提醒日期 (ISO 8601)。必须是东八区本地时间 (UTC+8)。 importance (str, 可选): 'low', 'normal', 'high'。 status (str, 可选): 'notStarted', 'inProgress', 'completed' 等。 completed_date (str, 可选): 新完成日期 (ISO 8601)。必须是东八区本地时间 (UTC+8)。

Inputs: task_id (required), body, title, status, +7 more.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    B3.3/5.0

    Scored across 14 tools

    Disambiguation4/5

    Calendar and task CRUD tools are clearly separated by resource and action. However, complete_task overlaps with update_task (which can set status to completed), and list_calendar_events overlaps with get_user_schedules for schedule queries, creating minor ambiguity.

    Naming Consistency5/5

    All tool names use consistent snake_case verb_noun patterns (list_*, create_*, update_*, delete_*, get_*). Minor pluralization differences (list_calendar_events vs update_calendar_event) follow common conventions.

    Tool Count5/5

    14 tools cover calendar, tasks, email, and time, which is well within the ideal 3-15 range. No tool appears redundant or trivial.

    Completeness3/5

    Calendar and task surfaces provide create/list/update/delete, but lack get-by-id. Email coverage is notably thin: only list, send, and delete; missing read/get by ID, reply, forward, mark read, and update operations, which are core to an email domain.

    Maintenance

    ActivityInactive
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      D
      maintenance
      Enables AI agents to interact with Microsoft Outlook via the Microsoft Graph API for managing emails and calendar events. It allows users to read and send emails, list messages, and create calendar appointments with automatic Teams links.
      1
      ISC
    • -
      license
      Not graded
      quality
      Not graded
      maintenance
      Provides access to Microsoft Teams, Outlook, Calendar, and SharePoint via the Microsoft Graph API, enabling natural language interactions to read and manage messages, emails, events, and files.
      1
      -