Skip to main content
Glama

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 0600 file 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

list_notebooks

Full tree of every notebook: nested section groups and sections, with ids, default/shared flags and links

get_recent_notebooks

Recently opened notebooks, with last-access time and links

create_notebook

Create a notebook (or return the existing one)

create_section_group

Create a section group in a notebook or nested inside another group

list_sections

Every section, including those inside section groups, optionally for one notebook

create_section

Create a section in a notebook or a section group

copy_section

Copy a section and all its pages into another notebook or section group

Pages

Tool

What it does

list_pages

Pages in a section, with indent level and order; choose sort order and limit

search_pages

Search page titles in one section, one notebook, or everywhere

get_page

Page details: section, notebook, links and a short text preview

read_page

Full page as HTML (optionally with element ids for precise edits), Markdown or plain text

create_page

New page from HTML, with tags, web images and local images/files

update_page

Edit in place: rename, replace/insert/append/prepend at any element, tick to-dos, add attachments (saves a version first)

append_to_page

Append HTML (and attachments) to the end of a page (saves a version first)

copy_page

Copy a page with its images and files to another section (copy + delete = move)

delete_page

Delete a page (only when ONENOTE_ALLOW_DELETE=true; saves a version first and refuses if it can't)

download_resource

Save an image or attached file from a page to disk

get_operation

Check a background copy (work/school accounts)

server_settings

Show the server's active settings

Export

Tool

What it does

export_page

Save a page as Markdown, HTML, text, JSON or PDF, with its images and files

export_section

Save every page in a section, one file per page (plus an index) or one combined file

Versions

Tool

What it does

snapshot_pages

Save a version of every changed page in a section, a notebook, or everywhere

list_page_versions

A page's saved versions, or every page with versions (including deleted pages)

read_page_version

Read a saved version as HTML, Markdown or text

restore_page_version

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-id when you create it, then update_page with {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 as name:file1, or leave them unreferenced and they're added at the end.

  • Renaming a page: update_page with {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

markdown

YAML front matter (title, id, notebook, section, dates, link), then the page. To-dos become - [ ] / - [x], tables become Markdown tables, attachments become links

html

A standalone page that opens in any browser (OneNote's absolute positioning removed, to-do boxes shown)

text

Plain text with [ ] / [x] to-dos and tab-separated tables

json

Page metadata plus its HTML and Markdown, for scripts

pdf

Printed by a local Chrome, Edge, Chromium or Brave in headless mode (set ONENOTE_CHROME_PATH if it isn't found)

Images and attached files (resources):

  • download (default): saved in <name>_files/ next to the export (or assets/ in a section folder), with relative links.

  • inline: embedded as data: 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_page refuses to delete if that snapshot fails.

  • For every page in every section, on demand with snapshot_pages, or on a schedule with npm 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>&1

Windows: 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 install

2. Sign in to Microsoft

npm run login

The 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 onenote-mcp

Linux / Windows

~/.config/onenote-mcp/tokens.json (or $XDG_CONFIG_HOME/onenote-mcp/tokens.json), readable only by you

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.js

Claude 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:read

Configuration

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

ONENOTE_BLOCKED_SECTIONS

(empty)

Sections every tool must refuse (ids, names or paths; see Guardrail)

ONENOTE_BLOCKED_PAGES

(empty)

Pages every tool must refuse (page ids, titles or paths)

ONENOTE_PROTECTED_SECTIONS

(empty)

Sections that can be read but not changed

ONENOTE_PROTECTED_PAGES

(empty)

Pages that can be read but not changed

ONENOTE_AUDIT_LOG

(none)

File to append a JSON line to for every change and every guardrail denial

ONENOTE_READ_ONLY

false

true hides every tool that changes OneNote or writes files

ONENOTE_ALLOW_DELETE

false

true enables delete_page (ignored in read-only mode)

ONENOTE_DEFAULT_NOTEBOOK

(none)

Notebook used when a tool call names no notebook

ONENOTE_DEFAULT_SECTION

(none)

Section used when a tool call names no section

ONENOTE_DOWNLOAD_DIR

~/Downloads

Where download_resource saves files when no path is given

ONENOTE_EXPORT_DIR

ONENOTE_DOWNLOAD_DIR

Where export_page / export_section write when no path is given

ONENOTE_CHROME_PATH

auto-detected

Chrome/Edge/Chromium/Brave executable for PDF export

ONENOTE_VERSIONING

true

false turns off snapshots and hides the version tools

ONENOTE_VERSION_RETENTION_DAYS

30

How long versions are kept

ONENOTE_VERSION_DIR

~/.local/share/onenote-mcp/versions

Where versions are stored

ONENOTE_TENANT

consumers

Sign-in authority: consumers (personal), organizations, common, or a tenant id

ONENOTE_CLIENT_ID

Graph CLI public client

Use your own app registration instead

ONENOTE_TOKEN_FILE

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

ONENOTE_BLOCKED_SECTIONS

Hidden from every tool: not listed, searched, read, exported, snapshotted, copied or written

ONENOTE_BLOCKED_PAGES

Same, for individual pages

ONENOTE_PROTECTED_SECTIONS

Readable, but no page can be created, edited, deleted, copied or restored into them

ONENOTE_PROTECTED_PAGES

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 pages Notebook/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.js

Get 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_section and 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:guardrail

Revoke access

License

MIT

Available Tools

24 tools
append_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_operationA
Read-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_pageB
Read-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_notebooksA
Read-only

List recently opened notebooks with last-access time and links to open them in OneNote.

Inputs: no named parameters.

list_notebooksA
Read-only

List all notebooks with their full structure: section groups (nested) and sections, with ids and links.

Inputs: no named parameters.

list_pagesB
Read-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_versionsA
Read-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_sectionsA
Read-only

List sections (including those inside section groups), optionally only in one notebook.

Inputs: notebook.

read_pageA
Read-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_versionB
Read-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_pagesA
Read-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_settingsA
Read-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_pageA
Destructive

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

    B3.4/5.0

    Scored across 24 tools

    Disambiguation4/5

    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.

    Naming Consistency4/5

    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.

    Tool Count3/5

    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.

    Completeness3/5

    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

    ActivityMaintained
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      A
      quality
      D
      maintenance
      Enables AI assistants to read, write, and manage Microsoft OneNote notebooks, sections, and pages through OAuth-authenticated MCP tools, resources, and prompts.
      16
      27 npm
      6
      MIT
    • A
      license
      Not graded
      quality
      C
      maintenance
      Enables 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
    • A
      license
      A
      quality
      C
      maintenance
      Enables 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.
      14
      MIT