document-mcp 4.9.3 → 4.10.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 +8 -6
- package/dist/bin.js +51 -1069
- package/dist/index.cjs +50 -1068
- package/dist/index.js +51 -1069
- package/package.json +3 -4
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 — plus [`document-compute.js`](../document-compute.js/README.md)'s units-typed formula evaluation — as MCP tools, so an MCP-speaking agent can convert, inspect, edit, and compute over docx/pptx/odt/odp/ods/odg/odf/pdf/odb/xlsx/markdown documents without writing TypeScript against either library directly.
|
|
6
6
|
|
|
7
|
-
`document-mcp` adds no conversion or editing logic of its own —
|
|
7
|
+
`document-mcp` adds no conversion or editing logic of its own — every tool is a thin `registerOperation()` wrapper (`src/register-operation.ts`) around a [`document-operations`](../document-operations/README.md) `DocumentOperation`: that package holds the actual dispatch to `documents.js`'s conversion functions, `DocumentConverter` port, and `.odb`/PDF readers, as one Zod schema plus one transport-agnostic `run()` per operation, shared with (eventually) a REST server and `document-cli`'s own flag parsing rather than defined here a second time. [`document-cli`](../document-cli/README.md) is the sibling frontend over the identical underlying operations — 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
|
|
@@ -17,13 +17,12 @@ graph TD
|
|
|
17
17
|
documents("documents.js")
|
|
18
18
|
outline("document-outline.js")
|
|
19
19
|
compute("document-compute.js")
|
|
20
|
+
operations("document-operations")
|
|
20
21
|
mcp("document-mcp")
|
|
21
22
|
cli("document-cli")
|
|
22
23
|
|
|
23
24
|
schema --> outline
|
|
24
|
-
outline --> mcp
|
|
25
25
|
schema --> compute
|
|
26
|
-
compute --> mcp
|
|
27
26
|
schema --> mcp
|
|
28
27
|
schema --> ooxml
|
|
29
28
|
schema --> odf
|
|
@@ -36,8 +35,10 @@ graph TD
|
|
|
36
35
|
mdcodec --> documents
|
|
37
36
|
bytecodec --> pdfcodec
|
|
38
37
|
bytecodec --> documents
|
|
39
|
-
documents -->
|
|
40
|
-
|
|
38
|
+
documents --> operations
|
|
39
|
+
outline --> operations
|
|
40
|
+
compute --> operations
|
|
41
|
+
operations --> mcp
|
|
41
42
|
documents --> cli
|
|
42
43
|
odf --> cli
|
|
43
44
|
pdfcodec --> cli
|
|
@@ -51,6 +52,7 @@ graph TD
|
|
|
51
52
|
click documents "https://github.com/ExaDev/documents.js" "documents.js"
|
|
52
53
|
click outline "https://github.com/ExaDev/documents.js/tree/main/packages/document-outline.js" "document-outline.js"
|
|
53
54
|
click compute "https://github.com/ExaDev/documents.js/tree/main/packages/document-compute.js" "document-compute.js"
|
|
55
|
+
click operations "https://github.com/ExaDev/documents.js/tree/main/packages/document-operations" "document-operations"
|
|
54
56
|
click mcp "https://github.com/ExaDev/documents.js/tree/main/packages/document-mcp" "document-mcp"
|
|
55
57
|
click cli "https://github.com/ExaDev/documents.js/tree/main/packages/document-cli" "document-cli"
|
|
56
58
|
|
|
@@ -243,7 +245,7 @@ Every tool that takes or produces document bytes goes through the same two hybri
|
|
|
243
245
|
|
|
244
246
|
## Gotchas
|
|
245
247
|
|
|
246
|
-
- **Runtime dependencies are `
|
|
248
|
+
- **Runtime dependencies are `document-operations` + `documents.js` + `@modelcontextprotocol/server` + `@modelcontextprotocol/node` + `zod` only; `pdf-codec`, `odf.js`, and `document-schema.js` are devDependencies (test-support only).** `@modelcontextprotocol/node` is the Node adapter (`toNodeHandler`) the `--transport http` listener uses to bridge `@modelcontextprotocol/server`'s web-standard `createMcpHandler` onto a plain `node:http` server — see [Remote transport](#remote-transport-http) above. Every tool's actual implementation — the conversion/editing/inspection/`.odb` logic previously defined directly in `src/tools/*.ts`, including its own reach into `document-outline.js`'s `buildOutline`/`outlineLeafText` and `document-compute.js`'s `evaluate()` — now lives in [`document-operations`](../document-operations/README.md) as a `DocumentOperation`; this package's own `src/tools/*.ts` are thin `registerOperation()` wrappers (`src/register-operation.ts`) that register each one as an MCP tool and, for the two operations whose own errors need MCP-specific enrichment (`odb_render_report`'s `OdbReportNotSpecifiedError`, `odm_to_pdf`'s `OdmUnresolvedSectionError`), a `mapError` hook. Every runtime reach into `pdf-codec`/`odf.js` — `ProvidedFont`/`FontSubstitution`/`describeFontFace`/the `WinAnsi` substitution shape — goes through `documents.js`'s own re-exports (by way of `document-operations`), so a published install pulls in no direct `pdf-codec`/`odf.js` dependency. `odf.js` and `document-schema.js` survive in `devDependencies` solely for this package's own test fixtures and `compute_formula`'s own test assertions (`document-schema.js`'s `assembleTree`/`ContentDocument`); `src/test-support/` is excluded from the `tsdown` build — only `src/index.ts` and `src/bin.ts` are entry points — so none of it ever ships in `dist/`.
|
|
247
249
|
|
|
248
250
|
## Contributing
|
|
249
251
|
|