@modelcontextprotocol/server-pdf 1.1.0 → 1.1.2

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/index.js CHANGED
@@ -27263,6 +27263,7 @@ var require_lib4 = __commonJS((exports, module) => {
27263
27263
 
27264
27264
  // main.ts
27265
27265
  import fs from "node:fs";
27266
+ import path from "node:path";
27266
27267
 
27267
27268
  // ../../node_modules/@modelcontextprotocol/sdk/dist/esm/server/stdio.js
27268
27269
  import process3 from "node:process";
@@ -34131,8 +34132,8 @@ import {
34131
34132
  pathToFileUrl,
34132
34133
  fileUrlToPath,
34133
34134
  allowedLocalFiles,
34134
- allowedRemoteOrigins,
34135
- DEFAULT_PDF
34135
+ DEFAULT_PDF,
34136
+ allowedLocalDirs
34136
34137
  } from "./server.js";
34137
34138
  async function startStreamableHTTPServer(createServer2) {
34138
34139
  const port = parseInt(process.env.PORT ?? "3001", 10);
@@ -34202,17 +34203,22 @@ async function main() {
34202
34203
  const { urls, stdio } = parseArgs();
34203
34204
  for (const url of urls) {
34204
34205
  if (isFileUrl(url)) {
34205
- const filePath = fileUrlToPath(url);
34206
+ const filePath = path.resolve(fileUrlToPath(url));
34206
34207
  if (fs.existsSync(filePath)) {
34207
- allowedLocalFiles.add(filePath);
34208
- console.error(`[pdf-server] Registered local file: ${filePath}`);
34208
+ const s = fs.statSync(filePath);
34209
+ if (s.isFile()) {
34210
+ allowedLocalFiles.add(filePath);
34211
+ console.error(`[pdf-server] Registered local file: ${filePath}`);
34212
+ } else if (s.isDirectory()) {
34213
+ allowedLocalDirs.add(filePath);
34214
+ console.error(`[pdf-server] Registered local directory: ${filePath}`);
34215
+ }
34209
34216
  } else {
34210
34217
  console.error(`[pdf-server] Warning: File not found: ${filePath}`);
34211
34218
  }
34212
34219
  }
34213
34220
  }
34214
34221
  console.error(`[pdf-server] Ready (${urls.length} URL(s) configured)`);
34215
- console.error(`[pdf-server] Allowed origins: ${[...allowedRemoteOrigins].join(", ")}`);
34216
34222
  if (stdio) {
34217
34223
  await startStdioServer(createServer);
34218
34224
  } else {