@sylphx/pdf-reader-mcp 2.0.2 → 2.0.7
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 +14 -13
- package/dist/index.js +2 -12
- package/package.json +103 -104
package/README.md
CHANGED
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
<div align="center">
|
|
2
2
|
|
|
3
|
-
#
|
|
3
|
+
# 📄 @sylphx/pdf-reader-mcp
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
> Production-ready PDF processing server for AI agents
|
|
6
6
|
|
|
7
|
+
[](https://www.npmjs.com/package/@sylphx/pdf-reader-mcp)
|
|
8
|
+
[](https://opensource.org/licenses/MIT)
|
|
7
9
|
[](https://github.com/SylphxAI/pdf-reader-mcp/actions/workflows/ci.yml)
|
|
8
10
|
[](https://codecov.io/gh/SylphxAI/pdf-reader-mcp)
|
|
9
|
-
[](https://www.npmjs.com/package/@sylphx/pdf-reader-mcp)
|
|
10
11
|
[](https://pdf-reader-msu3esos4-sylphx.vercel.app)
|
|
12
|
+
[](https://www.typescriptlang.org/)
|
|
11
13
|
[](https://www.npmjs.com/package/@sylphx/pdf-reader-mcp)
|
|
12
|
-
[](https://opensource.org/licenses/MIT)
|
|
13
14
|
|
|
14
15
|
**5-10x faster parallel processing** • **Y-coordinate content ordering** • **94%+ test coverage** • **103 tests passing**
|
|
15
16
|
|
|
@@ -780,12 +781,12 @@ This project uses the following [@sylphx](https://github.com/SylphxAI) packages:
|
|
|
780
781
|
|
|
781
782
|
---
|
|
782
783
|
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
</
|
|
784
|
+
## Star History
|
|
785
|
+
|
|
786
|
+
[](https://star-history.com/#SylphxAI/pdf-reader-mcp&Date)
|
|
787
|
+
|
|
788
|
+
---
|
|
789
|
+
|
|
790
|
+
<div align="center">
|
|
791
|
+
<sub>Built with ❤️ by <a href="https://github.com/SylphxAI">Sylphx</a></sub>
|
|
792
|
+
</div>
|
package/dist/index.js
CHANGED
|
@@ -329,24 +329,14 @@ class PdfError extends Error {
|
|
|
329
329
|
}
|
|
330
330
|
|
|
331
331
|
// src/utils/pathUtils.ts
|
|
332
|
-
import os from "node:os";
|
|
333
332
|
import path from "node:path";
|
|
334
333
|
var PROJECT_ROOT = process.cwd();
|
|
335
|
-
var ALLOWED_ROOTS = [PROJECT_ROOT, os.homedir()];
|
|
336
334
|
var resolvePath = (userPath) => {
|
|
337
335
|
if (typeof userPath !== "string") {
|
|
338
336
|
throw new PdfError(-32602 /* InvalidParams */, "Path must be a string.");
|
|
339
337
|
}
|
|
340
338
|
const normalizedUserPath = path.normalize(userPath);
|
|
341
|
-
|
|
342
|
-
const isWithinAllowedRoot = ALLOWED_ROOTS.some((allowedRoot) => {
|
|
343
|
-
const relativePath = path.relative(allowedRoot, resolvedPath);
|
|
344
|
-
return relativePath !== "" && !relativePath.startsWith("..") && !path.isAbsolute(relativePath);
|
|
345
|
-
});
|
|
346
|
-
if (!isWithinAllowedRoot) {
|
|
347
|
-
throw new PdfError(-32602 /* InvalidParams */, "Access denied: Path resolves outside allowed directories.");
|
|
348
|
-
}
|
|
349
|
-
return resolvedPath;
|
|
339
|
+
return path.isAbsolute(normalizedUserPath) ? normalizedUserPath : path.resolve(PROJECT_ROOT, normalizedUserPath);
|
|
350
340
|
};
|
|
351
341
|
|
|
352
342
|
// src/pdf/loader.ts
|
|
@@ -617,7 +607,7 @@ var server = createServer({
|
|
|
617
607
|
});
|
|
618
608
|
async function main() {
|
|
619
609
|
await server.start();
|
|
620
|
-
if (process.env
|
|
610
|
+
if (process.env["DEBUG_MCP"]) {
|
|
621
611
|
console.error("[PDF Reader MCP] Server running on stdio");
|
|
622
612
|
console.error("[PDF Reader MCP] Project root:", process.cwd());
|
|
623
613
|
}
|
package/package.json
CHANGED
|
@@ -1,106 +1,105 @@
|
|
|
1
1
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|
|
104
|
-
|
|
105
|
-
}
|
|
2
|
+
"name": "@sylphx/pdf-reader-mcp",
|
|
3
|
+
"version": "2.0.7",
|
|
4
|
+
"description": "An MCP server providing tools to read PDF files.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"bin": {
|
|
7
|
+
"pdf-reader-mcp": "./dist/index.js"
|
|
8
|
+
},
|
|
9
|
+
"files": [
|
|
10
|
+
"dist/",
|
|
11
|
+
"README.md",
|
|
12
|
+
"LICENSE"
|
|
13
|
+
],
|
|
14
|
+
"exports": {
|
|
15
|
+
".": {
|
|
16
|
+
"import": "./dist/index.js"
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
"publishConfig": {
|
|
20
|
+
"access": "public"
|
|
21
|
+
},
|
|
22
|
+
"engines": {
|
|
23
|
+
"node": ">=22.0.0"
|
|
24
|
+
},
|
|
25
|
+
"repository": {
|
|
26
|
+
"type": "git",
|
|
27
|
+
"url": "git+https://github.com/SylphxAI/pdf-reader-mcp.git"
|
|
28
|
+
},
|
|
29
|
+
"bugs": {
|
|
30
|
+
"url": "https://github.com/SylphxAI/pdf-reader-mcp/issues"
|
|
31
|
+
},
|
|
32
|
+
"homepage": "https://github.com/SylphxAI/pdf-reader-mcp#readme",
|
|
33
|
+
"author": "Sylphx <contact@sylphx.com> (https://sylphx.com)",
|
|
34
|
+
"license": "MIT",
|
|
35
|
+
"keywords": [
|
|
36
|
+
"mcp",
|
|
37
|
+
"model-context-protocol",
|
|
38
|
+
"pdf",
|
|
39
|
+
"reader",
|
|
40
|
+
"parser",
|
|
41
|
+
"typescript",
|
|
42
|
+
"node",
|
|
43
|
+
"ai",
|
|
44
|
+
"agent",
|
|
45
|
+
"tool"
|
|
46
|
+
],
|
|
47
|
+
"scripts": {
|
|
48
|
+
"build": "bunup",
|
|
49
|
+
"watch": "tsc --watch",
|
|
50
|
+
"inspector": "npx @modelcontextprotocol/inspector dist/index.js",
|
|
51
|
+
"test": "bun test",
|
|
52
|
+
"test:watch": "bun test --watch",
|
|
53
|
+
"test:cov": "bun test --coverage",
|
|
54
|
+
"lint": "biome lint .",
|
|
55
|
+
"lint:fix": "biome lint --write .",
|
|
56
|
+
"format": "biome format --write .",
|
|
57
|
+
"check-format": "biome format .",
|
|
58
|
+
"check": "biome check .",
|
|
59
|
+
"check:fix": "biome check --write .",
|
|
60
|
+
"validate": "bun run check && bun run test",
|
|
61
|
+
"docs:dev": "bunx @sylphx/leaf dev docs",
|
|
62
|
+
"docs:build": "bunx @sylphx/leaf build docs",
|
|
63
|
+
"docs:preview": "bunx @sylphx/leaf preview docs",
|
|
64
|
+
"start": "node dist/index.js",
|
|
65
|
+
"typecheck": "tsc --noEmit",
|
|
66
|
+
"benchmark": "bun bench",
|
|
67
|
+
"clean": "rm -rf dist coverage",
|
|
68
|
+
"docs:api": "typedoc --entryPoints src/index.ts --tsconfig tsconfig.json --plugin typedoc-plugin-markdown --out docs/api --readme none",
|
|
69
|
+
"prepublishOnly": "bunx @sylphx/doctor prepublish && bun run clean && bun run build",
|
|
70
|
+
"release": "standard-version",
|
|
71
|
+
"prepare": "node_modules/.bin/lefthook install || true"
|
|
72
|
+
},
|
|
73
|
+
"dependencies": {
|
|
74
|
+
"@sylphx/mcp-server-sdk": "1.3.0",
|
|
75
|
+
"glob": "^13.0.0",
|
|
76
|
+
"pdfjs-dist": "^5.4.449",
|
|
77
|
+
"pngjs": "^7.0.0",
|
|
78
|
+
"zod": "4.2.0-canary.20251124T022609",
|
|
79
|
+
"zod-to-json-schema": "^3.25.0"
|
|
80
|
+
},
|
|
81
|
+
"devDependencies": {
|
|
82
|
+
"@biomejs/biome": "^2.3.8",
|
|
83
|
+
"@solidjs/router": "^0.15.4",
|
|
84
|
+
"@sylphx/biome-config": "^0.4.1",
|
|
85
|
+
"@sylphx/bump": "^0.12.1",
|
|
86
|
+
"@sylphx/doctor": "^1.32.1",
|
|
87
|
+
"@sylphx/leaf": "^1.0.0",
|
|
88
|
+
"@sylphx/leaf-theme-default": "^1.0.0",
|
|
89
|
+
"@sylphx/tsconfig": "^0.3.1",
|
|
90
|
+
"@types/glob": "^8.1.0",
|
|
91
|
+
"@types/node": "^24.10.1",
|
|
92
|
+
"@types/pngjs": "^6.0.5",
|
|
93
|
+
"bunup": "^0.16.10",
|
|
94
|
+
"lefthook": "^2.0.7",
|
|
95
|
+
"solid-js": "^1.9.10",
|
|
96
|
+
"typedoc": "^0.28.15",
|
|
97
|
+
"typedoc-plugin-markdown": "^4.9.0",
|
|
98
|
+
"typescript": "^5.9.3",
|
|
99
|
+
"vite": "^7.2.6"
|
|
100
|
+
},
|
|
101
|
+
"packageManager": "bun@1.3.1",
|
|
102
|
+
"overrides": {
|
|
103
|
+
"js-yaml": "^4.1.0"
|
|
104
|
+
}
|
|
106
105
|
}
|