@bitefoundry/onenote 0.4.0 → 0.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +23 -2
- package/docs/API.md +22 -4
- package/docs/MCP.md +10 -1
- package/docs/NPM.md +8 -0
- package/docs/openapi.yaml +5 -0
- package/package.json +7 -7
package/README.md
CHANGED
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
|
|
24
24
|
| Capability | Details |
|
|
25
25
|
| --- | --- |
|
|
26
|
-
| **Minimal-Chrome 3-Pane TUI** | Personal
|
|
26
|
+
| **Minimal-Chrome 3-Pane TUI** | Personal and Teams/Group notebooks, colored section ribbon, nested subpages (`level 0/1/2`), bidirectional XHTML ↔ Markdown canvas, surgical `data-id` `PATCH` edits, optimistic to-do toggles, Link Extractor (`u`), File Picker with `zoxide` (`Ctrl+F`), and 6 themes. |
|
|
27
27
|
| **High-Res Terminal Images** | Inline thumbnails & fullscreen HD previews (`v` / `Alt+v`) with 80ms protocol probing for **Kitty**, **iTerm2**, **Sixel** (Floyd-Steinberg dithering), and **24-bit Unicode Half-Blocks** + `Ctrl+V` clipboard PNG upload. |
|
|
28
28
|
| **Local SQLite FTS5 + IPC Daemon** | WAL-mode SQLite cache with 4-reader pool, trigram full-text search (`/`), persistent `DraftStore`, and a shared background sync daemon (`onenote daemon start`). |
|
|
29
29
|
| **4-in-1 Agent Interface** | Interactive **TUI** (`onenote`), scriptable `--json` **CLI**, local **HTTP JSON API** (`onenote serve`, port `8793`), and stdio **MCP Server** (`onenote mcp`). |
|
|
@@ -74,6 +74,23 @@ For persistent environment configuration, set `ONENOTE_CLIENT_ID` and `ONENOTE_T
|
|
|
74
74
|
|
|
75
75
|
When supplying a token without an embedded user ID (for example an opaque `ONENOTE_ACCESS_TOKEN` or `ONENOTE_TOKEN_FILE`), run `onenote whoami` once while online to record only the token fingerprint and user ID under `identity-map/`. Running local `search` (without `--refresh`) or `--offline` with an unrecorded token returns an `Unknown identity` error instead of falling back to an empty `default` cache. Running `onenote search <query> --refresh` also records the identity binding. Whenever the token rotates or changes, run `onenote whoami` once again for the new token.
|
|
76
76
|
|
|
77
|
+
### Enterprise networks / custom CA
|
|
78
|
+
|
|
79
|
+
HTTPS connections trust the bundled Mozilla roots and the operating system's trust store. If your network inspects HTTPS with a private root CA that is not in either, export that root as PEM and point the CLI at it:
|
|
80
|
+
|
|
81
|
+
| Variable | Behaviour |
|
|
82
|
+
| --- | --- |
|
|
83
|
+
| `ONENOTE_EXTRA_CA_PEM` | PEM file (one certificate or a bundle) added to the trusted roots. If it cannot be read or parsed, the command fails with an error naming the file. |
|
|
84
|
+
| `SSL_CERT_FILE` | Also loaded as extra roots. An unusable file is reported on stderr and skipped. When set, it replaces the OS trust store for the native-roots lookup; the bundled roots still apply. |
|
|
85
|
+
| `NODE_EXTRA_CA_CERTS` | Also loaded as extra roots, so an existing Node.js setup works unchanged. An unusable file is reported on stderr and skipped. |
|
|
86
|
+
|
|
87
|
+
```sh
|
|
88
|
+
export ONENOTE_EXTRA_CA_PEM=/path/to/corporate-root.pem
|
|
89
|
+
onenote doctor --online
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
A certificate from an unknown issuer produces a `TLS certificate was not trusted (unknown issuer)` hint naming these variables. Certificate verification cannot be turned off. Warnings go to stderr only, so `onenote mcp` stdio output is unaffected.
|
|
93
|
+
|
|
77
94
|
---
|
|
78
95
|
|
|
79
96
|
## Keybindings Cheat Sheet
|
|
@@ -125,6 +142,8 @@ When a `--json` command fails at runtime, it exits 1 and writes a single JSON ob
|
|
|
125
142
|
|
|
126
143
|
Use `onenote read PAGE --format blocks` to find a checkbox or text block's current element ID. Use `--done` or `--undone` to set a checkbox state. Omit both flags to toggle it.
|
|
127
144
|
|
|
145
|
+
`onenote notebooks` lists your personal notebooks, plus the notebooks of your joined Teams/Groups with `--include-teams`. SharePoint site notebooks are not auto-discovered; you can create one with `onenote create-notebook NAME --site SITE_ID`.
|
|
146
|
+
|
|
128
147
|
`copy-page` uses Microsoft Graph to create a new page in the destination section and preserves the original page and its links. If the copy is still pending, pass its `operation_url` with `--operation` to check the same copy. [Copy a page](docs/API.md#copy-a-page)
|
|
129
148
|
|
|
130
149
|
On Windows, `desktop-set-page-level` and `desktop-rename-section` work on existing objects in an open notebook. Use the OneNote app's **Move** command to move a page between sections. [Hierarchy operations and permissions](docs/API.md#hierarchy-operations)
|
|
@@ -132,7 +151,7 @@ On Windows, `desktop-set-page-level` and `desktop-rename-section` work on existi
|
|
|
132
151
|
### Local HTTP API (`onenote serve`)
|
|
133
152
|
|
|
134
153
|
```sh
|
|
135
|
-
# Start local Axum JSON server (default 127.0.0.1:8793)
|
|
154
|
+
# Start local Axum JSON server (default 127.0.0.1:8793) with your own API key
|
|
136
155
|
onenote serve --token dev-secret
|
|
137
156
|
|
|
138
157
|
# Query pages & FTS5 search from scripts or agents
|
|
@@ -140,6 +159,8 @@ curl -H "Authorization: Bearer dev-secret" \
|
|
|
140
159
|
"http://127.0.0.1:8793/v1/onenote/search?q=canary&limit=10"
|
|
141
160
|
```
|
|
142
161
|
|
|
162
|
+
The API key is required on every route except `/health`. Without `--token` (alias of `--api-key`) or `ONENOTE_API_KEY`, a loopback server generates a random key and prints it once on stderr; pass `--allow-keyless` to run a loopback server without one. A non-loopback `--bind` always needs a key. Browser pages cannot call the API unless their exact origin is listed with `--cors-origin`, and requests whose `Host` is not a loopback name, the bind address or an `--allowed-host` are refused. [Authentication and access control](docs/API.md#authentication-and-access-control)
|
|
163
|
+
|
|
143
164
|
Full route reference & OpenAPI 3.1 spec: [docs/API.md](docs/API.md) · [docs/openapi.yaml](docs/openapi.yaml).
|
|
144
165
|
|
|
145
166
|
### Model Context Protocol (`onenote mcp`)
|
package/docs/API.md
CHANGED
|
@@ -3,22 +3,40 @@
|
|
|
3
3
|
`onenote serve` runs a local Axum HTTP server bound to `127.0.0.1:8793` by default.
|
|
4
4
|
|
|
5
5
|
```sh
|
|
6
|
-
# Start with default port (127.0.0.1:8793)
|
|
6
|
+
# Start with default port (127.0.0.1:8793); a random API key is printed once on stderr
|
|
7
7
|
onenote serve
|
|
8
8
|
|
|
9
9
|
# Keep a client configured for the previous port
|
|
10
10
|
onenote serve --port 8788
|
|
11
11
|
|
|
12
|
-
#
|
|
13
|
-
onenote serve --
|
|
12
|
+
# Choose the API key yourself (flag or environment variable)
|
|
13
|
+
onenote serve --token my-secret-token
|
|
14
|
+
ONENOTE_API_KEY=my-secret-token onenote serve
|
|
14
15
|
```
|
|
15
16
|
|
|
16
|
-
|
|
17
|
+
### Authentication and access control
|
|
18
|
+
|
|
19
|
+
Every endpoint except `/health` requires the API key, sent as either header:
|
|
17
20
|
|
|
18
21
|
```http
|
|
19
22
|
Authorization: Bearer my-secret-token
|
|
23
|
+
x-api-key: my-secret-token
|
|
20
24
|
```
|
|
21
25
|
|
|
26
|
+
| Situation | Behaviour |
|
|
27
|
+
| --- | --- |
|
|
28
|
+
| `--api-key` / `--token` or `ONENOTE_API_KEY` set | That key is required. An empty value is an error. |
|
|
29
|
+
| Loopback bind, no key given | A random 32-byte key is generated for this run and printed once on stderr with a ready-to-copy `Authorization: Bearer …` line. |
|
|
30
|
+
| Loopback bind with `--allow-keyless` | No key is required (a warning is printed). Any local process can then read, edit and delete notebooks through the server. |
|
|
31
|
+
| Non-loopback bind (for example `--bind 0.0.0.0`) | A key is mandatory. `--allow-keyless` and the former `ONENOTE_ALLOW_INSECURE_SERVE` variable do not apply. |
|
|
32
|
+
|
|
33
|
+
The server also checks where a request comes from, on every route including `/health`:
|
|
34
|
+
|
|
35
|
+
- **`Host` allow-list.** The `Host` header must name `127.0.0.1`, `localhost`, `[::1]`, the `--bind` value, or a host added with `--allowed-host <HOST>` (repeatable; the port is ignored). Other hosts get `421 Misdirected Request`. When binding a LAN address, add the name clients use: `onenote serve --bind 0.0.0.0 --token … --allowed-host notes.corp.example`.
|
|
36
|
+
- **No cross-origin browser access by default.** A request with an `Origin` header gets `403 Forbidden`, and no `Access-Control-Allow-*` header is sent. To let a web app call the API, list its exact origin: `--cors-origin https://app.example.com` (repeatable). Wildcards are not supported. An allowed origin still needs the API key.
|
|
37
|
+
|
|
38
|
+
Command-line clients such as `curl` send no `Origin` header and are unaffected.
|
|
39
|
+
|
|
22
40
|
## Endpoints
|
|
23
41
|
|
|
24
42
|
All OneNote endpoints are served under both `/v1/onenote/...` and the shorter `/onenote/...` alias.
|
package/docs/MCP.md
CHANGED
|
@@ -35,7 +35,7 @@ If installed via `npx`:
|
|
|
35
35
|
| Tool | Description | Key Parameters |
|
|
36
36
|
| --- | --- | --- |
|
|
37
37
|
| `whoami` | Return signed-in Microsoft 365 profile & auth mode | _(none)_ |
|
|
38
|
-
| `list_notebooks` | List accessible OneNote notebooks (personal, Teams/Group
|
|
38
|
+
| `list_notebooks` | List accessible OneNote notebooks (personal, plus Teams/Group with `include_teams`; SharePoint site notebooks are not auto-discovered) | `include_teams?`, `limit?`, `cursor?`, `refresh?`, `offline?` |
|
|
39
39
|
| `list_sections` | List sections in a notebook or across all notebooks | `notebook?`, `limit?`, `cursor?`, `refresh?`, `offline?` |
|
|
40
40
|
| `list_pages` | List pages in a section (supports `Notebook/Section`, name, or ID) | `section` (required), `limit?`, `cursor?`, `refresh?`, `offline?` |
|
|
41
41
|
| `get_page` | Read compact Markdown and identifiers; pass compact: false for XHTML, blocks and resources | `page` (required), `section?`, `compact?`, `offline?` |
|
|
@@ -56,6 +56,15 @@ If installed via `npx`:
|
|
|
56
56
|
|
|
57
57
|
The server resolves the signed-in account and local cache on the first `tools/call`; `initialize`, `ping`, and `tools/list` respond without contacting Graph or selecting a cache.
|
|
58
58
|
|
|
59
|
+
### Request cost
|
|
60
|
+
|
|
61
|
+
Each tool description in `tools/list` states what a call costs, so agents can avoid expensive patterns:
|
|
62
|
+
|
|
63
|
+
- `search_pages` is local (no network). `refresh: true` first runs a full account sync, which issues many Graph requests on large accounts; do not use it in loops.
|
|
64
|
+
- `list_notebooks`, `list_sections`, `list_pages` and `get_page` call Microsoft Graph unless `offline: true`. A recent cached list is reused only when `ONENOTE_CLI_CACHE_SECS` is set; `refresh: true` always refetches.
|
|
65
|
+
- `include_teams` adds one Graph request per joined Team (up to `ONENOTE_MAX_TEAMS`, default 100). `list_sections` without `notebook` lists every notebook, including Teams notebooks, and then each notebook's sections.
|
|
66
|
+
- `copy_page` blocks for up to `wait_seconds` while it polls the server-side copy. `download_resource` downloads the full file to disk.
|
|
67
|
+
|
|
59
68
|
### Page reads and writes
|
|
60
69
|
|
|
61
70
|
`get_page` returns the compact page by default, including `page.page_key`, `page.scope`, `page.omitted`, and `page.hint`. Pass `compact: false` to read `page.blocks[].element_id`, `page.raw_xhtml`, and `page.resources`. Write tools (`append_page`, `update_block`, `update_page`, `toggle_todo`) return a compact summary (`ok`, `page_key`, `title`, `last_modified_at`, plus `block_id` / `completed` where applicable) by default; pass `compact: false` to include the full `page` object. Page tools (`get_page`, `append_page`, `update_block`, `update_page`, `toggle_todo`, `delete_page`) accept an optional `section` argument to narrow title lookup. Use current element IDs for block writes. Both `update_block` and its `update_page` alias appear in `tools/list`.
|
package/docs/NPM.md
CHANGED
|
@@ -74,6 +74,8 @@ npm removes the previous package's global `note` launcher during an upgrade. If
|
|
|
74
74
|
|
|
75
75
|
Change HTTP clients from `http://127.0.0.1:8788` to `http://127.0.0.1:8793` to use the new default. To keep an existing client on port `8788`, run `onenote serve --port 8788` when that port is available. Teams uses `8788` by default.
|
|
76
76
|
|
|
77
|
+
From 0.4.1 the HTTP API requires an API key by default: pass `--token <SECRET>` or set `ONENOTE_API_KEY` and send it as `Authorization: Bearer <SECRET>`, or copy the key that a bare `onenote serve` prints on stderr. `--allow-keyless` restores keyless access on loopback only. See [docs/API.md](API.md#authentication-and-access-control).
|
|
78
|
+
|
|
77
79
|
## Supported platforms
|
|
78
80
|
|
|
79
81
|
| npm package | OS | CPU | Rust target |
|
|
@@ -160,13 +162,19 @@ token_refresh_mins = 5
|
|
|
160
162
|
| `ONENOTE_DATA_DIR` | Override SQLite cache (`cache.db`) directory |
|
|
161
163
|
| `ONENOTE_NO_BROWSER` | Disable automatic browser launch during login (`1` / `true`) |
|
|
162
164
|
| `ONENOTE_AUTO_DAEMON` | Auto-start/attach to the background sync daemon (`1` / `true`, default `false`) |
|
|
165
|
+
| `ONENOTE_MAX_TEAMS` | Joined Teams queried for notebooks by `--include-teams` (default `100`, range `1`–`500`; one Graph request per Team). Background sync always uses `25` |
|
|
163
166
|
| `ONENOTE_IMAGE_PROTOCOL` | Terminal image protocol override (`auto`, `kitty`, `iterm2`, `sixel`, `halfblock`) |
|
|
164
167
|
| `ONENOTE_GITHUB_REPO` | Override GitHub `owner/repo` used by `onenote self-update` (default `BiteFoundry/onenote`) |
|
|
165
168
|
| `ONENOTE_GITHUB_TOKEN` | GitHub token for private release checks in `onenote self-update` |
|
|
169
|
+
| `ONENOTE_EXTRA_CA_PEM` | PEM root certificate(s) to trust in addition to the bundled and OS roots, for TLS-inspecting corporate proxies. An unusable file is an error |
|
|
170
|
+
| `SSL_CERT_FILE`, `NODE_EXTRA_CA_CERTS` | Also loaded as extra PEM roots; an unusable file is a stderr warning and is skipped |
|
|
166
171
|
|
|
167
172
|
## Troubleshooting
|
|
168
173
|
|
|
169
174
|
- **`no prebuilt binary found for <platform>-<arch>`** — reinstall with
|
|
170
175
|
`npm install -g @bitefoundry/onenote --include=optional`.
|
|
176
|
+
- **`TLS certificate was not trusted (unknown issuer)`** — your network inspects HTTPS with a private root CA.
|
|
177
|
+
Export it as PEM and set `ONENOTE_EXTRA_CA_PEM=/path/to/root.pem` (`SSL_CERT_FILE` and `NODE_EXTRA_CA_CERTS`
|
|
178
|
+
are also honoured), then check with `onenote doctor --online`.
|
|
171
179
|
- **Older Linux (`GLIBC < 2.28`) or Alpine/musl Linux** — build from source with Cargo (`cargo build --release`).
|
|
172
180
|
- **Verify the binary** — `node -p "require.resolve('@bitefoundry/onenote-win32-x64/package.json')"` (adjust for your platform).
|
package/docs/openapi.yaml
CHANGED
|
@@ -5,6 +5,11 @@ info:
|
|
|
5
5
|
description: >
|
|
6
6
|
Local HTTP JSON API exposed by `onenote serve` (default `127.0.0.1:8793`).
|
|
7
7
|
All `/v1/onenote/*` routes are also mirrored under `/onenote/*`.
|
|
8
|
+
Every route except `/health` needs the API key (`Authorization: Bearer` or
|
|
9
|
+
`x-api-key`); a loopback server without `--api-key` / `ONENOTE_API_KEY`
|
|
10
|
+
generates one and prints it on stderr. Requests with a `Host` outside the
|
|
11
|
+
allow-list get 421, and requests with an `Origin` not listed with
|
|
12
|
+
`--cors-origin` get 403.
|
|
8
13
|
servers:
|
|
9
14
|
- url: http://127.0.0.1:8793
|
|
10
15
|
components:
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bitefoundry/onenote",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.1",
|
|
4
4
|
"description": "Microsoft OneNote terminal client & AI agent toolkit — Notebooks, Sections, Pages, XHTML/Markdown & Resources (CLI, TUI, HTTP API, MCP)",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -40,11 +40,11 @@
|
|
|
40
40
|
"build:npm": "node scripts/build-npm.mjs"
|
|
41
41
|
},
|
|
42
42
|
"optionalDependencies": {
|
|
43
|
-
"@bitefoundry/onenote-win32-x64": "0.4.
|
|
44
|
-
"@bitefoundry/onenote-win32-arm64": "0.4.
|
|
45
|
-
"@bitefoundry/onenote-darwin-x64": "0.4.
|
|
46
|
-
"@bitefoundry/onenote-darwin-arm64": "0.4.
|
|
47
|
-
"@bitefoundry/onenote-linux-x64": "0.4.
|
|
48
|
-
"@bitefoundry/onenote-linux-arm64": "0.4.
|
|
43
|
+
"@bitefoundry/onenote-win32-x64": "0.4.1",
|
|
44
|
+
"@bitefoundry/onenote-win32-arm64": "0.4.1",
|
|
45
|
+
"@bitefoundry/onenote-darwin-x64": "0.4.1",
|
|
46
|
+
"@bitefoundry/onenote-darwin-arm64": "0.4.1",
|
|
47
|
+
"@bitefoundry/onenote-linux-x64": "0.4.1",
|
|
48
|
+
"@bitefoundry/onenote-linux-arm64": "0.4.1"
|
|
49
49
|
}
|
|
50
50
|
}
|