document-mcp 1.4.0 → 1.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/dist/bin.js +4 -5
- package/dist/index.cjs +3 -4
- package/dist/index.js +4 -5
- package/package.json +3 -3
package/dist/bin.js
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
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, 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";
|
|
4
|
+
import { DocumentFormatSchema, OdbReportNotSpecifiedError, OdmUnresolvedSectionError, UnrecognizedDocumentSchemaError, base64ToBytes, buildDocumentBytes, bytesToBase64, createLocalDocumentConverter, decodeOdbPackage, decodePackage, describeFontFace, 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
|
-
import { readFontFace } from "pdf-codec";
|
|
8
7
|
import { existsSync, readFileSync } from "node:fs";
|
|
9
8
|
import { basename, join } from "node:path";
|
|
10
9
|
//#region package.json
|
|
11
|
-
var version = "1.4.
|
|
10
|
+
var version = "1.4.1";
|
|
12
11
|
//#endregion
|
|
13
12
|
//#region src/io/document-input.ts
|
|
14
13
|
const EXTENSION_TO_FORMAT = {
|
|
@@ -252,7 +251,7 @@ function errorResult$1(message) {
|
|
|
252
251
|
isError: true
|
|
253
252
|
};
|
|
254
253
|
}
|
|
255
|
-
/** errorResult's counterpart for a caught exception: UnsupportedFontSourceFormatError (extractSourceFontsForFormat rejecting a format with no source-embedded-font concept -- xlsx/pdf/markdown/odf) and FontFaceParseError (
|
|
254
|
+
/** errorResult's counterpart for a caught exception: UnsupportedFontSourceFormatError (extractSourceFontsForFormat rejecting a format with no source-embedded-font concept -- xlsx/pdf/markdown/odf) and FontFaceParseError (describeFontFace rejecting bytes that are not a recognised sfnt font, or a .ttc collection) both carry a self-contained, already-actionable message, so there is nothing to add beyond surfacing it verbatim. */
|
|
256
255
|
function toErrorResult$1(error) {
|
|
257
256
|
return errorResult$1(error instanceof Error ? error.message : String(error));
|
|
258
257
|
}
|
|
@@ -291,7 +290,7 @@ function registerFontTools(server) {
|
|
|
291
290
|
}, async ({ source }) => {
|
|
292
291
|
try {
|
|
293
292
|
const { bytes, source: label } = await resolveFontFileInput(source);
|
|
294
|
-
const face =
|
|
293
|
+
const face = describeFontFace(bytes, label);
|
|
295
294
|
return jsonResult({
|
|
296
295
|
family: face.family,
|
|
297
296
|
bold: face.bold,
|
package/dist/index.cjs
CHANGED
|
@@ -3,11 +3,10 @@ let _modelcontextprotocol_server = require("@modelcontextprotocol/server");
|
|
|
3
3
|
let documents_js = require("documents.js");
|
|
4
4
|
let zod = require("zod");
|
|
5
5
|
let node_fs_promises = require("node:fs/promises");
|
|
6
|
-
let pdf_codec = require("pdf-codec");
|
|
7
6
|
let node_fs = require("node:fs");
|
|
8
7
|
let node_path = require("node:path");
|
|
9
8
|
//#region package.json
|
|
10
|
-
var version = "1.4.
|
|
9
|
+
var version = "1.4.1";
|
|
11
10
|
//#endregion
|
|
12
11
|
//#region src/io/document-input.ts
|
|
13
12
|
const EXTENSION_TO_FORMAT = {
|
|
@@ -251,7 +250,7 @@ function errorResult$1(message) {
|
|
|
251
250
|
isError: true
|
|
252
251
|
};
|
|
253
252
|
}
|
|
254
|
-
/** errorResult's counterpart for a caught exception: UnsupportedFontSourceFormatError (extractSourceFontsForFormat rejecting a format with no source-embedded-font concept -- xlsx/pdf/markdown/odf) and FontFaceParseError (
|
|
253
|
+
/** errorResult's counterpart for a caught exception: UnsupportedFontSourceFormatError (extractSourceFontsForFormat rejecting a format with no source-embedded-font concept -- xlsx/pdf/markdown/odf) and FontFaceParseError (describeFontFace rejecting bytes that are not a recognised sfnt font, or a .ttc collection) both carry a self-contained, already-actionable message, so there is nothing to add beyond surfacing it verbatim. */
|
|
255
254
|
function toErrorResult$1(error) {
|
|
256
255
|
return errorResult$1(error instanceof Error ? error.message : String(error));
|
|
257
256
|
}
|
|
@@ -290,7 +289,7 @@ function registerFontTools(server) {
|
|
|
290
289
|
}, async ({ source }) => {
|
|
291
290
|
try {
|
|
292
291
|
const { bytes, source: label } = await resolveFontFileInput(source);
|
|
293
|
-
const face = (0,
|
|
292
|
+
const face = (0, documents_js.describeFontFace)(bytes, label);
|
|
294
293
|
return jsonResult({
|
|
295
294
|
family: face.family,
|
|
296
295
|
bold: face.bold,
|
package/dist/index.js
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import { McpServer } from "@modelcontextprotocol/server";
|
|
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";
|
|
2
|
+
import { DocumentFormatSchema, OdbReportNotSpecifiedError, OdmUnresolvedSectionError, UnrecognizedDocumentSchemaError, base64ToBytes, buildDocumentBytes, bytesToBase64, createLocalDocumentConverter, decodeOdbPackage, decodePackage, describeFontFace, 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
|
-
import { readFontFace } from "pdf-codec";
|
|
6
5
|
import { existsSync, readFileSync } from "node:fs";
|
|
7
6
|
import { basename, join } from "node:path";
|
|
8
7
|
//#region package.json
|
|
9
|
-
var version = "1.4.
|
|
8
|
+
var version = "1.4.1";
|
|
10
9
|
//#endregion
|
|
11
10
|
//#region src/io/document-input.ts
|
|
12
11
|
const EXTENSION_TO_FORMAT = {
|
|
@@ -250,7 +249,7 @@ function errorResult$1(message) {
|
|
|
250
249
|
isError: true
|
|
251
250
|
};
|
|
252
251
|
}
|
|
253
|
-
/** errorResult's counterpart for a caught exception: UnsupportedFontSourceFormatError (extractSourceFontsForFormat rejecting a format with no source-embedded-font concept -- xlsx/pdf/markdown/odf) and FontFaceParseError (
|
|
252
|
+
/** errorResult's counterpart for a caught exception: UnsupportedFontSourceFormatError (extractSourceFontsForFormat rejecting a format with no source-embedded-font concept -- xlsx/pdf/markdown/odf) and FontFaceParseError (describeFontFace rejecting bytes that are not a recognised sfnt font, or a .ttc collection) both carry a self-contained, already-actionable message, so there is nothing to add beyond surfacing it verbatim. */
|
|
254
253
|
function toErrorResult$1(error) {
|
|
255
254
|
return errorResult$1(error instanceof Error ? error.message : String(error));
|
|
256
255
|
}
|
|
@@ -289,7 +288,7 @@ function registerFontTools(server) {
|
|
|
289
288
|
}, async ({ source }) => {
|
|
290
289
|
try {
|
|
291
290
|
const { bytes, source: label } = await resolveFontFileInput(source);
|
|
292
|
-
const face =
|
|
291
|
+
const face = describeFontFace(bytes, label);
|
|
293
292
|
return jsonResult({
|
|
294
293
|
family: face.family,
|
|
295
294
|
bold: face.bold,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "document-mcp",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.1",
|
|
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": {
|
|
@@ -85,8 +85,7 @@
|
|
|
85
85
|
"packageManager": "pnpm@11.6.0",
|
|
86
86
|
"dependencies": {
|
|
87
87
|
"@modelcontextprotocol/server": "^2.0.0",
|
|
88
|
-
"documents.js": "^1.
|
|
89
|
-
"pdf-codec": "^2.0.0",
|
|
88
|
+
"documents.js": "^1.95.1",
|
|
90
89
|
"zod": "^4.2.0"
|
|
91
90
|
},
|
|
92
91
|
"devDependencies": {
|
|
@@ -105,6 +104,7 @@
|
|
|
105
104
|
"husky": "^9.1.7",
|
|
106
105
|
"lint-staged": "^17.3.0",
|
|
107
106
|
"odf.js": "^2.3.1",
|
|
107
|
+
"pdf-codec": "^2.1.1",
|
|
108
108
|
"publint": "^0.3.22",
|
|
109
109
|
"semantic-release": "^25.0.8",
|
|
110
110
|
"tsdown": "^0.22.14",
|