document-mcp 1.1.1 → 1.1.3
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/dist/bin.js +5 -6
- package/dist/index.cjs +4 -5
- package/dist/index.js +5 -6
- package/package.json +3 -3
package/dist/bin.js
CHANGED
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { serveStdio } from "@modelcontextprotocol/server/stdio";
|
|
3
3
|
import { McpServer } from "@modelcontextprotocol/server";
|
|
4
|
-
import { DocumentFormatSchema, OdbReportNotSpecifiedError, OdmUnresolvedSectionError, UnrecognizedDocumentSchemaError, base64ToBytes, buildDocumentBytes, bytesToBase64, createLocalDocumentConverter, decodePackage, documentFromJson, evaluateSelect, extractSourceFontsForFormat, layoutDocumentWithSchema, odbReportToDocx, odbReportToOdt, odbReportToPdf, odbToCsv, odbToXlsx, odmToPdf, parseSelect, readDocumentMetadata, readDocxExtras, readOdbForms, readOdbInventory, readOdbReportContent, readOdbReports, readOdbTables, readPdf, setDocumentMetadata } from "documents.js";
|
|
4
|
+
import { DocumentFormatSchema, OdbReportNotSpecifiedError, OdmUnresolvedSectionError, UnrecognizedDocumentSchemaError, base64ToBytes, buildDocumentBytes, bytesToBase64, createLocalDocumentConverter, decodeOdbPackage, decodePackage, documentFromJson, evaluateSelect, extractSourceFontsForFormat, layoutDocumentWithSchema, odbReportToDocx, odbReportToOdt, odbReportToPdf, odbToCsv, odbToXlsx, odmToPdf, parseSelect, readDocumentMetadata, readDocxExtras, readOdbForms, readOdbInventory, readOdbReportContent, readOdbReports, readOdbTables, readPdf, setDocumentMetadata } from "documents.js";
|
|
5
5
|
import { z } from "zod";
|
|
6
6
|
import { readFile, writeFile } from "node:fs/promises";
|
|
7
7
|
import { readFontFace } from "pdf-codec";
|
|
8
|
-
import { decodePackage as decodePackage$1 } from "odf.js";
|
|
9
8
|
import { existsSync, readFileSync } from "node:fs";
|
|
10
9
|
import { basename, join } from "node:path";
|
|
11
10
|
//#region package.json
|
|
12
|
-
var version = "1.1.
|
|
11
|
+
var version = "1.1.3";
|
|
13
12
|
//#endregion
|
|
14
13
|
//#region src/io/document-input.ts
|
|
15
14
|
const EXTENSION_TO_FORMAT = {
|
|
@@ -414,9 +413,9 @@ async function resolveOdbBytes$1(source) {
|
|
|
414
413
|
}
|
|
415
414
|
return base64ToBytes(source.bytesBase64);
|
|
416
415
|
}
|
|
417
|
-
/** Resolves an .odb DocumentInput straight through to a decoded
|
|
416
|
+
/** Resolves an .odb DocumentInput straight through to a decoded Package (via documents.js's own decodeOdbPackage) -- the shape every read (as opposed to export) odb tool needs. */
|
|
418
417
|
async function resolveOdbPackage(source) {
|
|
419
|
-
return
|
|
418
|
+
return decodeOdbPackage(await resolveOdbBytes$1(source));
|
|
420
419
|
}
|
|
421
420
|
/** Resolves a saved query's own SQL text by name against the .odb's own db:queries (read via readOdbInventory) -- odb_query's own equivalent of document-cli's resolveQuerySql, for the case where the caller named a saved query rather than supplying SQL directly. Throws, naming every available query, when the name doesn't resolve -- see this module's own top-of-file note on why a thrown Error is the right shape here. */
|
|
422
421
|
function resolveSavedQuerySql(pkg, name) {
|
|
@@ -627,7 +626,7 @@ function registerOdbRenderReportTools(server) {
|
|
|
627
626
|
}, async ({ source, report, targetFormat, output, fonts }, ctx) => {
|
|
628
627
|
const { signal } = ctx.mcpReq;
|
|
629
628
|
const inputBytes = await resolveOdbBytes(source);
|
|
630
|
-
const pkg =
|
|
629
|
+
const pkg = decodeOdbPackage(inputBytes);
|
|
631
630
|
let content;
|
|
632
631
|
try {
|
|
633
632
|
content = readOdbReportContent(pkg, { report });
|
package/dist/index.cjs
CHANGED
|
@@ -4,11 +4,10 @@ let documents_js = require("documents.js");
|
|
|
4
4
|
let zod = require("zod");
|
|
5
5
|
let node_fs_promises = require("node:fs/promises");
|
|
6
6
|
let pdf_codec = require("pdf-codec");
|
|
7
|
-
let odf_js = require("odf.js");
|
|
8
7
|
let node_fs = require("node:fs");
|
|
9
8
|
let node_path = require("node:path");
|
|
10
9
|
//#region package.json
|
|
11
|
-
var version = "1.1.
|
|
10
|
+
var version = "1.1.3";
|
|
12
11
|
//#endregion
|
|
13
12
|
//#region src/io/document-input.ts
|
|
14
13
|
const EXTENSION_TO_FORMAT = {
|
|
@@ -413,9 +412,9 @@ async function resolveOdbBytes$1(source) {
|
|
|
413
412
|
}
|
|
414
413
|
return (0, documents_js.base64ToBytes)(source.bytesBase64);
|
|
415
414
|
}
|
|
416
|
-
/** Resolves an .odb DocumentInput straight through to a decoded
|
|
415
|
+
/** Resolves an .odb DocumentInput straight through to a decoded Package (via documents.js's own decodeOdbPackage) -- the shape every read (as opposed to export) odb tool needs. */
|
|
417
416
|
async function resolveOdbPackage(source) {
|
|
418
|
-
return (0,
|
|
417
|
+
return (0, documents_js.decodeOdbPackage)(await resolveOdbBytes$1(source));
|
|
419
418
|
}
|
|
420
419
|
/** Resolves a saved query's own SQL text by name against the .odb's own db:queries (read via readOdbInventory) -- odb_query's own equivalent of document-cli's resolveQuerySql, for the case where the caller named a saved query rather than supplying SQL directly. Throws, naming every available query, when the name doesn't resolve -- see this module's own top-of-file note on why a thrown Error is the right shape here. */
|
|
421
420
|
function resolveSavedQuerySql(pkg, name) {
|
|
@@ -626,7 +625,7 @@ function registerOdbRenderReportTools(server) {
|
|
|
626
625
|
}, async ({ source, report, targetFormat, output, fonts }, ctx) => {
|
|
627
626
|
const { signal } = ctx.mcpReq;
|
|
628
627
|
const inputBytes = await resolveOdbBytes(source);
|
|
629
|
-
const pkg = (0,
|
|
628
|
+
const pkg = (0, documents_js.decodeOdbPackage)(inputBytes);
|
|
630
629
|
let content;
|
|
631
630
|
try {
|
|
632
631
|
content = (0, documents_js.readOdbReportContent)(pkg, { report });
|
package/dist/index.js
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import { McpServer } from "@modelcontextprotocol/server";
|
|
2
|
-
import { DocumentFormatSchema, OdbReportNotSpecifiedError, OdmUnresolvedSectionError, UnrecognizedDocumentSchemaError, base64ToBytes, buildDocumentBytes, bytesToBase64, createLocalDocumentConverter, decodePackage, documentFromJson, evaluateSelect, extractSourceFontsForFormat, layoutDocumentWithSchema, odbReportToDocx, odbReportToOdt, odbReportToPdf, odbToCsv, odbToXlsx, odmToPdf, parseSelect, readDocumentMetadata, readDocxExtras, readOdbForms, readOdbInventory, readOdbReportContent, readOdbReports, readOdbTables, readPdf, setDocumentMetadata } from "documents.js";
|
|
2
|
+
import { DocumentFormatSchema, OdbReportNotSpecifiedError, OdmUnresolvedSectionError, UnrecognizedDocumentSchemaError, base64ToBytes, buildDocumentBytes, bytesToBase64, createLocalDocumentConverter, decodeOdbPackage, decodePackage, documentFromJson, evaluateSelect, extractSourceFontsForFormat, layoutDocumentWithSchema, odbReportToDocx, odbReportToOdt, odbReportToPdf, odbToCsv, odbToXlsx, odmToPdf, parseSelect, readDocumentMetadata, readDocxExtras, readOdbForms, readOdbInventory, readOdbReportContent, readOdbReports, readOdbTables, readPdf, setDocumentMetadata } from "documents.js";
|
|
3
3
|
import { z } from "zod";
|
|
4
4
|
import { readFile, writeFile } from "node:fs/promises";
|
|
5
5
|
import { readFontFace } from "pdf-codec";
|
|
6
|
-
import { decodePackage as decodePackage$1 } from "odf.js";
|
|
7
6
|
import { existsSync, readFileSync } from "node:fs";
|
|
8
7
|
import { basename, join } from "node:path";
|
|
9
8
|
//#region package.json
|
|
10
|
-
var version = "1.1.
|
|
9
|
+
var version = "1.1.3";
|
|
11
10
|
//#endregion
|
|
12
11
|
//#region src/io/document-input.ts
|
|
13
12
|
const EXTENSION_TO_FORMAT = {
|
|
@@ -412,9 +411,9 @@ async function resolveOdbBytes$1(source) {
|
|
|
412
411
|
}
|
|
413
412
|
return base64ToBytes(source.bytesBase64);
|
|
414
413
|
}
|
|
415
|
-
/** Resolves an .odb DocumentInput straight through to a decoded
|
|
414
|
+
/** Resolves an .odb DocumentInput straight through to a decoded Package (via documents.js's own decodeOdbPackage) -- the shape every read (as opposed to export) odb tool needs. */
|
|
416
415
|
async function resolveOdbPackage(source) {
|
|
417
|
-
return
|
|
416
|
+
return decodeOdbPackage(await resolveOdbBytes$1(source));
|
|
418
417
|
}
|
|
419
418
|
/** Resolves a saved query's own SQL text by name against the .odb's own db:queries (read via readOdbInventory) -- odb_query's own equivalent of document-cli's resolveQuerySql, for the case where the caller named a saved query rather than supplying SQL directly. Throws, naming every available query, when the name doesn't resolve -- see this module's own top-of-file note on why a thrown Error is the right shape here. */
|
|
420
419
|
function resolveSavedQuerySql(pkg, name) {
|
|
@@ -625,7 +624,7 @@ function registerOdbRenderReportTools(server) {
|
|
|
625
624
|
}, async ({ source, report, targetFormat, output, fonts }, ctx) => {
|
|
626
625
|
const { signal } = ctx.mcpReq;
|
|
627
626
|
const inputBytes = await resolveOdbBytes(source);
|
|
628
|
-
const pkg =
|
|
627
|
+
const pkg = decodeOdbPackage(inputBytes);
|
|
629
628
|
let content;
|
|
630
629
|
try {
|
|
631
630
|
content = readOdbReportContent(pkg, { report });
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "document-mcp",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.3",
|
|
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,8 +69,7 @@
|
|
|
69
69
|
"packageManager": "pnpm@11.6.0",
|
|
70
70
|
"dependencies": {
|
|
71
71
|
"@modelcontextprotocol/server": "^2.0.0",
|
|
72
|
-
"documents.js": "^1.
|
|
73
|
-
"odf.js": "^2.3.0",
|
|
72
|
+
"documents.js": "^1.79.0",
|
|
74
73
|
"pdf-codec": "^1.11.0",
|
|
75
74
|
"zod": "^4.2.0"
|
|
76
75
|
},
|
|
@@ -88,6 +87,7 @@
|
|
|
88
87
|
"globals": "^17.8.0",
|
|
89
88
|
"husky": "^9.1.7",
|
|
90
89
|
"lint-staged": "^17.3.0",
|
|
90
|
+
"odf.js": "^2.3.1",
|
|
91
91
|
"publint": "^0.3.22",
|
|
92
92
|
"semantic-release": "^25.0.8",
|
|
93
93
|
"tsdown": "^0.22.14",
|