onenote-mcp
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@onenote-mcp search my OneNote pages for meeting notes"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
onenote-mcp
A Model Context Protocol server that lets Claude (Claude Code, Claude Desktop, or any MCP client) read and write your Microsoft OneNote notebooks through Microsoft Graph.
No Azure app registration. It signs in as you with Microsoft's public "Microsoft Graph Command Line Tools" client, using device-code login.
Tokens stay on your machine: in the macOS Keychain, or in a
0600file on Linux and Windows. They refresh automatically.Guardrail: block sections, section groups or pages from every tool, or make them read-only. Rules match ids, names (with wildcards) or paths.
Export: pages and whole sections to Markdown, HTML, plain text, JSON or PDF, with their images and files.
Versioning: a snapshot of each page is saved before every change and on a schedule, kept for 30 days, and can be restored with images and files.
Safety switches: read-only mode, page deletion that stays off unless you turn it on, and an optional audit log.
Tools
Each tool tells your MCP client whether it only reads, writes, or can destroy content, so clients can ask before risky actions.
Notebooks and structure
Tool | What it does |
| Full tree of every notebook: nested section groups and sections, with ids, default/shared flags and links |
| Recently opened notebooks, with last-access time and links |
| Create a notebook (or return the existing one) |
| Create a section group in a notebook or nested inside another group |
| Every section, including those inside section groups, optionally for one notebook |
| Create a section in a notebook or a section group |
| Copy a section and all its pages into another notebook or section group |
Pages
Tool | What it does |
| Pages in a section, with indent level and order; choose sort order and limit |
| Search page titles in one section, one notebook, or everywhere |
| Page details: section, notebook, links and a short text preview |
| Full page as HTML (optionally with element ids for precise edits), Markdown or plain text |
| New page from HTML, with tags, web images and local images/files |
| Edit in place: rename, replace/insert/append/prepend at any element, tick to-dos, add attachments (saves a version first) |
| Append HTML (and attachments) to the end of a page (saves a version first) |
| Copy a page with its images and files to another section (copy + delete = move) |
| Delete a page (only when |
| Save an image or attached file from a page to disk |
| Check a background copy (work/school accounts) |
| Show the server's active settings |
Export
Tool | What it does |
| Save a page as Markdown, HTML, text, JSON or PDF, with its images and files |
| Save every page in a section, one file per page (plus an index) or one combined file |
Versions
Tool | What it does |
| Save a version of every changed page in a section, a notebook, or everywhere |
| A page's saved versions, or every page with versions (including deleted pages) |
| Read a saved version as HTML, Markdown or text |
| Recreate a saved version, with its images and files, as a new page |
Sections are identified by sectionId, or by notebook + section names (+ sectionGroup for a section inside a group). With ONENOTE_DEFAULT_NOTEBOOK and ONENOTE_DEFAULT_SECTION set, you can leave them out.
Page content tips
Tags:
<p data-tag="to-do">Buy milk</p>. Other tags:to-do:completed,important,question,idea,critical,contact,remember-for-later,definition,highlight, and more.Ticking a to-do: give the line a
data-idwhen you create it, thenupdate_pagewith{target: "#my-id", action: "replace", content: "<p data-tag=\"to-do:completed\" data-id=\"my-id\">Done</p>"}.Images from the web:
<img src="https://..." />. OneNote downloads and embeds them.Local images and files: pass
attachments: [{ path: "~/Pictures/chart.png" }]. Reference them asname:file1, or leave them unreferenced and they're added at the end.Renaming a page:
update_pagewith{target: "title", action: "replace", content: "New title"}.
What Microsoft Graph doesn't support
These OneNote features aren't available through Graph, so no OneNote MCP server can provide them (page version history is one of them, which is why this server keeps its own; see Versioning):
OneNote app settings (themes, sync options, proofing, etc.)
Renaming or deleting notebooks, section groups or sections (pages can be renamed and deleted)
Setting a page's indent level or order, section colors, or page templates
Ink/drawings as editable strokes, audio recording, password-protected sections
On personal Microsoft accounts, Graph's built-in copy isn't available. copy_page and copy_section copy content by hand instead (read → download images/files → recreate). The result is the same content, but the copy has a new created date.
Related MCP server: MCP OneNote Server
Exporting pages and sections
export_page and export_section write files to ONENOTE_EXPORT_DIR (default ~/Downloads), or to the path you give. Without an explicit file path they never overwrite: a second export becomes Name (2).md.
Format | Output |
| YAML front matter (title, id, notebook, section, dates, link), then the page. To-dos become |
| A standalone page that opens in any browser (OneNote's absolute positioning removed, to-do boxes shown) |
| Plain text with |
| Page metadata plus its HTML and Markdown, for scripts |
| Printed by a local Chrome, Edge, Chromium or Brave in headless mode (set |
Images and attached files (resources):
download(default): saved in<name>_files/next to the export (orassets/in a section folder), with relative links.inline: embedded asdata:URIs, so one file holds everything. PDF always does this.none: left out. Attachments still show their file name.
export_section writes <Section>/ with one file per page in section order and an index.md / index.html. With combine: true it writes a single <Section>.<ext> instead. Pages blocked by the guardrail are left out.
Versioning
Microsoft Graph has no version history for OneNote pages, so the server keeps its own:
Before every change made through the server (
update_page,append_to_page,delete_page), it saves the page as it was.delete_pagerefuses to delete if that snapshot fails.For every page in every section, on demand with
snapshot_pages, or on a schedule withnpm run snapshot. Only pages whose modified time changed since their last version are downloaded, and identical content is never stored twice.
Each version stores the page HTML plus its images and files, so restore_page_version brings the page back complete, as a new page in its original section (or one you choose). The current page is left alone; delete it afterwards if the restored copy should replace it. Deleted pages can be restored too: find them with list_page_versions without a pageId.
Retention: versions older than ONENOTE_VERSION_RETENTION_DAYS (default 30) are deleted on each snapshot run and when the server starts. The newest version of a page that still exists is always kept, because it matches the page as it is now. Versions of deleted pages age out fully after 30 days.
Where: ~/.local/share/onenote-mcp/versions (or $XDG_DATA_HOME/onenote-mcp/versions, or ONENOTE_VERSION_DIR). Folders are 0700 and files 0600, but the content is not encrypted, so treat this folder like the notebook itself. Blocked sections and pages are never snapshotted.
Scheduling snapshots
npm run snapshot snapshots every section the guardrail allows, prints a one-line summary and exits (--notebook, --section and --force narrow or widen it). It reads the same environment variables as the server, so pass your guardrail settings to it too.
macOS (launchd), hourly. Save as ~/Library/LaunchAgents/com.onenote-mcp.snapshot.plist, then run launchctl load ~/Library/LaunchAgents/com.onenote-mcp.snapshot.plist:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0"><dict>
<key>Label</key><string>com.onenote-mcp.snapshot</string>
<key>ProgramArguments</key><array>
<string>/usr/local/bin/node</string><string>/absolute/path/to/onenote-mcp/snapshot.js</string>
</array>
<key>EnvironmentVariables</key><dict>
<key>ONENOTE_BLOCKED_SECTIONS</key><string>Credentials,0-ABC123...!12345</string>
</dict>
<key>StartInterval</key><integer>3600</integer>
<key>StandardOutPath</key><string>/tmp/onenote-mcp-snapshot.log</string>
<key>StandardErrorPath</key><string>/tmp/onenote-mcp-snapshot.log</string>
</dict></plist>Linux / macOS (cron), hourly:
0 * * * * ONENOTE_BLOCKED_SECTIONS="Credentials,0-ABC123...!12345" /usr/bin/node /absolute/path/to/onenote-mcp/snapshot.js >> ~/.onenote-mcp-snapshot.log 2>&1Windows: create a Task Scheduler task that runs node C:\path\to\onenote-mcp\snapshot.js hourly.
The first run downloads every page; later runs only fetch pages that changed.
Requirements
Node.js 18 or newer
A Microsoft account with OneNote (personal accounts work out of the box; see Work or school accounts)
Installation
1. Get the code
git clone https://github.com/20001602056/onenote-mcp.git
cd onenote-mcp
npm install2. Sign in to Microsoft
npm run loginThe command prints a code and a URL (https://microsoft.com/devicelogin). Open the URL, enter the code, sign in, and approve access to OneNote. When the terminal says Signed in, you're done.
Where the tokens are stored:
Platform | Location |
macOS | Keychain, service |
Linux / Windows |
|
Run npm run login again whenever the session expires.
3. Register the server with your MCP client
Use the absolute path to server.js in the folder you cloned. Print it with:
echo "$(pwd)/server.js"Claude Code
claude mcp add --scope user onenote -- node /absolute/path/to/onenote-mcp/server.jsClaude Desktop: add this to claude_desktop_config.json (macOS: ~/Library/Application Support/Claude/, Windows: %APPDATA%\Claude\), then restart Claude Desktop:
{
"mcpServers": {
"onenote": {
"command": "node",
"args": ["/absolute/path/to/onenote-mcp/server.js"]
}
}
}4. Check it works
Ask Claude: "List my OneNote notebooks." You can also run the read test against a section you own:
ONENOTE_TEST_NOTEBOOK="My Notebook" ONENOTE_TEST_SECTION="Quick Notes" npm run test:readConfiguration
All settings are environment variables. Set them in your MCP client's server config (env), or with claude mcp add -e NAME=value ... in Claude Code.
Variable | Default | Purpose |
| (empty) | Sections every tool must refuse (ids, names or paths; see Guardrail) |
| (empty) | Pages every tool must refuse (page ids, titles or paths) |
| (empty) | Sections that can be read but not changed |
| (empty) | Pages that can be read but not changed |
| (none) | File to append a JSON line to for every change and every guardrail denial |
|
|
|
|
|
|
| (none) | Notebook used when a tool call names no notebook |
| (none) | Section used when a tool call names no section |
|
| Where |
|
| Where |
| auto-detected | Chrome/Edge/Chromium/Brave executable for PDF export |
|
|
|
|
| How long versions are kept |
|
| Where versions are stored |
|
| Sign-in authority: |
| Graph CLI public client | Use your own app registration instead |
| see above | Store tokens in this file (also on macOS, instead of the Keychain) |
Guardrail: blocking and protecting sections and pages
Four rule lists, each a comma-separated environment variable:
Variable | Effect |
| Hidden from every tool: not listed, searched, read, exported, snapshotted, copied or written |
| Same, for individual pages |
| Readable, but no page can be created, edited, deleted, copied or restored into them |
| Readable, but can't be edited, renamed or deleted |
Each entry is one of:
An id: a section id (
0-ABC123...!12345) or page id. Ids survive renames, so use them for anything sensitive.A name: section name or page title, case-insensitive.
*matches anything:Passwords*,*secret*.A path, when the entry contains
/:Notebook/Section group/Section, and for pagesNotebook/Section/Page title.*matches within one level and**across levels.My Notebook/Private/**covers everything in the Private section group, however deeply nested.
Example: block the Credentials section by name and id, plus any page whose title starts with "Passwords", and make the _Global page read-only:
claude mcp add --scope user onenote \
-e ONENOTE_BLOCKED_SECTIONS="Credentials,0-ABC123...!12345" \
-e ONENOTE_BLOCKED_PAGES="Passwords*" \
-e ONENOTE_PROTECTED_PAGES="_Global" \
-- node /absolute/path/to/onenote-mcp/server.jsGet ids from list_notebooks (sections) or list_pages (pages) before you block them.
How it's enforced:
Every page tool checks the page's section and the page itself before doing anything, and blocked items return "Access denied by guardrail". Writes to protected items return "Write denied by guardrail".
Lists, searches,
export_section,copy_sectionand snapshots leave blocked pages out.New names are checked too: you can't create a section, or create, rename, copy or restore a page, under a name or path that a rule blocks or protects.
Stored versions follow the same rules. A deleted page's versions are checked against where it lived.
With
ONENOTE_AUDIT_LOG=~/onenote-audit.log, every change and every denial is appended as a JSON line (tool, ids and names only, never page content).
The guardrail lives in this server (and
snapshot.js). Your Microsoft token itself can still reach every notebook, so keep it private.
Work or school accounts
Set ONENOTE_TENANT=organizations (or your tenant id) and run npm run login again. Some organizations require an admin to approve the Graph Command Line Tools app. If yours does, ask your admin, or register your own app and set ONENOTE_CLIENT_ID.
Tests
The tests talk to your real OneNote, so point them at a notebook and section you own:
export ONENOTE_TEST_NOTEBOOK="My Notebook"
export ONENOTE_TEST_SECTION="Quick Notes"
npm run test:convert # offline: Markdown/text conversion and guardrail rules (no sign-in needed)
npm run test:read # lists tools, notebooks and pages in the section
npm run test:write # creates a "Test from onenote-mcp" page (delete it afterwards)
# full test of every page tool: create, tags, attachments, edits, download, copy, export in every
# format, versions and restore. Versions and exports go to a temp folder.
# With delete enabled it removes the pages it created; otherwise delete them by hand.
ONENOTE_ALLOW_DELETE=true npm run test:features
# guardrail test: also needs a blocked section name + id in the same notebook
ONENOTE_BLOCKED_SECTIONS="Credentials,0-ABC123...!12345" npm run test:guardrailRevoke access
Delete the tokens: on macOS, remove the
onenote-mcpitem in Keychain Access; elsewhere, delete~/.config/onenote-mcp/tokens.json.Remove the app's consent at https://account.live.com/consent/Manage (personal accounts) or https://myapps.microsoft.com (work/school).
License
Available Tools
24 toolsappend_to_pageA
Append HTML content to the end of an existing page. A version of the page is saved first.
Inputs: html (required), pageId (required), attachments.
copy_pageA
Copy a page (with its images and files) into another section. To 'move' a page: copy, then delete the original. Work/school accounts copy in the background (check with get_operation); personal accounts copy immediately and return the new page id.
Inputs: pageId (required), toSection, toNotebook, toSectionId, +1 more.
copy_sectionA
Copy a section (with all its pages) into a notebook or section group. Work/school accounts copy in the background (check with get_operation); personal accounts copy page by page immediately (slower for big sections). Pages blocked by the guardrail are left out.
Inputs: toNotebook (required), section, notebook, renameAs, +3 more.
create_notebookA
Create a new notebook (or return the existing one with that name).
Inputs: name (required).
create_pageA
Create a page. bodyHtml supports p, h1-h6, ul/ol/li, table, pre, code, b, i, u, a, img (src can be a public URL or name:), and tags via data-tag, e.g. Task, data-tag="to-do:completed", "important", "question", "idea", "critical", "contact", "remember-for-later". Local images/files go in attachments. Use data-id="..." on elements you want to update later.
Inputs: title (required), bodyHtml (required), section, notebook, +3 more.
create_sectionA
Create a section in a notebook or inside a section group (or return the existing one with that name).
Inputs: section (required), notebook (required), sectionGroup.
create_section_groupB
Create a section group in a notebook, or nested inside another section group (or return the existing one).
Inputs: name (required), notebook (required), parentSectionGroup.
download_resourceA
Save an image or attached file from a page to disk. Get resource ids/URLs from read_page (…/resources//$value or /content).
Inputs: pageId (required), resource (required), outputPath.
export_pageB
Export a page to a local file as Markdown, HTML, plain text, JSON or PDF, with its images and attached files.
Inputs: format (required), pageId (required), resources, outputPath.
export_sectionA
Export every page in a section to local files as Markdown, HTML, plain text, JSON or PDF. By default each page gets its own file in a folder named after the section (with an index for markdown/html); combine=true writes one file with all pages. Pages blocked by the guardrail are left out.
Inputs: format (required), combine, section, notebook, +4 more.
get_operationARead-only
Check the status of a background copy (copy_page / copy_section). Returns status and, when finished, the new item's location.
Inputs: operationId (required).
get_pageBRead-only
Get a page's details: title, section, notebook, level/order, links and a short text preview (no full content).
Inputs: pageId (required).
get_recent_notebooksARead-only
List recently opened notebooks with last-access time and links to open them in OneNote.
Inputs: no named parameters.
list_notebooksARead-only
List all notebooks with their full structure: section groups (nested) and sections, with ids and links.
Inputs: no named parameters.
list_pagesBRead-only
List pages in a section with their indent level and order, newest first by default.
Inputs: limit, orderBy, section, notebook, +2 more.
list_page_versionsARead-only
List saved versions of a page (newest first). Without pageId, list every page that has versions, including deleted pages. Versions are kept for 30 days.
Inputs: pageId.
list_sectionsARead-only
List sections (including those inside section groups), optionally only in one notebook.
Inputs: notebook.
read_pageARead-only
Read a page's content. format=html (default) returns OneNote HTML; set includeIds=true to get element ids (data-id/id) to target with update_page. Tags show as data-tag (e.g. to-do, to-do:completed, important, question). Images/files show as resource URLs; save them with download_resource. format=markdown or text returns a lighter, readable version.
Inputs: pageId (required), format, includeIds.
read_page_versionBRead-only
Read a saved version of a page as html (default), markdown or text.
Inputs: pageId (required), versionId (required), format.
restore_page_versionA
Restore a saved version as a new page (with its images and files), in its original section or another one. The current page is left as it is; delete it afterwards if you want the restored copy to replace it.
Inputs: pageId (required), versionId (required), title, toSection, +3 more.
search_pagesARead-only
Search page titles (case-insensitive) in one section, or across every section of every notebook when no section is given.
Inputs: query (required), limit, section, notebook, +2 more.
server_settingsARead-only
Show this server's active settings (read-only mode, delete permission, defaults, guardrail rule counts, versioning, export).
Inputs: no named parameters.
snapshot_pagesA
Save a version of every page that changed since its last version, in one section, one notebook, or every section (no arguments). Versions are kept for 30 days. Pages edited through this server are also saved automatically before each change.
Inputs: force, section, notebook, sectionId, +1 more.
update_pageADestructive
Edit a page in place. Each change targets 'body', 'title', or an element by '#' or its generated id (from read_page with includeIds=true). Actions: append (end of target), prepend (start of target), insert (before/after target), replace (swap target; use target 'title' + replace to rename the page). Example: tick a to-do with {target:'#task1', action:'replace', content:'Done'}. All changes in one call succeed or fail together. A version of the page is saved first (see list_page_versions).
Inputs: pageId (required), changes (required), attachments.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 24 tools
Most tools target a distinct resource and action, and the descriptions clearly separate similar pairs like get_page (metadata/preview) vs read_page (content). Minor overlap remains: append_to_page duplicates update_page's append action, and list_notebooks already returns the full section structure that list_sections exposes separately.
Nearly all tools use a consistent snake_case verb_noun pattern (list_pages, create_page, export_section, etc.). The main deviation is server_settings, which is noun-only rather than verb-prefixed; get_recent_notebooks and snapshot_pages are also slight stylistic outliers but remain predictable.
At 24 tools this is on the heavy end for a single domain, and a few could be consolidated (append_to_page into update_page, possibly get_page/read_page). The breadth reflects OneNote's real surface—notebooks, sections, pages, versions, export, copy operations—but it is still more than most agents need at once.
The surface covers create/read/update for pages and create/list for notebooks and sections, plus versioning, copying, export, and resource download. However, there is no delete tool for pages, sections, section groups, or notebooks, and no section/page move except copy-then-delete (which cannot be completed because delete is absent). That is a notable lifecycle gap.
Maintenance
Related MCP Connectors
Persistent memory layer for AI tools. Save and recall notes across Claude and other MCP clients.
Notes and memory assistant: one Markdown vault that Claude, ChatGPT and any MCP client can share.
ADHD second brain for Claude, ChatGPT & any MCP AI: notes, tasks, contacts. OAuth; can't delete.
Connect Claude to your Platform7n workspaces: chat, links, work and decks. One-click OAuth.
Related MCP Servers
- AlicenseAqualityDmaintenanceEnables AI assistants to read, write, and manage Microsoft OneNote notebooks, sections, and pages through OAuth-authenticated MCP tools, resources, and prompts.1627 npm6MIT
- FlicenseAqualityDmaintenanceEnables AI agents to read, create, and analyze Microsoft OneNote notebooks, sections, and pages, including automatic image text extraction via Claude Vision.71-
- AlicenseNot gradedqualityCmaintenanceEnables Claude to sign in with a Microsoft account and read, write, search, create, move, and organize notebooks, section groups, sections, and pages, including drawing Mermaid or SVG diagrams rendered into notes. It also fetches embedded images and page contents as Markdown so handwritten-note workflows and checkboxes can be managed conversationally.MIT
- AlicenseAqualityCmaintenanceEnables Claude to browse, search, read, write, and export Microsoft OneNote content through Microsoft Graph, including viewing high-resolution screenshots/images, collecting pages for reports, and writing reports back to notebooks or sections.14MIT