onenote-mcp-python

onenote-mcp-python

A standalone Model Context Protocol server for Microsoft OneNote desktop, connecting via the Windows COM API through a PowerShell bridge to enable page CRUD, search, export, and organization tools without an API key.

Category
访问服务器

README

OneNote MCP (Python)

A standalone Model Context Protocol server for Microsoft OneNote desktop, written in Python. It connects to OneNote through its Windows COM API via a bundled PowerShell bridge and does not require an API key or an embedded AI provider.

Requirements

  • Windows
  • Microsoft OneNote desktop from Office (comes with Microsoft 365; not the Store app), with at least one notebook open
  • Python 3.11+ and uv — install uv with:
powershell -c "irm https://astral.sh/uv/install.ps1 | iex"

(uv manages Python itself, so a separate Python install is not required.)

Quickstart

git clone https://github.com/eddyficial/onenote-mcp-python.git
cd onenote-mcp-python
uv sync
uv run onenote-mcp-setup

onenote-mcp-setup configures Codex, Claude Desktop, and Claude Code in one shot, preserving unrelated MCP entries. Preview with --dry-run, or target one client with --client codex, claude-desktop, or claude-code (--client claude covers both Claude clients). Reload the client and the onenote_* tools appear.

Run manually

uv run onenote-mcp

The server speaks MCP over stdio; all diagnostics go to stderr.

Connect an MCP client by hand

If you'd rather not use the setup command:

Claude Desktop

Add to %APPDATA%\Claude\claude_desktop_config.json:

{
  "mcpServers": {
    "onenote": {
      "command": "uv",
      "args": ["--directory", "C:\\path\\to\\onenote-mcp-python", "run", "onenote-mcp"]
    }
  }
}

Claude Code

claude mcp add onenote -- uv --directory C:\path\to\onenote-mcp-python run onenote-mcp

Codex

Add to %USERPROFILE%\.codex\config.toml:

[mcp_servers.onenote]
command = "uv"
args = ["--directory", "C:\\path\\to\\onenote-mcp-python", "run", "onenote-mcp"]

Capabilities

The server exposes 27 onenote_* tools covering hierarchy, page CRUD, search, organization, rich content, export, safe deletion, knowledge digests, action and decision extraction, duplicate and stale-page health checks, weekly review source packs, and preview-first templates.

Tool What it does
onenote_hierarchy List notebooks, section groups, sections, and pages with IDs
onenote_get_page Read a page's title and flattened text
onenote_search Full-text search across pages
onenote_knowledge_digest Source-grounded executive/detailed digest across a scope
onenote_extract_insights Extract action items, owners, due dates, decisions, risks, questions
onenote_health_report Audit duplicates, stale/untitled/empty pages, ownerless actions
onenote_template_preview Preview a trusted page template (read-only)
onenote_create_from_template Create a page from a template (preview-first)
onenote_weekly_review Build a weekly-review source pack (read-only)
onenote_create_page Create a page in a section
onenote_append_page Append text to a page
onenote_update_page Replace or append a page's body
onenote_insert_rich_content Append XHTML fragments and/or images
onenote_rename_page Set a page's title
onenote_move_page Move a page to another section (returns new page ID)
onenote_reorder_pages Change page order within a section
onenote_create_section Create a section
onenote_create_section_group Create a section group
onenote_create_notebook Create a notebook
onenote_rename_section Rename a section
onenote_move_section Move a section to another parent
onenote_reorder_sections Change section tab order
onenote_navigate Open an object in the visible OneNote window
onenote_export Export a page/section to pdf, html, docx, mhtml, xps, or onenote
onenote_delete_page Delete a page (recycle bin by default)
onenote_delete_section Delete a section (recycle bin by default)
onenote_delete_notebook Delete/close a notebook (recycle bin by default)

Why a PowerShell bridge instead of pywin32?

With x64 Click-to-Run Office, the OneNote COM typelib is registered only under the Win32 registry key, so 64-bit Python COM dispatch (pywin32/comtypes) fails with TYPE_E_LIBNOTREGISTERED. .NET's COM binder is unaffected, so the server spawns bridge\onenote_bridge.ps1 once (powershell.exe -NoProfile -NonInteractive -ExecutionPolicy Bypass -File ...) and speaks a small JSON-lines RPC over its stdio: {id, op, args} requests, {id, ok, result, error} responses, with a 60-second per-call timeout. The bridge is the single canonical COM path.

Cloud notebooks caveat

onenote_create_notebook without a path lets OneNote choose its default location, which on modern installs is OneDrive cloud. A just-created cloud notebook can reject immediate writes with COM error 0x80042030 until it syncs. For reliable scripted workflows, pass an absolute local path (e.g. C:\Users\you\Documents\Notebooks) — local notebooks accept section and page writes instantly.

Safety

  • Template creation previews by default.
  • Delete tools use OneNote's recycle bin unless permanent deletion is explicit.
  • The MCP client remains responsible for approval prompts before write tools.

Test

uv run pytest

Other implementations

Same 27 tools, same schemas — pick your runtime:

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 模型以安全和受控的方式获取实时的网络信息。

官方
精选