document-mcp 1.1.6 → 1.2.0

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
@@ -4,7 +4,7 @@
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.
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.
8
8
 
9
9
  ```mermaid
10
10
  graph TD
@@ -91,7 +91,7 @@ Or, for local development against a checkout of this repository rather than the
91
91
 
92
92
  Every tool that takes or produces document bytes goes through the same two hybrid shapes, documented once here rather than repeated per tool below.
93
93
 
94
- **Input** (`DocumentInput`) is a union: either a filesystem `path` (the format is inferred from the file extension — `docx`, `pptx`, `xlsx`, `odt`, `odp`, `ods`, `odg`, `odf`, `md`/`markdown`, `pdf`), or inline `bytesBase64` plus an explicit `format` (required, since inline bytes carry no filename to infer one from). `.odb` tools are the one exception: a `.odb` has no single `DocumentFormat` of its own (it is a database front end, not a document — tables, saved queries, and reports are three unrelated output shapes), so their `source.path`/`source.bytesBase64` bytes are read directly with no format inference at all.
94
+ **Input** (`DocumentInput`) is a union: either a filesystem `path` (the format is inferred from the file extension — `docx`, `pptx`, `xlsx`, `odt`, `odp`, `ods`, `odg`, `odf`, `md`/`markdown`, `pdf`), or inline `bytesBase64` plus an explicit `format` (required, since inline bytes carry no filename to infer one from). Each ODF/OOXML template and macro-enabled variant also reads as its base format: `.ott`/`.ots`/`.otp`/`.otg`/`.otf` as `odt`/`ods`/`odp`/`odg`/`odf`, and `.dotx`/`.potx`/`.xltx` (templates) or `.docm`/`.xlsm`/`.pptm` (macro-enabled) as their OOXML base — a template is the same package with a `-template` mimetype, and a macro-enabled file carries a `vbaProject` part this library reads past without executing or re-emitting. `.odb` tools are the one exception: a `.odb` has no single `DocumentFormat` of its own (it is a database front end, not a document — tables, saved queries, and reports are three unrelated output shapes), so their `source.path`/`source.bytesBase64` bytes are read directly with no format inference at all.
95
95
 
96
96
  **Output** (`DocumentOutput`), on every tool that produces a document, is a single optional `outputPath`: supply it to have the tool write the result to that filesystem path (the response then reports `{ path, byteLength }`); omit it to receive the bytes inline instead (`{ bytesBase64, byteLength }`, flagged `large: true` above 5 MB — advisory only, the bytes are never truncated or refused).
97
97
 
@@ -102,7 +102,7 @@ Every tool that takes or produces document bytes goes through the same two hybri
102
102
  | `convert_document` | Converts a document from one supported format to another via `documents.js`'s `DocumentConverter` port — docx, pptx, xlsx, odt, odp, ods, odg, odf, markdown, and pdf. Not every `(source, targetFormat)` pair is direct; call `list_document_conversions` first. |
103
103
  | `list_document_conversions` | Lists every `(source, target)` format pair `convert_document` actually supports. |
104
104
  | `metadata_read` | Reads a document's title/author/subject/keywords/creator/producer/created-and-modified timestamps. Works across every supported format, including xlsx and odf. |
105
- | `metadata_write` | Patches a document's title/author/subject/keywords in place. Does not convert format — source and target format must match (or both be `pdf`); xlsx and odf are rejected as either. |
105
+ | `metadata_write` | Patches a document's title/author/subject/keywords in place. Does not convert format — source and target format must match (or both be `pdf`); odf (a standalone formula document) is rejected as either, since it has no write path back out at all. |
106
106
  | `fonts` | Lists every source-embedded font face a docx/pptx/odt/odp/ods/odg document carries (family, weight/style, byte length). |
107
107
  | `describe_font_file` | Reads a standalone `.ttf`/`.otf` font file and reports the family/bold/italic triple it declares about itself. |
108
108
  | `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. |
