@modelcontextprotocol/server-pdf 1.1.1 → 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,7 +34132,8 @@ import {
34131
34132
  pathToFileUrl,
34132
34133
  fileUrlToPath,
34133
34134
  allowedLocalFiles,
34134
- DEFAULT_PDF
34135
+ DEFAULT_PDF,
34136
+ allowedLocalDirs
34135
34137
  } from "./server.js";
34136
34138
  async function startStreamableHTTPServer(createServer2) {
34137
34139
  const port = parseInt(process.env.PORT ?? "3001", 10);
@@ -34201,10 +34203,16 @@ async function main() {
34201
34203
  const { urls, stdio } = parseArgs();
34202
34204
  for (const url of urls) {
34203
34205
  if (isFileUrl(url)) {
34204
- const filePath = fileUrlToPath(url);
34206
+ const filePath = path.resolve(fileUrlToPath(url));
34205
34207
  if (fs.existsSync(filePath)) {
34206
- allowedLocalFiles.add(filePath);
34207
- 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
+ }
34208
34216
  } else {
34209
34217
  console.error(`[pdf-server] Warning: File not found: ${filePath}`);
34210
34218
  }