onenote-mcp
onenote-mcp
一个本地的 MCP 服务器,让 Claude 能够阅读你的 OneNote 笔记本,包括你粘贴到其中的图片。
它通过 COM 接口与 OneNote 桌面应用对话。无需注册 Azure 应用,也无需租户同意。没有任何数据会离开本机。
为什么存在
Microsoft 365 连接器不支持 OneNote。它会报错:mime type 'application/msonenote' is not allowed。每一条 Graph API 路由都需要注册 Entra 应用并申请 Notes.ReadWrite.All 权限;在企业租户中,这通常意味着要提交一次 IT 请求。而桌面版 COM API 两者都不需要。
Related MCP server: MCP OneNote Server
它能做什么
搜索所有已打开的笔记本,包括粘贴的截图中的文字,因为 OneNote 自己的索引就包含 OCR。
以文本形式读取页面,并列出其上的图片。
以图片形式返回这些图片,并缩小到适合在对话记录中展示的尺寸。
它是只读的,不能修改、创建、删除任何内容。
环境要求
已安装 OneNote 桌面应用 的 Windows。
Microsoft Store 里的 OneNote 应用是另一个程序,没有 COM 接口。Python 3.11 或更高版本,位数不限。
安装
python -m venv .venv
.venv\Scripts\python.exe -m pip install -e .注册
当前文件夹中的 .mcp.json 会为当前项目注册这个服务器。若要让它处处可用:
claude mcp add onenote -s user -- C:\path\to\onenote_COM_mcp\.venv\Scripts\python.exe -m onenote_mcp.server这条命令同样适用于 Claude Desktop 与 VS Code 扩展。
工具
工具 | 作用 |
| 列出已打开的笔记本及其分区,并标明各笔记本是个人笔记本,还是位于共享团队站点上 |
| 列出笔记本、分区组或分区下的页面 |
| 搜索与查询匹配的页面,可搜索全部内容或某个范围 |
| 以文本形式返回单页内容及其图片清单,不包含任何像素数据 |
| 按索引返回图片,并缩小到 |
get_page 与 get_page_images 刻意彼此分开。一个页面可能装下十几张全尺寸截图,而读取页面文本时,不应把它们全部拖入对话。
当你想获取 OneNote 在图片中识别出的文字时,可让 get_page 返回 include_ocr,通常仅凭文字就已足够回答问题,完全不必去取图片。
第一次调用较慢
服务器在首次工具调用之前不会联系 OneNote。若此时 OneNote 未打开,该调用会先启动它,因此需要耗一点时。之后的调用很快:读取一个包含十个页面的分区大约只需两秒。
开发
.venv\Scripts\python.exe -m pytest # no OneNote needed
.venv\Scripts\python.exe tools\smoke.py # live check, needs OneNote在修改 com.py 前,请先阅读 CLAUDE.md。COM 接口有两个陷阱,要找出来需花掉一整天,其中一个还会杀掉 OneNote 进程。
This server cannot be deployed
Maintenance
Related MCP Connectors
Connect Claude to your Platform7n workspaces: chat, links, work and decks. One-click OAuth.
Your own memory inside ChatGPT and Claude, with the source of every note.
11Connect ChatGPT, Claude, Cursor or VS Code to your Windows PC: files, terminal, browser, apps.
Notes, tasks, habits, journal and 6 more tools Claude can read and change, with undo. Free.
Related MCP Servers
- FlicenseAqualityDmaintenanceEnables Claude to read and write to local Microsoft OneNote notebooks by parsing backup files and utilizing the OneNote COM API. It allows for searching notes, creating pages, and appending content without requiring Azure registration or API keys.104-
- FlicenseAqualityDmaintenanceEnables AI agents to read, create, and analyze Microsoft OneNote notebooks, sections, and pages, including automatic image text extraction via Claude Vision.71-
- AlicenseNot gradedqualityBmaintenanceGives Claude direct access to local Microsoft OneNote notebooks, enabling reading from backups and live via COM automation, plus writing sections and pages without a Microsoft account or API key.MIT
- AlicenseAqualityCmaintenanceEnables Claude to browse, search, and read Microsoft OneNote notebooks and pages as clean markdown, including viewing screenshots and images at high resolution or zoomed into regions. It also lets users collect pages into reports and write, append, or edit pages, sections, and notebooks, and export original-resolution images and attachments locally.1420 npm2MIT