package/dist/bin.js CHANGED
@@ -8,18 +8,29 @@ import { readFontFace } from "pdf-codec";
8
8
  import { existsSync, readFileSync } from "node:fs";
9
9
  import { basename, join } from "node:path";
10
10
  //#region package.json
11
- var version = "1.1.6";
11
+ var version = "1.2.0";
12
12
  //#endregion
13
13
  //#region src/io/document-input.ts
14
14
  const EXTENSION_TO_FORMAT = {
15
15
  docx: "docx",
16
+ dotx: "docx",
17
+ docm: "docx",
16
18
  pptx: "pptx",
19
+ potx: "pptx",
20
+ pptm: "pptx",
17
21
  xlsx: "xlsx",
22
+ xltx: "xlsx",
23
+ xlsm: "xlsx",
18
24
  odt: "odt",
25
+ ott: "odt",
19
26
  odp: "odp",
27
+ otp: "odp",
20
28
  ods: "ods",
29
+ ots: "ods",
21
30
  odg: "odg",
31
+ otg: "odg",
22
32
  odf: "odf",
33
+ otf: "odf",
23
34
  markdown: "markdown",
24
35
  md: "markdown",
25
36
  pdf: "pdf"
@@ -372,7 +383,7 @@ function registerMetadataTools(server) {
372
383
  });
