lmstudio-wrapper-local-onenote-mcp

Public

7 Downloads

README

OneNote Retrieval — LM Studio Plugin

A native LM Studio tools-provider plugin that wraps local-onenote-mcp and defeats LM Studio's MCP result truncation. It exposes the full OneNote command surface — discovery, reading, creation, structural edits, and app control — as native plugin tools, with retrieval results returned in model-controlled pages so nothing is silently cut off.

Credits: the underlying OneNote COM server, local-onenote-mcp, is created and maintained by Peteroooooooo — https://github.com/Peteroooooooo/local-onenote-mcp. This plugin is only a thin LM Studio wrapper around that server.

Why this exists

When local-onenote-mcp is used as a normal MCP server, LM Studio truncates large tool results (long pages, big hierarchies, raw XML) and there is no setting to turn that off. This plugin exposes the same operations as native plugin tools and returns every large retrieval result in explicit, model-controlled pages:

  • Text / XML tools take offset + max_chars and return next_offset / has_more.
  • List / search tools take offset + limit and return next_offset / has_more.

Internally the plugin asks the underlying server for the full document (a very large max_chars, so the server never truncates first), caches it, and hands it back to the model one small, complete slice at a time. The model keeps calling with the returned next_offset until has_more is false — so it can read an entire page or list without anything being silently cut off.

Tools provided

This plugin wraps every local-onenote-mcp command, plus one convenience command (onenote_save_all_notebook_pages_xml_to_file).

Discovery & reading (retrieval — paginated)

ToolPurposePaging
onenote_health_checkVerify OneNote connection + counts—
onenote_resolve_identifierResolve GUID / path / name to one object—
onenote_get_special_locationsBackup / unfiled / default notebook folder—
onenote_list_notebooksList notebooksoffset/limit
onenote_list_sectionsList sections (optionally in one notebook)offset/limit
onenote_list_pagesList pages in a sectionoffset/limit
onenote_list_hierarchyList hierarchy from a start pointoffset/limit
onenote_get_pagePage text (+ title/objects on first slice)offset/max_chars
onenote_get_page_textPage plain textoffset/max_chars
onenote_get_page_xmlRaw OneNote page XMLoffset/max_chars
onenote_get_page_objectsOutlines / images / attachments + callback IDsoffset/limit
onenote_get_binary_contentBinary content (base64) by callback IDoffset/max_chars
onenote_search_pagesIndexed text search with snippets (scope with start_identifier)offset/limit
onenote_find_metaFind objects by OneNote meta nameoffset/limit
onenote_get_hyperlinkClient or web link for an object—
onenote_get_parentParent object id—

Creation & structural edits (write)

ToolPurpose
onenote_open_hierarchyOpen or create a notebook / section group / section by path
onenote_create_notebookCreate and open a local notebook
onenote_create_sectionCreate a section under a notebook / section group
onenote_create_section_groupCreate a section group
onenote_create_pageCreate a page (plain / html / markdown)
onenote_update_page_titleRename a page
onenote_append_to_pageAppend an outline block to a page
onenote_add_image_to_pageAdd a local image to a page
onenote_replace_page_bodyReplace a page's body content (destructive)
onenote_delete_page_contentDelete one content object by id (destructive)
onenote_delete_hierarchyDelete a notebook / group / section / page (destructive)
onenote_update_page_xmlAdvanced: submit raw page XML
onenote_update_hierarchy_xmlAdvanced: submit raw hierarchy XML

File & app control

ToolPurpose
onenote_publish_objectExport a notebook / section / page to PDF, Word, XPS, HTML, etc.
onenote_navigate_toFocus an object in the OneNote UI
onenote_navigate_to_urlOpen a onenote: URL
onenote_sync_hierarchySync a notebook hierarchy object
onenote_close_notebookClose a notebook
onenote_merge_sectionsMerge one section into another (destructive)
onenote_set_filing_locationSet filing location for email / clips / printouts

Convenience

ToolPurpose
onenote_save_all_notebook_pages_xml_to_fileRead a whole notebook by name and write every page's XML to <notebook name>.xml, preserving the section-group / section / page structure

Note: the write, structural, and app-control tools can create, modify, delete, and export your OneNote content. Enable the plugin only in chats where you want the model to have that access.


Prerequisites

  • Windows + OneNote desktop app (same requirement as local-onenote-mcp).
  • local-onenote-mcp already working. The plugin launches it as a child process. The default assumes the global launcher is installed:
    npm install -g github:Peteroooooooo/local-onenote-mcp
    
    (You already have this if local-onenote-mcp runs today as an MCP server in LM Studio.)
  • LM Studio with the lms CLI available. LM Studio bundles Node.js and the lms command. If lms is not on your PATH, run its bootstrapper once (from the LM Studio install directory), e.g.:
    & "$env:USERPROFILE\.lmstudio\bin\lms.exe" bootstrap
    
    then restart your terminal. (You do not need a separate Node.js install — the one used here for npm install just generates the lock file.)

Install

From this folder (lm-studio-plugin):

1. Install dependencies (creates package-lock.json)

npm install

LM Studio installs a plugin's dependencies from package.json and package-lock.json, so this file must exist. (Running npm install here has already created it.)

2. Run the plugin in development mode

lms dev

The plugin now appears in LM Studio's Program → Plugins list and hot-reloads when you edit the source. Keep this terminal open while developing. Once you are happy with it, you can register it permanently with lms push (see Publishing below) — after that LM Studio runs it automatically and you no longer need lms dev.

3. Configure the plugin (only if you are NOT using the global launcher)

