document-mcp 2.1.21 → 2.1.23

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 CHANGED
@@ -1,10 +1,10 @@
1
1
  # document-mcp
2
2
 
3
- [![GitHub](https://img.shields.io/badge/GitHub-181717?logo=github&logoColor=white)](https://github.com/ExaDev/document-mcp) [![npm](https://img.shields.io/badge/npm-CB3837?logo=npm&logoColor=white)](https://www.npmjs.com/package/document-mcp) [![Release](https://img.shields.io/github/v/release/ExaDev/document-mcp)](https://github.com/ExaDev/document-mcp/releases/latest) [![CI](https://img.shields.io/github/actions/workflow/status/ExaDev/document-mcp/ci.yml?branch=main)](https://github.com/ExaDev/document-mcp/actions)
3
+ [![GitHub](https://img.shields.io/badge/GitHub-181717?logo=github&logoColor=white)](https://github.com/ExaDev/documents.js/tree/main/packages/document-mcp) [![npm](https://img.shields.io/badge/npm-CB3837?logo=npm&logoColor=white)](https://www.npmjs.com/package/document-mcp) [![npm version](https://img.shields.io/npm/v/document-mcp)](https://www.npmjs.com/package/document-mcp) [![CI](https://img.shields.io/github/actions/workflow/status/ExaDev/documents.js/ci.yml?branch=main)](https://github.com/ExaDev/documents.js/actions)
4
4
 
5
5
  > An MCP (Model Context Protocol) server exposing [`documents.js`](https://github.com/ExaDev/documents.js)'s document-conversion, `.odb`, metadata, and font tooling as MCP tools, so an MCP-speaking agent can convert, inspect, and edit docx/pptx/odt/odp/ods/odg/odf/pdf/odb/xlsx/markdown documents without writing TypeScript against `documents.js` directly.
6
6
 
7
- `document-mcp` adds no conversion or editing logic of its own — it is a dispatch layer over `documents.js`'s existing conversion functions, `DocumentConverter` port, and `.odb`/PDF readers, wired up as MCP tools served over stdio. [`document-cli`](https://github.com/ExaDev/document-cli) is the sibling frontend over the identical `documents.js` library — a terminal CLI/TUI rather than an MCP server — so the two are independent consumers of one shared implementation and can expose different subsets of it. A `convert_document` call's fidelity — which `(source, targetFormat)` pairs round-trip losslessly, which are a best-effort reconstruction, and why — is exactly what [`documents.js`'s own Fidelity section](https://github.com/ExaDev/documents.js#fidelity) documents, table included; it is not restated here.
7
+ `document-mcp` adds no conversion or editing logic of its own — it is a dispatch layer over `documents.js`'s existing conversion functions, `DocumentConverter` port, and `.odb`/PDF readers, wired up as MCP tools served over stdio. [`document-cli`](../document-cli/README.md) is the sibling frontend over the identical `documents.js` library — a terminal CLI/TUI rather than an MCP server — so the two are independent consumers of one shared implementation and can expose different subsets of it. A `convert_document` call's fidelity — which `(source, targetFormat)` pairs round-trip losslessly, which are a best-effort reconstruction, and why — is exactly what [`documents.js`'s own Fidelity section](../documents.js/README.md#fidelity) documents, table included; it is not restated here.
8
8
 
9
9
  ```mermaid
10
10
  graph TD
@@ -38,16 +38,16 @@ graph TD
38
38
  odf --> cli
39
39
  pdfcodec --> cli
40
40
 
41
- click schema "https://github.com/ExaDev/document-schema.js" "document-schema.js"
42
- click ooxml "https://github.com/ExaDev/ooxml.js" "ooxml.js"
43
- click odf "https://github.com/ExaDev/odf.js" "odf.js"
44
- click pdfcodec "https://github.com/ExaDev/pdf-codec" "pdf-codec"
45
- click mdcodec "https://github.com/ExaDev/markdown-codec" "markdown-codec"
46
- click bytecodec "https://github.com/ExaDev/byte-codec" "byte-codec"
41
+ click schema "https://github.com/ExaDev/documents.js/tree/main/packages/document-schema.js" "document-schema.js"
42
+ click ooxml "https://github.com/ExaDev/documents.js/tree/main/packages/ooxml.js" "ooxml.js"
43
+ click odf "https://github.com/ExaDev/documents.js/tree/main/packages/odf.js" "odf.js"
44
+ click pdfcodec "https://github.com/ExaDev/documents.js/tree/main/packages/pdf-codec" "pdf-codec"
45
+ click mdcodec "https://github.com/ExaDev/documents.js/tree/main/packages/markdown-codec" "markdown-codec"
46
+ click bytecodec "https://github.com/ExaDev/documents.js/tree/main/packages/byte-codec" "byte-codec"
47
47
  click documents "https://github.com/ExaDev/documents.js" "documents.js"
48
- click outline "https://github.com/ExaDev/document-outline.js" "document-outline.js"
49
- click mcp "https://github.com/ExaDev/document-mcp" "document-mcp"
50
- click cli "https://github.com/ExaDev/document-cli" "document-cli"
48
+ click outline "https://github.com/ExaDev/documents.js/tree/main/packages/document-outline.js" "document-outline.js"
49
+ click mcp "https://github.com/ExaDev/documents.js/tree/main/packages/document-mcp" "document-mcp"
50
+ click cli "https://github.com/ExaDev/documents.js/tree/main/packages/document-cli" "document-cli"
51
51
 
52
52
  style mcp fill:#f9a825,stroke:#333,stroke-width:3px
53
53
  ```
@@ -211,9 +211,9 @@ Every tool that takes or produces document bytes goes through the same two hybri
211
211
  | `fonts` | Lists every source-embedded font face a docx/pptx/odt/odp/ods/odg document carries (family, weight/style, byte length). |
212
212
  | `describe_font_file` | Reads a standalone `.ttf`/`.otf` font file and reports the family/bold/italic triple it declares about itself. |
213
213
  | `docx_extras` | Reads a docx's own comments, footnotes, headers, footers, and numbering definitions — data the `ContentDocument` pivot cannot carry, so no other tool sees it. |
214
- | `pdf_inspect` | Parses a PDF and reports a summary (page count, per-page size and item-kind histogram, metadata, embedded image formats), or the entire parsed `LayoutDocument` with `full: true`. |
214
+ | `pdf_inspect` | Parses a PDF and reports a summary (page count, per-page size and item-kind histogram, metadata, embedded image formats), or with `full: true` the entire parsed `LayoutDocument` as plain JSON — no `$schema` stamp, since that family moved to `pdf-codec` at `document-schema.js` 4.0.0 and lost its schema-stamped envelope. |
215
215
  | `odm_to_pdf` | Converts a `.odm` (ODF master document) to PDF. A `.odm` never carries its chapters' content inline, so each chapter resolves via a caller-supplied `chapters` href-to-document map and/or a `chaptersDir` searched by basename. |
216
- | `from_package` | Rebuilds real document bytes in a target format from a `DocumentPackage` previously serialised to JSON (e.g. by a conversion tool's own `onDocument`/package-dump step). |
216
+ | `from_package` | Rebuilds real document bytes in a target format from a `DocumentPackage` previously serialised to JSON (e.g. by a conversion tool's own `onDocument`/package-dump step). Only a package genuinely written by a current dump round-trips: the `$schema` URI it carries pins the `document-schema.js` release that wrote it, and a pre-4.0.0 dump (the flat `{ formatVersion, content, pages }` envelope) is rejected with an error naming the pinned release, the flat-to-tree change, and the remedy — a layout-document dump gets its own pointer, naming the move to `pdf-codec`. |
217
217
  | `outline_document` | Projects a document's own table of contents as structured JSON: groups (`{ text, level, children }`) for headings, list items, slides, sheets, and draw pages, leaves (`{ kind, text }`) for the content between them. The outline is over the source's own content — read through `documents.js`'s `DocumentConverter` port and built by `document-outline.js`'s `buildOutline`. |
218
218
  | `odb_tables` | Lists every table an embedded `.odb` database declares — column names, types, and row data — across every storage tier `documents.js` supports (HSQLDB TEXT/CACHED/BINARY, Firebird gbak backups). |
219
219
  | `odb_forms` | Lists every form an `.odb` database declares, with each form's own data source and field-bound controls. |
@@ -226,14 +226,18 @@ Every tool that takes or produces document bytes goes through the same two hybri
226
226
  ## References
227
227
 
228
228
  - [documents.js](https://github.com/ExaDev/documents.js) — the library this server exposes.
229
- - [document-outline.js](https://github.com/ExaDev/document-outline.js) — the artefact-utilities package over document-schema.js's tree-form `DocumentPackage` whose `buildOutline` powers `outline_document`.
230
- - [document-cli](https://github.com/ExaDev/document-cli) — the sibling CLI/TUI over the same library, whose toolchain this repository's scaffold mirrors.
229
+ - [document-outline.js](../document-outline.js/README.md) — the artefact-utilities package over document-schema.js's tree-form `DocumentPackage` whose `buildOutline` powers `outline_document`.
230
+ - [document-cli](../document-cli/README.md) — the sibling CLI/TUI over the same library, whose toolchain this repository's scaffold mirrors.
231
231
  - [Model Context Protocol](https://modelcontextprotocol.io) — the protocol this server implements, via [`@modelcontextprotocol/server`](https://www.npmjs.com/package/@modelcontextprotocol/server).
232
232
 
233
233
  ## Gotchas
234
234
 
235
235
  - **Runtime dependencies are `documents.js` + `document-outline.js` + `@modelcontextprotocol/server` + `zod` only; `pdf-codec` and `odf.js` are devDependencies (test-support only).** `document-outline.js` is the one dependency beyond the server stack itself: `outline_document` imports `buildOutline`/`outlineLeafText` from it, and documents.js deliberately does not re-export them (the outline projection lives in the family's artefact-utilities package, which depends only on `document-schema.js` — already a transitive dependency via documents.js — so it adds no second copy of anything). Every runtime reach into `pdf-codec`/`odf.js` — `ProvidedFont`/`FontSubstitution`/`describeFontFace`/the `WinAnsi` substitution shape — goes through `documents.js`'s own re-exports, so a published install pulls in no direct `pdf-codec`/`odf.js` dependency. `odf.js` survives in `devDependencies` solely because `src/test-support/odm-fixture.ts` and `src/test-support/embedded-font-fixture.ts` build real ODF package fixtures from its low-level XML primitives (`zipPackage`/`el`/`rootElement`), and `src/test-support/` is excluded from the `tsdown` build — only `src/index.ts` and `src/bin.ts` are entry points — so neither fixture module ever ships in `dist/`.
236
236
 
237
+ ## Contributing
238
+
239
+ Release, CI, and commit-message conventions are all workspace-wide, not package-local — see the [monorepo root README](../../README.md#releases) for the release mechanism and [its Contributing section](../../README.md#contributing) for the shared git hooks and history conventions. Work inside `packages/document-mcp/`.
240
+
237
241
  ## License
238
242
 
239
243
  MIT
package/dist/bin.js CHANGED
@@ -8,7 +8,7 @@ import { existsSync, readFileSync } from "node:fs";
8
8
  import { basename, join } from "node:path";
9
9
  import { buildOutline, isOutlineNode, outlineLeafText } from "document-outline.js";
10
10
  //#region package.json
11
- var version = "2.1.21";
11
+ var version = "2.1.23";
12
12
  //#endregion
13
13
  //#region src/io/document-input.ts
14
14
  const EXTENSION_TO_FORMAT = {
package/dist/index.cjs CHANGED
@@ -7,7 +7,7 @@ let node_fs = require("node:fs");
7
7
  let node_path = require("node:path");
8
8
  let document_outline_js = require("document-outline.js");
9
9
  //#region package.json
10
- var version = "2.1.21";
10
+ var version = "2.1.23";
11
11
  //#endregion
12
12
  //#region src/io/document-input.ts
13
13
  const EXTENSION_TO_FORMAT = {
package/dist/index.js CHANGED
@@ -6,7 +6,7 @@ import { existsSync, readFileSync } from "node:fs";
6
6
  import { basename, join } from "node:path";
7
7
  import { buildOutline, isOutlineNode, outlineLeafText } from "document-outline.js";
8
8
  //#region package.json
9
- var version = "2.1.21";
9
+ var version = "2.1.23";
10
10
  //#endregion
11
11
  //#region src/io/document-input.ts
12
12
  const EXTENSION_TO_FORMAT = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "document-mcp",
3
- "version": "2.1.21",
3
+ "version": "2.1.23",
4
4
  "description": "MCP (Model Context Protocol) server exposing documents.js's document-conversion, .odb, metadata, and font tooling as MCP tools.",
5
5
  "type": "module",
6
6
  "repository": {
@@ -8,9 +8,9 @@
8
8
  "url": "git+https://github.com/ExaDev/documents.js.git",
9
9
  "directory": "packages/document-mcp"
10
10
  },
11
- "homepage": "https://github.com/ExaDev/document-mcp#readme",
11
+ "homepage": "https://github.com/ExaDev/documents.js/tree/main/packages/document-mcp",
12
12
  "bugs": {
13
- "url": "https://github.com/ExaDev/document-mcp/issues"
13
+ "url": "https://github.com/ExaDev/documents.js/issues"
14
14
  },
15
15
  "bin": {
16
16
  "document-mcp": "./dist/bin.js"
@@ -86,8 +86,8 @@
86
86
  "packageManager": "pnpm@11.6.0",
87
87
  "dependencies": {
88
88
  "@modelcontextprotocol/server": "^2.0.0",
89
- "document-outline.js": "^1.0.1",
90
- "documents.js": "^4.0.21",
89
+ "document-outline.js": "^1.0.3",
90
+ "documents.js": "^4.0.23",
91
91
  "zod": "^4.2.0"
92
92
  },
93
93
  "devDependencies": {
@@ -106,8 +106,8 @@
106
106
  "globals": "^17.8.0",
107
107
  "husky": "^9.1.7",
108
108
  "lint-staged": "^17.3.0",
109
- "odf.js": "^5.0.4",
110
- "pdf-codec": "^3.0.9",
109
+ "odf.js": "^5.0.6",
110
+ "pdf-codec": "^3.0.11",
111
111
  "publint": "^0.3.22",
112
112
  "semantic-release": "^25.0.8",
113
113
  "tsdown": "^0.22.14",