373
384
  server.registerTool("metadata_write", {
374
385
  title: "Write document metadata",
375
- description: "Patches a document's own title/author/subject/keywords, leaving every other field and every other flag as-is. Does not convert format -- the source document's own format and targetFormat must match (or both be 'pdf'); xlsx and odf are rejected outright as either a source or a target, in both directions. Convert the document to a different format first (e.g. with a documents.js conversion tool) if metadata needs to be set on the result of a format change.",
386
+ description: "Patches a document's own title/author/subject/keywords, leaving every other field and every other flag as-is. Does not convert format -- the source document's own format and targetFormat must match (or both be 'pdf'); odf (a standalone formula document) is rejected outright as either a source or a target, since it has no write path back out at all. Convert the document to a different format first (e.g. with a documents.js conversion tool) if metadata needs to be set on the result of a format change.",
376
387
  inputSchema: z.object({
377
388
  source: DocumentInputSchema.describe("The document to patch metadata on."),
378
389
  targetFormat: DocumentFormatSchema.describe("The format to write the patched document back out as -- must match the source document's own format (or both be 'pdf'). metadata_write never converts format."),
package/dist/index.cjs CHANGED
@@ -7,18 +7,29 @@ let pdf_codec = require("pdf-codec");
7
7
  let node_fs = require("node:fs");
8
8
  let node_path = require("node:path");
9
9
  //#region package.json
10
- var version = "1.1.6";
10
+ var version = "1.2.0";
11
11
  //#endregion
12
12
  //#region src/io/document-input.ts
13
13
  const EXTENSION_TO_FORMAT = {
14
14
  docx: "docx",
15
+ dotx: "docx",
16
+ docm: "docx",
15
17
  pptx: "pptx",
18
+ potx: "pptx",
19
+ pptm: "pptx",
16
20
  xlsx: "xlsx",
21
+ xltx: "xlsx",
22
+ xlsm: "xlsx",
17
23
  odt: "odt",
24
+ ott: "odt",
18
25
  odp: "odp",
26
+ otp: "odp",
19
27
  ods: "ods",
28
+ ots: "ods",
20
29
  odg: "odg",
30
+ otg: "odg",
21
31
  odf: "odf",
32
+ otf: "odf",
22
33
  markdown: "markdown",
23
34
  md: "markdown",
24
35
  pdf: "pdf"
@@ -371,7 +382,7 @@ function registerMetadataTools(server) {
371
382
  });
372
383
  server.registerTool("metadata_write", {
373
384
  title: "Write document metadata",
374
- description: "Patches a document's own title/author/subject/keywords, leaving every other field and every other flag as-is. Does not convert format -- the source document's own format and targetFormat must match (or both be 'pdf'); xlsx and odf are rejected outright as either a source or a target, in both directions. Convert the document to a different format first (e.g. with a documents.js conversion tool) if metadata needs to be set on the result of a format change.",
385
+ description: "Patches a document's own title/author/subject/keywords, leaving every other field and every other flag as-is. Does not convert format -- the source document's own format and targetFormat must match (or both be 'pdf'); odf (a standalone formula document) is rejected outright as either a source or a target, since it has no write path back out at all. Convert the document to a different format first (e.g. with a documents.js conversion tool) if metadata needs to be set on the result of a format change.",
375
386
  inputSchema: zod.z.object({
376
387
  source: DocumentInputSchema.describe("The document to patch metadata on."),
377
388
  targetFormat: documents_js.DocumentFormatSchema.describe("The format to write the patched document back out as -- must match the source document's own format (or both be 'pdf'). metadata_write never converts format."),
package/dist/index.js CHANGED
@@ -6,18 +6,29 @@ import { readFontFace } from "pdf-codec";
6
6
  import { existsSync, readFileSync } from "node:fs";
7
7
  import { basename, join } from "node:path";
8
8
  //#region package.json
9
- var version = "1.1.6";
9
+ var version = "1.2.0";
10
10
  //#endregion
11
11
  //#region src/io/document-input.ts
12
12
  const EXTENSION_TO_FORMAT = {
13
13
  docx: "docx",
14
+ dotx: "docx",
15
+ docm: "docx",
14
16
  pptx: "pptx",
17
+ potx: "pptx",
18
+ pptm: "pptx",
15
19
  xlsx: "xlsx",
20
+ xltx: "xlsx",
21
+ xlsm: "xlsx",
16
22
  odt: "odt",
23
+ ott: "odt",
17
24
  odp: "odp",
25
+ otp: "odp",
18
26
  ods: "ods",
27
+ ots: "ods",
19
28
  odg: "odg",
29
+ otg: "odg",
20
30
  odf: "odf",
31
+ otf: "odf",
21
32
  markdown: "markdown",
22
33
  md: "markdown",
23
34
  pdf: "pdf"
@@ -370,7 +381,7 @@ function registerMetadataTools(server) {
370
381
  });
371
382
  server.registerTool("metadata_write", {
372
383
  title: "Write document metadata",
373
- description: "Patches a document's own title/author/subject/keywords, leaving every other field and every other flag as-is. Does not convert format -- the source document's own format and targetFormat must match (or both be 'pdf'); xlsx and odf are rejected outright as either a source or a target, in both directions. Convert the document to a different format first (e.g. with a documents.js conversion tool) if metadata needs to be set on the result of a format change.",
384
+ description: "Patches a document's own title/author/subject/keywords, leaving every other field and every other flag as-is. Does not convert format -- the source document's own format and targetFormat must match (or both be 'pdf'); odf (a standalone formula document) is rejected outright as either a source or a target, since it has no write path back out at all. Convert the document to a different format first (e.g. with a documents.js conversion tool) if metadata needs to be set on the result of a format change.",
374
385
  inputSchema: z.object({
375
386
  source: DocumentInputSchema.describe("The document to patch metadata on."),
376
387
  targetFormat: DocumentFormatSchema.describe("The format to write the patched document back out as -- must match the source document's own format (or both be 'pdf'). metadata_write never converts format."),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "document-mcp",
3
- "version": "1.1.6",
3
+ "version": "1.2.0",
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": {
@@ -69,7 +69,7 @@
69
69
  "packageManager": "pnpm@11.6.0",
70
70
  "dependencies": {
71
71
  "@modelcontextprotocol/server": "^2.0.0",
72
- "documents.js": "^1.79.0",
72
+ "documents.js": "^1.81.8",
73
73
  "pdf-codec": "^1.11.0",
74
74
  "zod": "^4.2.0"
75
75
  },