document-mcp 4.10.1 → 4.11.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 +4 -0
- package/dist/bin.js +12 -4
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -187,6 +187,10 @@ Then add the server URL (e.g., `https://your-host:3000/mcp`) as a connector in C
|
|
|
187
187
|
|
|
188
188
|
> **Security note:** this HTTP listener has no authentication and no Host/Origin allowlisting of its own — anyone who can reach it can call every tool, including ones that read and write arbitrary filesystem paths. It is safe by default only because it binds to loopback; whatever fronts it for remote access (tunnel, reverse proxy) is responsible for authenticating callers before traffic ever reaches this process.
|
|
189
189
|
|
|
190
|
+
### Standalone binary
|
|
191
|
+
|
|
192
|
+
Every release also attaches a Node [single-executable application](https://nodejs.org/api/single-executable-applications.html) build for Linux, macOS, and Windows to that release's own GitHub Release assets — the entire server and its dependencies embedded in one file, needing no Node.js install or `npx` at all. It supports both `stdio` and `--transport http` exactly as above; point an MCP client's `command` at the downloaded binary directly instead of `npx`/`node`. Download the asset matching your platform from the package's tag on the [Releases page](https://github.com/ExaDev/documents.js/releases) and run it directly (`chmod +x` on Linux/macOS first).
|
|
193
|
+
|
|
190
194
|
### Development
|
|
191
195
|
|
|
192
196
|
Requires Node.js `>=20` and pnpm `11.6.0` (pinned via `packageManager` in `package.json`).
|
package/dist/bin.js
CHANGED
|
@@ -6,7 +6,7 @@ import { McpServer, createMcpHandler } from "@modelcontextprotocol/server";
|
|
|
6
6
|
import { computeFormulaOperation, convertDocumentOperation, describeFontFileOperation, documentAppendParagraphsOperation, documentCreateOperation, docxExtrasOperation, fontsOperation, fromPackageOperation, listDocumentConversionsOperation, metadataReadOperation, metadataWriteOperation, odbFormsOperation, odbQueryOperation, odbRenderReportOperation, odbReportsOperation, odbTablesOperation, odbToCsvOperation, odbToXlsxOperation, odmToPdfOperation, outlineDocumentOperation, pdfInspectOperation } from "document-operations";
|
|
7
7
|
import { OdbReportNotSpecifiedError, OdmUnresolvedSectionError } from "documents.js";
|
|
8
8
|
//#region package.json
|
|
9
|
-
var version = "4.
|
|
9
|
+
var version = "4.11.0";
|
|
10
10
|
//#endregion
|
|
11
11
|
//#region src/register-operation.ts
|
|
12
12
|
function toErrorResult(error) {
|
|
@@ -172,7 +172,7 @@ function serveHttp(port) {
|
|
|
172
172
|
});
|
|
173
173
|
}
|
|
174
174
|
//#endregion
|
|
175
|
-
//#region src/
|
|
175
|
+
//#region src/cli.ts
|
|
176
176
|
const DEFAULT_HTTP_PORT = 3e3;
|
|
177
177
|
function readFlag(args, name) {
|
|
178
178
|
const prefix = `--${name}=`;
|
|
@@ -190,6 +190,11 @@ function parsePort(raw) {
|
|
|
190
190
|
if (!Number.isInteger(port) || String(port) !== raw.trim() || port < 0 || port > 65535) throw new Error(`--port must be an integer between 0 and 65535, got "${raw}"`);
|
|
191
191
|
return port;
|
|
192
192
|
}
|
|
193
|
+
/**
|
|
194
|
+
* The real CLI entry logic, shared by both distribution shapes this package ships: `src/bin.ts` (the published npm `bin`, run under a real Node.js install) and `src/sea-entry.ts` (bundled into a Node single-executable application, which embeds its own Node runtime). Node's SEA feature runs only a CommonJS entry with no top-level await (see that file's own comment), so this function itself contains no top-level await of its own -- only `bin.ts` awaits calling it, at its own top level, which SEA never sees.
|
|
195
|
+
*
|
|
196
|
+
* Returns the bound `http.Server` for the `--transport http` path so a caller with a reason to stop it again (a test binding an ephemeral port for the duration of one assertion) can; `undefined` for `--transport stdio`, which has no equivalent handle to return -- `serveStdio` wires the process's own stdin/stdout directly and keeps the process alive on its own.
|
|
197
|
+
*/
|
|
193
198
|
async function main() {
|
|
194
199
|
const args = process.argv.slice(2);
|
|
195
200
|
const transport = readFlag(args, "transport") ?? "stdio";
|
|
@@ -199,13 +204,16 @@ async function main() {
|
|
|
199
204
|
}
|
|
200
205
|
if (transport === "http") {
|
|
201
206
|
const portArg = readFlag(args, "port");
|
|
202
|
-
const
|
|
207
|
+
const httpServer = await serveHttp(portArg === void 0 ? DEFAULT_HTTP_PORT : parsePort(portArg));
|
|
208
|
+
const address = httpServer.address();
|
|
203
209
|
if (address === null || typeof address === "string") throw new Error("Expected the HTTP server to bind a TCP address, not a pipe or Unix socket");
|
|
204
210
|
console.error(`document-mcp listening on http://127.0.0.1:${String(address.port)}${MCP_HTTP_PATH}`);
|
|
205
|
-
return;
|
|
211
|
+
return httpServer;
|
|
206
212
|
}
|
|
207
213
|
throw new Error(`Unknown --transport "${transport}". Supported values: stdio, http.`);
|
|
208
214
|
}
|
|
215
|
+
//#endregion
|
|
216
|
+
//#region src/bin.ts
|
|
209
217
|
await main();
|
|
210
218
|
//#endregion
|
|
211
219
|
export {};
|
package/dist/index.cjs
CHANGED
|
@@ -3,7 +3,7 @@ let _modelcontextprotocol_server = require("@modelcontextprotocol/server");
|
|
|
3
3
|
let document_operations = require("document-operations");
|
|
4
4
|
let documents_js = require("documents.js");
|
|
5
5
|
//#region package.json
|
|
6
|
-
var version = "4.
|
|
6
|
+
var version = "4.11.0";
|
|
7
7
|
//#endregion
|
|
8
8
|
//#region src/register-operation.ts
|
|
9
9
|
function toErrorResult(error) {
|
package/dist/index.js
CHANGED
|
@@ -2,7 +2,7 @@ import { McpServer } from "@modelcontextprotocol/server";
|
|
|
2
2
|
import { computeFormulaOperation, convertDocumentOperation, describeFontFileOperation, documentAppendParagraphsOperation, documentCreateOperation, docxExtrasOperation, fontsOperation, fromPackageOperation, listDocumentConversionsOperation, metadataReadOperation, metadataWriteOperation, odbFormsOperation, odbQueryOperation, odbRenderReportOperation, odbReportsOperation, odbTablesOperation, odbToCsvOperation, odbToXlsxOperation, odmToPdfOperation, outlineDocumentOperation, pdfInspectOperation } from "document-operations";
|
|
3
3
|
import { OdbReportNotSpecifiedError, OdmUnresolvedSectionError } from "documents.js";
|
|
4
4
|
//#region package.json
|
|
5
|
-
var version = "4.
|
|
5
|
+
var version = "4.11.0";
|
|
6
6
|
//#endregion
|
|
7
7
|
//#region src/register-operation.ts
|
|
8
8
|
function toErrorResult(error) {
|
package/package.json
CHANGED