Open the plugin's settings in LM Studio (gear icon next to the plugin). Defaults work if local-onenote-mcp is on your PATH. To run the server directly from the Python venv instead, set:

  • OneNote MCP command → full path to python.exe, e.g. C:\Data\AI\MCP\local-onenote-mcp\.venv\Scripts\python.exe
  • OneNote MCP arguments → two rows: -m and local_onenote_mcp.server

Other settings (all optional):

SettingDefaultMeaning
OneNote operation timeout (s)90LOCAL_ONENOTE_MCP_TIMEOUT for the server
Tool request timeout (ms)120000Max wait for one underlying call
Underlying max characters5,000,000max_chars sent so the server never truncates
Default page size (characters)8000Text/XML chars per call when max_chars omitted
Default item page size50List items per call when limit omitted

Keep Default page size comfortably under LM Studio's tool-result limit. If you still see truncation, lower it (e.g. 4000) — the model just makes more calls.

4. Use it in a chat

  • In a chat, enable the OneNote Retrieval plugin (tools toggle / plugin selector).
  • To avoid duplicate/confusing tools, disable the raw local-onenote-mcp MCP server for chats where you use this plugin (or keep it only for write operations).
  • Ask the model to read OneNote. It will page through content automatically, e.g.:

    "Read the full 'Project Launch Checklist' page from my Personal notebook."


How the model should page (behavioural note)

Each large result includes has_more and next_offset. The model should:

  • call again with offset = next_offset until has_more is false (text/XML), and
  • call again with offset = next_offset for the next batch of list items.

The plugin caches the full document after the first call, so paging is fast and does not re-hit OneNote for each slice.


Exporting a whole notebook to XML

onenote_save_all_notebook_pages_xml_to_file reads an entire notebook and writes one XML file that mirrors its structure — <notebook> → <sectionGroup> → <section> → <page>, with each page's raw OneNote XML embedded inline. The file is named after the notebook (e.g. Personal.xml).

  • Parameters: notebook_name (required), output_dir (optional — defaults to the plugin's working directory; on the machine running OneNote), page_info (default basic), overwrite (default false).
  • Returns: the output file path plus counts (pages_written, sections, section_groups, page_read_errors, bytes).
  • Heads-up: this reads every page via GetPageContent, which loads them into OneNote. For very large notebooks it can make OneNote sluggish — restart OneNote afterward if needed. Pages that fail to read are written as an XML comment placeholder rather than aborting the whole export.

Example ask:

"Save all pages of my 'Personal' notebook to XML."


Publishing (optional)

To register the plugin so it is always available (no lms dev needed):

lms push

Edit manifest.json (name, owner) before pushing if you want a different identity. name must be kebab-case.


Troubleshooting

  • "Failed to launch OneNote MCP server" — the command can't be found. Confirm local-onenote-mcp runs in a terminal, or switch the plugin to the venv python.exe path (step 3). On Windows a bare command / .cmd launcher is run through the shell automatically; a full python.exe path is not (so paths with spaces are fine there).
  • First call is slow / times out — the underlying server builds its Python venv and starts OneNote COM on first use. Raise Tool request timeout (ms) and retry.
  • Still truncated — lower Default page size (characters) in the plugin settings.
  • Empty results — run onenote_health_check; if it fails, the OneNote desktop app is likely closed or the COM bridge isn't available.
  • View logs — messages prefixed [onenote-retrieval] (and [server] for the child process) appear in LM Studio's developer/plugin logs.
  • OneNote gets sluggish after many reads — every page read calls OneNote's GetPageContent, which loads that page inside the running OneNote process; heavy automation grows OneNote's memory until a restart. Mitigations built in: (1) reads are cached, so re-reading a page (any offset, including 0) does not re-hit OneNote — pass refresh: true only when you need fresh content; (2) passing a page GUID (the id from list/search results) skips a full-store GetHierarchy that otherwise ran on every read; (3) prefer onenote_get_page / onenote_get_page_text over onenote_get_page_xml, and keep page_info: "basic" (avoid "all", which pulls binary). Reading a very large number of distinct pages will still grow OneNote's memory — that is an OneNote limitation; restart it periodically for long sessions.
  • OneNote gets sluggish after searches — onenote_search_pages defaults to OneNote's fast search index. Avoid include_unindexed=true (a live scan that loads every page in scope into OneNote) unless you must, and scope searches with start_identifier. The bridge also releases its COM object after each call.

Project layout

lm-studio-plugin/
├── manifest.json          # LM Studio plugin manifest (type/runner/name)
├── package.json           # deps: @lmstudio/sdk, zod
├── package-lock.json      # required by LM Studio to install deps
├── tsconfig.json
└── src/
    ├── index.ts           # registers config + tools provider
    ├── configSchematics.ts# settings UI (command, page sizes, timeouts)
    ├── mcpClient.ts        # tiny stdio JSON-RPC MCP client (no extra deps)
    ├── pagination.ts       # text/item slicing + small LRU doc cache
    ├── notebookDump.ts     # builds the structured notebook XML export
    └── toolsProvider.ts    # all OneNote tools (retrieval + write + control)

Credits & license

  • local-onenote-mcp — the OneNote COM server this plugin wraps — is created and maintained by Peteroooooooo: https://github.com/Peteroooooooo/local-onenote-mcp. All OneNote functionality comes from that project; this plugin only adapts it to LM Studio's plugin API and adds pagination plus the notebook-to-XML export convenience command.
  • This wrapper plugin is provided under the MIT license (see package.json). Refer to the upstream repository for its own license terms.