@shuji-bonji/pdf-reader-mcp 0.11.2 → 0.13.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/CHANGELOG.md +171 -0
- package/README.ja.md +90 -5
- package/README.md +91 -5
- package/dist/constants.d.ts +20 -0
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +20 -0
- package/dist/constants.js.map +1 -1
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js.map +1 -1
- package/dist/index.js +14 -3
- package/dist/index.js.map +1 -1
- package/dist/schemas/common.d.ts +2 -2
- package/dist/schemas/common.d.ts.map +1 -1
- package/dist/schemas/common.js +1 -2
- package/dist/schemas/common.js.map +1 -1
- package/dist/schemas/tier1.d.ts +50 -74
- package/dist/schemas/tier1.d.ts.map +1 -1
- package/dist/schemas/tier1.js +80 -2
- package/dist/schemas/tier1.js.map +1 -1
- package/dist/schemas/tier2.d.ts +18 -78
- package/dist/schemas/tier2.d.ts.map +1 -1
- package/dist/schemas/tier3.d.ts +6 -26
- package/dist/schemas/tier3.d.ts.map +1 -1
- package/dist/services/content-stream-service.d.ts +34 -1
- package/dist/services/content-stream-service.d.ts.map +1 -1
- package/dist/services/content-stream-service.js +92 -9
- package/dist/services/content-stream-service.js.map +1 -1
- package/dist/services/image-encoder.d.ts +33 -0
- package/dist/services/image-encoder.d.ts.map +1 -0
- package/dist/services/image-encoder.js +435 -0
- package/dist/services/image-encoder.js.map +1 -0
- package/dist/services/image-resampler.d.ts +36 -0
- package/dist/services/image-resampler.d.ts.map +1 -0
- package/dist/services/image-resampler.js +78 -0
- package/dist/services/image-resampler.js.map +1 -0
- package/dist/services/page-renderer.d.ts +71 -0
- package/dist/services/page-renderer.d.ts.map +1 -0
- package/dist/services/page-renderer.js +147 -0
- package/dist/services/page-renderer.js.map +1 -0
- package/dist/services/pdfjs-service.d.ts +24 -3
- package/dist/services/pdfjs-service.d.ts.map +1 -1
- package/dist/services/pdfjs-service.js +119 -24
- package/dist/services/pdfjs-service.js.map +1 -1
- package/dist/services/pdflib-service.d.ts +4 -0
- package/dist/services/pdflib-service.d.ts.map +1 -1
- package/dist/services/pdflib-service.js +6 -1
- package/dist/services/pdflib-service.js.map +1 -1
- package/dist/services/struct-tree-service.js.map +1 -1
- package/dist/services/struct-tree-walker.js.map +1 -1
- package/dist/services/text-extractability-service.d.ts +44 -0
- package/dist/services/text-extractability-service.d.ts.map +1 -0
- package/dist/services/text-extractability-service.js +302 -0
- package/dist/services/text-extractability-service.js.map +1 -0
- package/dist/tools/index.d.ts +1 -1
- package/dist/tools/index.d.ts.map +1 -1
- package/dist/tools/index.js +2 -4
- package/dist/tools/index.js.map +1 -1
- package/dist/tools/tier1/get-metadata.d.ts +1 -1
- package/dist/tools/tier1/get-metadata.d.ts.map +1 -1
- package/dist/tools/tier1/get-metadata.js +0 -3
- package/dist/tools/tier1/get-metadata.js.map +1 -1
- package/dist/tools/tier1/get-page-count.d.ts +1 -1
- package/dist/tools/tier1/get-page-count.d.ts.map +1 -1
- package/dist/tools/tier1/get-page-count.js +0 -3
- package/dist/tools/tier1/get-page-count.js.map +1 -1
- package/dist/tools/tier1/read-images.d.ts +2 -2
- package/dist/tools/tier1/read-images.d.ts.map +1 -1
- package/dist/tools/tier1/read-images.js +72 -45
- package/dist/tools/tier1/read-images.js.map +1 -1
- package/dist/tools/tier1/read-text.d.ts +1 -1
- package/dist/tools/tier1/read-text.d.ts.map +1 -1
- package/dist/tools/tier1/read-text.js +22 -10
- package/dist/tools/tier1/read-text.js.map +1 -1
- package/dist/tools/tier1/read-url.d.ts +1 -1
- package/dist/tools/tier1/read-url.d.ts.map +1 -1
- package/dist/tools/tier1/read-url.js +24 -9
- package/dist/tools/tier1/read-url.js.map +1 -1
- package/dist/tools/tier1/render-page.d.ts +6 -0
- package/dist/tools/tier1/render-page.d.ts.map +1 -0
- package/dist/tools/tier1/render-page.js +90 -0
- package/dist/tools/tier1/render-page.js.map +1 -0
- package/dist/tools/tier1/search-text.d.ts +1 -1
- package/dist/tools/tier1/search-text.d.ts.map +1 -1
- package/dist/tools/tier1/search-text.js +17 -5
- package/dist/tools/tier1/search-text.js.map +1 -1
- package/dist/tools/tier1/summarize.d.ts +1 -1
- package/dist/tools/tier1/summarize.d.ts.map +1 -1
- package/dist/tools/tier1/summarize.js +73 -5
- package/dist/tools/tier1/summarize.js.map +1 -1
- package/dist/tools/tier2/extract-structured-text.d.ts +1 -1
- package/dist/tools/tier2/extract-structured-text.d.ts.map +1 -1
- package/dist/tools/tier2/extract-structured-text.js +19 -9
- package/dist/tools/tier2/extract-structured-text.js.map +1 -1
- package/dist/tools/tier2/extract-tables.d.ts +1 -1
- package/dist/tools/tier2/extract-tables.d.ts.map +1 -1
- package/dist/tools/tier2/extract-tables.js +0 -8
- package/dist/tools/tier2/extract-tables.js.map +1 -1
- package/dist/tools/tier2/inspect-annotations.d.ts +1 -1
- package/dist/tools/tier2/inspect-annotations.d.ts.map +1 -1
- package/dist/tools/tier2/inspect-annotations.js +0 -3
- package/dist/tools/tier2/inspect-annotations.js.map +1 -1
- package/dist/tools/tier2/inspect-fonts.d.ts +1 -1
- package/dist/tools/tier2/inspect-fonts.d.ts.map +1 -1
- package/dist/tools/tier2/inspect-fonts.js +0 -3
- package/dist/tools/tier2/inspect-fonts.js.map +1 -1
- package/dist/tools/tier2/inspect-signatures.d.ts +1 -1
- package/dist/tools/tier2/inspect-signatures.d.ts.map +1 -1
- package/dist/tools/tier2/inspect-signatures.js +0 -3
- package/dist/tools/tier2/inspect-signatures.js.map +1 -1
- package/dist/tools/tier2/inspect-structure.d.ts +1 -1
- package/dist/tools/tier2/inspect-structure.d.ts.map +1 -1
- package/dist/tools/tier2/inspect-structure.js +0 -3
- package/dist/tools/tier2/inspect-structure.js.map +1 -1
- package/dist/tools/tier2/inspect-tags.d.ts +1 -1
- package/dist/tools/tier2/inspect-tags.d.ts.map +1 -1
- package/dist/tools/tier2/inspect-tags.js +0 -3
- package/dist/tools/tier2/inspect-tags.js.map +1 -1
- package/dist/tools/tier2/locate-objects.d.ts +1 -1
- package/dist/tools/tier2/locate-objects.d.ts.map +1 -1
- package/dist/tools/tier2/locate-objects.js +0 -3
- package/dist/tools/tier2/locate-objects.js.map +1 -1
- package/dist/tools/tier3/compare-structure.d.ts +1 -1
- package/dist/tools/tier3/compare-structure.d.ts.map +1 -1
- package/dist/tools/tier3/compare-structure.js +0 -3
- package/dist/tools/tier3/compare-structure.js.map +1 -1
- package/dist/tools/tier3/validate-metadata.d.ts +1 -1
- package/dist/tools/tier3/validate-metadata.d.ts.map +1 -1
- package/dist/tools/tier3/validate-metadata.js +0 -3
- package/dist/tools/tier3/validate-metadata.js.map +1 -1
- package/dist/tools/tier3/validate-tagged.d.ts +1 -1
- package/dist/tools/tier3/validate-tagged.d.ts.map +1 -1
- package/dist/tools/tier3/validate-tagged.js +0 -3
- package/dist/tools/tier3/validate-tagged.js.map +1 -1
- package/dist/types.d.ts +96 -1
- package/dist/types.d.ts.map +1 -1
- package/dist/utils/batch-processor.js.map +1 -1
- package/dist/utils/error-handler.d.ts.map +1 -1
- package/dist/utils/error-handler.js.map +1 -1
- package/dist/utils/formatter.d.ts.map +1 -1
- package/dist/utils/formatter.js +36 -1
- package/dist/utils/formatter.js.map +1 -1
- package/package.json +11 -5
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,177 @@ All notable changes to this project will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [0.13.0] - 2026-08-27
|
|
9
|
+
|
|
10
|
+
Infrastructure only: no tool gained or lost a capability, and no tool's output
|
|
11
|
+
changed. Four things reach callers — read **Changed** before upgrading.
|
|
12
|
+
|
|
13
|
+
### Changed
|
|
14
|
+
|
|
15
|
+
- **Node 18 is no longer supported.** `engines.node` is `>=20` (was `>=18`).
|
|
16
|
+
- **MCP SDK v1 → v2** (`@modelcontextprotocol/sdk@^1.6.1` →
|
|
17
|
+
`@modelcontextprotocol/server@^2.0.0`). One difference reaches callers: a
|
|
18
|
+
`tools/call` naming a tool this server does not have now comes back as a
|
|
19
|
+
**JSON-RPC error** (code `-32602`), where v1 returned a tool result with
|
|
20
|
+
`isError: true`. Client code that only reads `isError` will not see it, and
|
|
21
|
+
`await client.callTool(...)` throws instead of resolving. Failures of input
|
|
22
|
+
validation — a missing required argument, a key the schema does not declare —
|
|
23
|
+
still arrive as `isError: true`.
|
|
24
|
+
- **Arguments the input schema does not declare are now rejected.** All 19
|
|
25
|
+
tools take a `.strict()` object, so an undeclared key fails the call with
|
|
26
|
+
`-32602 Unrecognized key`. Until now such a key was silently dropped and the
|
|
27
|
+
call ran: `tools/list` already stated `additionalProperties: false`, but that
|
|
28
|
+
statement was produced by zod 3's JSON Schema conversion and nothing enforced
|
|
29
|
+
it — zod 3's default for an object is *strip*, not *strict*. The statement and
|
|
30
|
+
the behaviour now agree.
|
|
31
|
+
- **`inputSchema` in `tools/list`**: `$schema` is now
|
|
32
|
+
`https://json-schema.org/draft/2020-12/schema` (was draft-07) for all 19
|
|
33
|
+
tools. `additionalProperties: false` is unchanged in the response — what
|
|
34
|
+
changed is that it is now true of the running server. Tool names,
|
|
35
|
+
descriptions and `required` are unchanged — measured tool by tool against
|
|
36
|
+
0.12.0 with `scripts/tools-list-snapshot.mjs`, which speaks raw JSON-RPC over
|
|
37
|
+
stdio rather than using an SDK client.
|
|
38
|
+
- `zod` moves from `^3.23.8` to `^4.2.0` — the version all four servers in the
|
|
39
|
+
family now share. `typescript` moves to `^7.0.2` (a devDependency).
|
|
40
|
+
|
|
41
|
+
### Added
|
|
42
|
+
|
|
43
|
+
- `npm run check:public-types` fails if a type from the MCP SDK or from zod
|
|
44
|
+
appears in the published `.d.ts`. The published surface must not force a
|
|
45
|
+
consumer onto our versions of those.
|
|
46
|
+
- `npm run check:engines` compares `engines.node` against what the dependency
|
|
47
|
+
tree asks for, and runs in CI alongside a lockfile check.
|
|
48
|
+
|
|
49
|
+
## [0.12.0] - 2026-08-23
|
|
50
|
+
|
|
51
|
+
### Added
|
|
52
|
+
|
|
53
|
+
- **Text extractability is reported per page, in three states rather than two (#21).**
|
|
54
|
+
`read_text` answered with text or with nothing, and nothing meant three different things:
|
|
55
|
+
the page is blank, the page is an image with no text layer, or the page shows glyphs whose
|
|
56
|
+
character codes cannot be converted to Unicode. ISO 32000-2 §9.10.1 separates those
|
|
57
|
+
conditions; the return value did not, so a scanned page and an empty page produced the same
|
|
58
|
+
output, and a font without a `/ToUnicode` CMap dropped its text silently — which made a
|
|
59
|
+
partial extraction look like a complete one.
|
|
60
|
+
|
|
61
|
+
Every text-returning path now carries the state: `read_text`, `read_url`, `search_text`,
|
|
62
|
+
`extract_structured_text` and `summarize`. Leaving one path without it would have left the
|
|
63
|
+
hole open, because a caller reaches the same document through any of them.
|
|
64
|
+
|
|
65
|
+
| State | Condition |
|
|
66
|
+
| --- | --- |
|
|
67
|
+
| `extracted` | Every font used by a text-showing operator has a route to Unicode under §9.10.2 |
|
|
68
|
+
| `no_text_layer` | No `Tj` / `TJ` / `'` / `"` on the page, and image content is present |
|
|
69
|
+
| `not_extractable` | A font used has no `/ToUnicode`, no standard encoding and no known CID collection |
|
|
70
|
+
| `not_observed` | Encrypted, or the content stream could not be read — nothing was measured |
|
|
71
|
+
|
|
72
|
+
`not_observed` is the fourth state and is deliberately not folded into any of the other
|
|
73
|
+
three: an encrypted document is not a document without text, and counting it as `extracted`
|
|
74
|
+
would repeat the failure this change exists to fix.
|
|
75
|
+
|
|
76
|
+
`not_extractable` is decided per font, so a page mixing a readable font with an unreadable
|
|
77
|
+
one reports a partial loss and names the fonts responsible, instead of passing as complete.
|
|
78
|
+
|
|
79
|
+
The observation is read from the file with pdf-lib, not from pdfjs's output. pdfjs
|
|
80
|
+
synthesises a `toUnicode` map for every font it loads — a standard-encoding font gets one
|
|
81
|
+
built from its encoding — so asking pdfjs whether a font has a `/ToUnicode` CMap answers yes
|
|
82
|
+
for fonts whose dictionary has none.
|
|
83
|
+
|
|
84
|
+
- **Three fixtures, added before the implementation, because none of the three states could be
|
|
85
|
+
measured without them.** A survey of the existing 17 found no PDF with a `/ToUnicode` CMap,
|
|
86
|
+
none with an image-only page, and no page drawn solely with an unmappable font — so
|
|
87
|
+
`extracted` for composite fonts, `no_text_layer`, and total loss each had zero specimens.
|
|
88
|
+
|
|
89
|
+
- `no-text-layer.pdf` — two image-only pages, no text-showing operator.
|
|
90
|
+
- `tounicode-cid.pdf` — Identity-H with a correct `/ToUnicode` CMap; the `extracted` control.
|
|
91
|
+
- `broken-cid-only.pdf` — a page whose only font is Identity-H without `/ToUnicode`.
|
|
92
|
+
|
|
93
|
+
`cid-font.pdf` is now the fourth: it gained a well-formed Identity-H font with no
|
|
94
|
+
`/ToUnicode` and a line drawn with it, which makes its page the mixed one. Its existing F3
|
|
95
|
+
(a Type0 with no `/DescendantFonts`) could not serve — pdfjs abandons the whole page over it,
|
|
96
|
+
so the Helvetica text disappears too and there is no "partial" left to observe.
|
|
97
|
+
|
|
98
|
+
- **`read_url`'s scope is now stated where it is felt (#25).** The tool returns text and
|
|
99
|
+
discards the fetched bytes; the other 18 tools take a `file_path`; so a URL's PDF cannot
|
|
100
|
+
reach them through this server. That was always the behaviour — what was missing was the
|
|
101
|
+
sentence saying it is a *decision*: every tool here is read-only, a `save_path` (or a
|
|
102
|
+
separate fetch tool) would have the reader writing files, and fetching is the caller's job.
|
|
103
|
+
The tool description, the server `instructions` and both READMEs now say so, with the
|
|
104
|
+
workaround spelled out: download the file first, pass the local path. No code path changed.
|
|
105
|
+
|
|
106
|
+
- **`summarize` ends with a `next` list — tool suggestions derived from its own observations
|
|
107
|
+
(#24).** Tool descriptions say what each tool does; nothing said what to call *given what
|
|
108
|
+
was just observed*, so a caller seeing `hasText: false` had to already know that
|
|
109
|
+
`render_page` is the move. The rules: encrypted → decrypt first (and nothing else, because
|
|
110
|
+
every other suggestion would under-deliver on ciphertext); `no_text_layer` /
|
|
111
|
+
`not_extractable` → `render_page`, with the page numbers; tagged → `extract_structured_text`
|
|
112
|
+
and `extract_tables`; over 50 pages → `search_text` before an unbounded `read_text`. Each
|
|
113
|
+
line names the observation it follows from, so the premise can be checked rather than the
|
|
114
|
+
advice trusted. An ordinary small document gets an empty list — advice that always appears
|
|
115
|
+
is advice that stops being read. Deliberately NOT a workflow: nothing is enforced and no
|
|
116
|
+
ordering is implied; orchestration stays with the Skill layer.
|
|
117
|
+
|
|
118
|
+
- **`read_text` and `read_images` say, in bold, that omitting `pages` means every page** —
|
|
119
|
+
and what to do instead on a large document. The default itself is unchanged; what changed
|
|
120
|
+
is that its cost is stated where the decision is made.
|
|
121
|
+
|
|
122
|
+
- **`render_page` rasterises pages to PNG/JPEG through PDFium-WASM (#23).** `summarize`
|
|
123
|
+
answering `hasText: false` used to be a dead end — nothing in this server could read the
|
|
124
|
+
document any further. Now the page itself can be handed to a vision model: the whole page,
|
|
125
|
+
vector drawings, forms and handwriting included, where `read_images` only extracts embedded
|
|
126
|
+
image XObjects. `pages` is required (rendering all pages of a scan should be a decision, not
|
|
127
|
+
a default), and the #22 response budget applies, with omissions named.
|
|
128
|
+
|
|
129
|
+
The renderer is `@hyzyla/pdfium` in `optionalDependencies` — PDFium compiled to a single
|
|
130
|
+
WebAssembly binary, identical bytes on every platform, so the published package still
|
|
131
|
+
behaves the same everywhere `npx` runs it. When it is not installed, `render_page` reports
|
|
132
|
+
what to install; the other 18 tools are unaffected. Tool count: 18 → 19.
|
|
133
|
+
|
|
134
|
+
pdf.js + `@napi-rs/canvas` was measured first and rejected: versions 1.0.7 and 0.1.80 both
|
|
135
|
+
segfault the process — the whole MCP server — on any page that draws an image, which is
|
|
136
|
+
exactly the class of page this tool exists for; and with `standardFontDataUrl` unset, text
|
|
137
|
+
pages rendered as blank images that looked like success. The e2e suite therefore asserts on
|
|
138
|
+
decoded pixels ("ink"), not on file headers.
|
|
139
|
+
|
|
140
|
+
- **`read_images` returns PNG or JPEG files, in MCP image content blocks (#22).** It used to
|
|
141
|
+
base64 `imgData.data`, which is pdfjs's *decoded pixel array*: 192 bytes for an 8×8 RGB
|
|
142
|
+
image, 256 for 8×8 RGBA, 8 for an 8×8 1 bpp greyscale — measured on `image-kinds.pdf`, with
|
|
143
|
+
no PNG or JPEG signature in any of them. The response looked like an image and was not one,
|
|
144
|
+
so no viewer could open it and no vision model could read it.
|
|
145
|
+
|
|
146
|
+
Both encoders are written out in `src/services/image-encoder.ts`: PNG through
|
|
147
|
+
`zlib.deflateSync`, and baseline JPEG per ISO/IEC 10918-1 with the example tables of its
|
|
148
|
+
Annex K. No dependency is added — the standing reason (#21) is that a native addon ships
|
|
149
|
+
per-platform binaries and breaks the post-release check of the published package.
|
|
150
|
+
|
|
151
|
+
New arguments: `format` (`png` default, `jpeg`), `quality` (JPEG only), `max_width` and
|
|
152
|
+
`max_height` (area-averaged downscale, never enlarges).
|
|
153
|
+
|
|
154
|
+
- **`read_images` has a response budget, and says what it left out.** `read_text` has had a
|
|
155
|
+
character limit since the beginning; `read_images` had none, and a 200 dpi A4 scan is
|
|
156
|
+
1654×2339×3 = 11.6 MB of pixels on its own. At most 4 MB of encoded image data is returned
|
|
157
|
+
per call. Images past the budget, or over the 40 Mpx encoding limit, are listed in `omitted`
|
|
158
|
+
with the reason and the argument that would fetch them — they are not dropped silently.
|
|
159
|
+
|
|
160
|
+
### Changed
|
|
161
|
+
|
|
162
|
+
- `ExtractedImage` gained `sourceWidth`, `sourceHeight`, `mimeType`, `encodedBytes` and
|
|
163
|
+
`downscaled`; `ImageExtractionResult` gained `omitted` and `totalEncodedBytes`. `dataBase64`
|
|
164
|
+
now holds a complete image file rather than raw samples.
|
|
165
|
+
- `skippedCount` keeps its meaning — detected but not decodable by pdf.js. "Decoded but not
|
|
166
|
+
returned" is `omitted`, a separate count: folding the two would make a response the caller
|
|
167
|
+
asked to bound look like a file that failed to decode.
|
|
168
|
+
- `PageText` gained an optional `extractability` record, `PdfSummary` gained
|
|
169
|
+
`textExtractability` and `unreadablePages`, `SearchResult` gained `unsearchablePages`, and
|
|
170
|
+
`StructuredTextResult` gained `extractability`. All are additive.
|
|
171
|
+
- `search_text` no longer reports zero hits over an unreadable page as a plain "no matches":
|
|
172
|
+
the note now says the query was not found *in what could be read*.
|
|
173
|
+
- The server `instructions` say that OCR is not performed **and** that the need for it is
|
|
174
|
+
detected and reported. Detecting an unreadable page is inside an observing server's remit;
|
|
175
|
+
staying silent about it is not.
|
|
176
|
+
- No new dependency. The operator walk reuses the existing content-stream scanner; the font
|
|
177
|
+
rules are read with pdf-lib. Tool count stays at 18.
|
|
178
|
+
|
|
8
179
|
## [0.11.2] - 2026-08-13
|
|
9
180
|
|
|
10
181
|
### Changed
|
package/README.ja.md
CHANGED
|
@@ -22,7 +22,7 @@ PDF 内部構造解析に特化した MCP (Model Context Protocol) サーバー
|
|
|
22
22
|
|
|
23
23
|
## 機能
|
|
24
24
|
|
|
25
|
-
**
|
|
25
|
+
**19 ツール** を 3 層構成で提供します。
|
|
26
26
|
|
|
27
27
|
### Tier 1: 基本機能
|
|
28
28
|
|
|
@@ -30,11 +30,12 @@ PDF 内部構造解析に特化した MCP (Model Context Protocol) サーバー
|
|
|
30
30
|
| ---------------- | ----------------------------------------------------- |
|
|
31
31
|
| `get_page_count` | ページ数の軽量取得 |
|
|
32
32
|
| `get_metadata` | メタデータ抽出(タイトル、著者、PDF版、タグ有無等) |
|
|
33
|
-
| `read_text` | テキスト抽出(Y座標ベースの読み順保持。`split_columns: 2 \| 3` で **タグなし** 多カラム PDF、`compact_whitespace` で 帳票 の U+3000 連続空白を畳み込み)。`/ActualText` 置換(§14.9.4。構造要素・`Span`
|
|
33
|
+
| `read_text` | テキスト抽出(Y座標ベースの読み順保持。`split_columns: 2 \| 3` で **タグなし** 多カラム PDF、`compact_whitespace` で 帳票 の U+3000 連続空白を畳み込み)。`/ActualText` 置換(§14.9.4。構造要素・`Span` マーク付きコンテンツの両経路)を解決。ページごとに**テキスト抽出可能性**(§9.10.1)を併記するので、空の結果が「空のページ」と取り違えられない。**論理順**が要るタグ付き PDF の本文は `extract_structured_text` を推奨 |
|
|
34
34
|
| `search_text` | 全文検索(前後コンテキスト付き)。`read_text` と同じテキスト(`/ActualText` 解決済み)を検索するため、ヒット=読み手に見えている語(位置合わせできなかったページがあれば `note` で名指し) |
|
|
35
|
-
| `read_images` |
|
|
36
|
-
| `read_url` | URL
|
|
37
|
-
| `
|
|
35
|
+
| `read_images` | 埋め込み画像 XObject を **PNG / JPEG ファイル**として抽出し、MCP の image コンテンツブロックで返す(視覚モデルがそのまま読める)。`max_width` / `max_height` で面積平均による縮小。応答にはバイト予算があり、返さなかった画像は理由付きで名指しする |
|
|
36
|
+
| `read_url` | リモート PDF を取得して**テキストだけ**を返す。取得したバイト列は保存しない。URL 上の PDF に他の 18 ツールを使うには、先にローカルへダウンロードしてそのパスを渡す(「read_url と read-only の境界」参照) |
|
|
37
|
+
| `render_page` | ページを **PNG/JPEG** にラスタライズ(PDFium の WASM 版・optionalDependencies の `@hyzyla/pdfium`)。テキスト抽出可能性が `no_text_layer` / `not_extractable` のときの次の一手。ベクタ図形・フォーム込みでページ全体を描く |
|
|
38
|
+
| `summarize` | 全体概要レポート(メタデータ + テキスト + 画像数 + 文書全体のテキスト抽出可能性) |
|
|
38
39
|
|
|
39
40
|
### Tier 2: 構造解析
|
|
40
41
|
|
|
@@ -57,6 +58,90 @@ PDF 内部構造解析に特化した MCP (Model Context Protocol) サーバー
|
|
|
57
58
|
| `validate_metadata` | **非推奨** — 移管先は上と同じ。次のメジャーまで残置 |
|
|
58
59
|
| `compare_structure` | 2つのPDFの構造差分比較(プロパティ+フォント) |
|
|
59
60
|
|
|
61
|
+
### read_url と read-only の境界(#25)
|
|
62
|
+
|
|
63
|
+
`read_url` が返すのはテキストだけ。これは設計判断であり、今回それを暗黙から明文にした。
|
|
64
|
+
取得したバイト列は抽出後に破棄する。保存すれば reader のツールがファイルシステムに
|
|
65
|
+
書き込むことになり、本サーバの全 19 ツールが read-only(`readOnlyHint: true`)という
|
|
66
|
+
不変条件が成り立たなくなるため。
|
|
67
|
+
|
|
68
|
+
URL 上の PDF に `search_text` / `inspect_structure` / `extract_tables` / `render_page`
|
|
69
|
+
などを使いたい場合は、呼び出し側の環境が持つ取得手段で**先にローカルへダウンロード**し、
|
|
70
|
+
そのパスを渡す。取得を呼び出し側の責務とするのは意図的で、エージェント環境には必ず
|
|
71
|
+
ファイルを取得する手段が別にあり、ファイルを書く reader は純粋な観測者ではなくなる。
|
|
72
|
+
|
|
73
|
+
「この URL の文書には何が書いてあるか」という 1 回きりの問いには、引き続き `read_url`
|
|
74
|
+
がそのまま使える。
|
|
75
|
+
|
|
76
|
+
### テキストが読めない文書はページを描画できる(#23)
|
|
77
|
+
|
|
78
|
+
これまで `summarize` が `hasText: false` を返すと、その先に打つ手が無かった。
|
|
79
|
+
`render_page` はページを PNG / JPEG にラスタライズし、MCP の image コンテンツブロックで
|
|
80
|
+
返す。スキャン・図面・記入済みフォーム・手書きを、視覚モデルがそのまま読める。
|
|
81
|
+
|
|
82
|
+
```
|
|
83
|
+
render_page({ file_path: "/path/to/scan.pdf", pages: "1-3", format: "jpeg" })
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
`pages` は**必須**。描画はこのサーバで最も高価な処理であり、500 ページのスキャンの
|
|
87
|
+
「全ページ」は既定値ではなく判断であるべきだから。応答予算(4 MB)は `read_images` と
|
|
88
|
+
同じで、超過分は理由付きで名指しする。
|
|
89
|
+
|
|
90
|
+
描画エンジンは **PDFium の WebAssembly 版**(`@hyzyla/pdfium`・optionalDependencies)。
|
|
91
|
+
WASM はどのプラットフォームでも同じバイト列なので、`npx` で入る公開版の挙動が環境に
|
|
92
|
+
よらない — ネイティブアドオンを使わない理由がそのまま満たせる。未インストールなら
|
|
93
|
+
`render_page` はインストール方法を返し、他の 18 ツールは通常どおり動く。
|
|
94
|
+
PDFium(BSD-3-Clause)はテキスト読み取りに使っている pdf.js とは別エンジンであり、
|
|
95
|
+
その旨は description に明記してある(エンジン間の描画差をファイルの性質と
|
|
96
|
+
取り違えないため)。
|
|
97
|
+
|
|
98
|
+
> 採用前の実測: pdf.js + `@napi-rs/canvas`(1.0.7 / 0.1.80)は画像を描くページで
|
|
99
|
+
> プロセスごと Segmentation fault になり(このツールの対象そのもの)、
|
|
100
|
+
> `standardFontDataUrl` 未設定では白紙を「成功」として返した。
|
|
101
|
+
|
|
102
|
+
### 画像は画像ファイルとして返る(#22)
|
|
103
|
+
|
|
104
|
+
`read_images` は `imgData.data`(pdfjs が**デコードしたピクセル**)をそのまま base64 に
|
|
105
|
+
していた。8×8 RGB なら 192 バイトで、PNG/JPEG のシグネチャはどこにも無い。どのビューアも
|
|
106
|
+
開けず、画像を取り出す目的そのものである視覚モデルも読めなかった。
|
|
107
|
+
|
|
108
|
+
現在は PNG(既定・可逆)または JPEG(`format: "jpeg"` と `quality`)にエンコードし、
|
|
109
|
+
MCP の `image` コンテンツブロックで返す。メタデータは従来どおり text ブロックに併記する。
|
|
110
|
+
エンコーダは両方ともこのリポジトリ内に書いてある(ネイティブアドオン無し・
|
|
111
|
+
プラットフォーム別バイナリ無し)。
|
|
112
|
+
|
|
113
|
+
応答は 4 MB のエンコード済み画像バイトで頭打ちにする。200dpi A4 のスキャンは
|
|
114
|
+
それだけで約 11.6 MB のピクセルになるため、予算を超えた画像は**理由付きで名指し**し、
|
|
115
|
+
黙って落とさない。
|
|
116
|
+
|
|
117
|
+
```
|
|
118
|
+
read_images({ file_path: "/path/to/scan.pdf", pages: "1", max_width: 1200, format: "jpeg" })
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
`read_images` が返すのはページが描く画像 XObject であって、ページの絵ではない。
|
|
122
|
+
ベクタ図形やテキストはこのツールの射程外。
|
|
123
|
+
|
|
124
|
+
### テキスト抽出可能性 — 2 値ではなく 3 値(#21)
|
|
125
|
+
|
|
126
|
+
`read_text` はこれまで「抽出できたテキスト」か「空」かの 2 値しか返さず、空が 3 つの別々の
|
|
127
|
+
状態を指していた。ISO 32000-2 §9.10.1 はそれらを区別しているので、本サーバも区別する。
|
|
128
|
+
テキストを返す全ツール(`read_text` / `read_url` / `search_text` /
|
|
129
|
+
`extract_structured_text` / `summarize`)が、ページごとに次を返す。
|
|
130
|
+
|
|
131
|
+
| 状態 | 条件 | 次の一手 |
|
|
132
|
+
| --- | --- | --- |
|
|
133
|
+
| `extracted` | 使われた全フォントが §9.10.2 の方式のいずれかで Unicode に変換できる | そのまま使ってよい |
|
|
134
|
+
| `no_text_layer` | text-showing 演算子(`Tj` `TJ` `'` `"`)が無く、画像が描かれている | ページは画素。OCR かページ画像が要る(本サーバはどちらも行わない) |
|
|
135
|
+
| `not_extractable` | `/ToUnicode` も標準エンコーディングも既知の CID コレクションも持たないフォントが使われている | 一部または全部が欠落している。原因フォント名と根拠条項を併記する |
|
|
136
|
+
| `not_observed` | 暗号化されている、またはコンテンツストリームが読めない | 何も測っていない。「無い」とは別 |
|
|
137
|
+
|
|
138
|
+
`not_extractable` は**フォント単位**で報告するので、読めるフォントと読めないフォントが
|
|
139
|
+
同じページに混在する場合は「部分的な欠落」としてそう言う。完全な抽出結果には化けない。
|
|
140
|
+
|
|
141
|
+
判定は pdf.js の出力ではなく**ファイル**から行う。pdf.js は読み込んだ全フォントについて
|
|
142
|
+
`toUnicode` を合成するため、pdf.js に「このフォントは `/ToUnicode` を持つか」と尋ねると、
|
|
143
|
+
辞書に `/ToUnicode` が無いフォントでも「持つ」と答える。
|
|
144
|
+
|
|
60
145
|
## インストール
|
|
61
146
|
|
|
62
147
|
### npx(推奨)
|
package/README.md
CHANGED
|
@@ -22,7 +22,7 @@ While typical PDF MCP servers are thin wrappers for text extraction, this projec
|
|
|
22
22
|
|
|
23
23
|
## Features
|
|
24
24
|
|
|
25
|
-
**
|
|
25
|
+
**19 tools** organized into three tiers:
|
|
26
26
|
|
|
27
27
|
### Tier 1: Basic Operations
|
|
28
28
|
|
|
@@ -30,11 +30,12 @@ While typical PDF MCP servers are thin wrappers for text extraction, this projec
|
|
|
30
30
|
| ---------------- | -------------------------------------------------------- |
|
|
31
31
|
| `get_page_count` | Lightweight page count retrieval |
|
|
32
32
|
| `get_metadata` | Full metadata extraction (title, author, PDF version...) |
|
|
33
|
-
| `read_text` | Text extraction with Y-coordinate reading order (opt-in `split_columns: 2 \| 3` for untagged multi-column PDFs, `compact_whitespace` for Japanese forms). Resolves `/ActualText` replacements (§14.9.4, both the structure-element and the `Span` marked-content path). For **logical** order in tagged PDFs, prefer `extract_structured_text` |
|
|
33
|
+
| `read_text` | Text extraction with Y-coordinate reading order (opt-in `split_columns: 2 \| 3` for untagged multi-column PDFs, `compact_whitespace` for Japanese forms). Resolves `/ActualText` replacements (§14.9.4, both the structure-element and the `Span` marked-content path). Reports **text extractability** per page (§9.10.1) so an empty result is never mistaken for an empty page. For **logical** order in tagged PDFs, prefer `extract_structured_text` |
|
|
34
34
|
| `search_text` | Full-text search with surrounding context. Searches the same text `read_text` returns, `/ActualText` included, so a hit means what a reader sees (a `note` names any page whose marked content could not be aligned) |
|
|
35
|
-
| `read_images` |
|
|
36
|
-
| `read_url` | Fetch and
|
|
37
|
-
| `
|
|
35
|
+
| `read_images` | Embedded image XObjects as **PNG or JPEG files**, returned as MCP image content blocks so a vision model can read them. `max_width` / `max_height` downscale by area average; the response has a byte budget and names anything it leaves out |
|
|
36
|
+
| `read_url` | Fetch a remote PDF and extract its **text** — nothing more. The bytes are not saved; to use the other 18 tools on a URL's PDF, download it first and pass the local path (see "read_url and the read-only boundary") |
|
|
37
|
+
| `render_page` | Rasterise pages to **PNG/JPEG** via PDFium-WASM (optional dependency `@hyzyla/pdfium`). The next step when text extractability says `no_text_layer` / `not_extractable` — draws the whole page, vector art and forms included |
|
|
38
|
+
| `summarize` | Quick overview report (metadata + text + image count + per-document text extractability) |
|
|
38
39
|
|
|
39
40
|
### Tier 2: Structure Inspection
|
|
40
41
|
|
|
@@ -57,6 +58,91 @@ While typical PDF MCP servers are thin wrappers for text extraction, this projec
|
|
|
57
58
|
| `validate_metadata` | **Deprecated** — same migration path as above. Kept until the next major |
|
|
58
59
|
| `compare_structure` | Structural diff between two PDFs (properties + fonts)|
|
|
59
60
|
|
|
61
|
+
### read_url and the read-only boundary (#25)
|
|
62
|
+
|
|
63
|
+
`read_url` returns text, and only text. This is a decision, now stated rather than implied:
|
|
64
|
+
the fetched bytes are discarded after extraction, because saving them would make a reader
|
|
65
|
+
tool write to the file system, and every tool of this server is read-only
|
|
66
|
+
(`readOnlyHint: true` — all 19 of them).
|
|
67
|
+
|
|
68
|
+
To run `search_text`, `inspect_structure`, `extract_tables`, `render_page` or anything else
|
|
69
|
+
against a PDF that lives at a URL, download the file first — with whatever fetch capability
|
|
70
|
+
the calling environment has — and pass the local path. Fetching is the caller's
|
|
71
|
+
responsibility, deliberately: an agent environment always has a way to download a file, and a
|
|
72
|
+
reader that also writes files has stopped being a pure observer.
|
|
73
|
+
|
|
74
|
+
`read_url` remains the right tool for the one-shot question: *what does the document at this
|
|
75
|
+
URL say?*
|
|
76
|
+
|
|
77
|
+
### Pages can be rendered when text cannot be read (#23)
|
|
78
|
+
|
|
79
|
+
`summarize` reporting `hasText: false` used to be a dead end: nothing in this server could
|
|
80
|
+
read the document any further. `render_page` closes that — it rasterises pages to PNG or JPEG
|
|
81
|
+
and returns them as MCP image content blocks, so a vision model can read a scan, a diagram, a
|
|
82
|
+
filled form, or handwriting.
|
|
83
|
+
|
|
84
|
+
```
|
|
85
|
+
render_page({ file_path: "/path/to/scan.pdf", pages: "1-3", format: "jpeg" })
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
`pages` is required: rendering is the most expensive operation here, and "all pages" of a
|
|
89
|
+
500-page scan should be a decision, not a default. The same 4 MB response budget as
|
|
90
|
+
`read_images` applies, with omissions named.
|
|
91
|
+
|
|
92
|
+
Rendering runs on **PDFium compiled to WebAssembly** (`@hyzyla/pdfium`, an optional
|
|
93
|
+
dependency). A WASM binary is the same bytes on every platform, so the published package still
|
|
94
|
+
behaves identically wherever `npx` runs it — the reason native addons are not used here.
|
|
95
|
+
Without the dependency installed, `render_page` reports what to install and every other tool
|
|
96
|
+
works normally. PDFium (BSD-3-Clause) is a different engine from the pdf.js this server reads
|
|
97
|
+
text with; the tool description says so, because a rendering difference between engines must
|
|
98
|
+
not be attributed to the file.
|
|
99
|
+
|
|
100
|
+
> Measured before choosing this: pdf.js + `@napi-rs/canvas` (1.0.7 and 0.1.80) segfaults the
|
|
101
|
+
> whole process on pages that draw images — exactly the pages this tool exists for — and
|
|
102
|
+
> renders blank pages when `standardFontDataUrl` is not configured.
|
|
103
|
+
|
|
104
|
+
### Images come back as image files (#22)
|
|
105
|
+
|
|
106
|
+
`read_images` used to base64 `imgData.data` — pdfjs's *decoded pixels*. An 8×8 RGB image was
|
|
107
|
+
192 bytes with no PNG or JPEG signature anywhere in it, so the result could not be opened by
|
|
108
|
+
any viewer and could not be read by a vision model, which is the reason to extract an image in
|
|
109
|
+
the first place.
|
|
110
|
+
|
|
111
|
+
Images are now encoded (PNG by default, lossless; `format: "jpeg"` with `quality` when smaller
|
|
112
|
+
matters) and returned as MCP `image` content blocks, with the metadata alongside in a text
|
|
113
|
+
block. Both encoders are written out here — no native addon, no per-platform binary.
|
|
114
|
+
|
|
115
|
+
The response is bounded at 4 MB of encoded image data. A 200 dpi A4 scan is ~11.6 MB of pixels
|
|
116
|
+
on its own, so images past the budget are **named with the reason** rather than dropped:
|
|
117
|
+
|
|
118
|
+
```
|
|
119
|
+
read_images({ file_path: "/path/to/scan.pdf", pages: "1", max_width: 1200, format: "jpeg" })
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
`read_images` returns the image XObjects a page draws. It is not a picture of the page — vector
|
|
123
|
+
drawings and text are not covered by it.
|
|
124
|
+
|
|
125
|
+
### Text extractability — three states, not two (#21)
|
|
126
|
+
|
|
127
|
+
`read_text` used to answer with text or with nothing, and nothing meant three different things.
|
|
128
|
+
ISO 32000-2 §9.10.1 separates them, so this server does too. Every text-returning tool —
|
|
129
|
+
`read_text`, `read_url`, `search_text`, `extract_structured_text`, `summarize` — reports, per
|
|
130
|
+
page:
|
|
131
|
+
|
|
132
|
+
| State | Condition | What to do next |
|
|
133
|
+
| --- | --- | --- |
|
|
134
|
+
| `extracted` | Every font used has a route to Unicode under §9.10.2 | Use the text |
|
|
135
|
+
| `no_text_layer` | No text-showing operator (`Tj` `TJ` `'` `"`), image content present | The page is pixels. OCR or a rendered image is needed; this server does neither |
|
|
136
|
+
| `not_extractable` | A font used has no `/ToUnicode`, no standard encoding and no known CID collection | Text is missing or wrong. The report names the fonts and the clause |
|
|
137
|
+
| `not_observed` | Encrypted, or the content stream could not be read | Nothing was measured. Not the same as "nothing is there" |
|
|
138
|
+
|
|
139
|
+
`not_extractable` is reported **per font**, so a page that mixes a readable font with an
|
|
140
|
+
unreadable one is a partial loss and says so, rather than passing as complete.
|
|
141
|
+
|
|
142
|
+
The observation is made from the file, not from pdf.js's output: pdf.js synthesises a
|
|
143
|
+
`toUnicode` map for every font it loads, so asking it whether a font has a `/ToUnicode` CMap
|
|
144
|
+
answers yes for fonts whose dictionary has none.
|
|
145
|
+
|
|
60
146
|
## Installation
|
|
61
147
|
|
|
62
148
|
### npx (recommended)
|
package/dist/constants.d.ts
CHANGED
|
@@ -7,6 +7,26 @@ export declare const CHARACTER_LIMIT = 25000;
|
|
|
7
7
|
export declare const MAX_FILE_SIZE: number;
|
|
8
8
|
/** Default page limit for text extraction */
|
|
9
9
|
export declare const DEFAULT_PAGE_LIMIT = 50;
|
|
10
|
+
/**
|
|
11
|
+
* Ceiling on the ENCODED image bytes one `read_images` response may carry (#22).
|
|
12
|
+
*
|
|
13
|
+
* A 200 dpi A4 scan decodes to 1654×2339×3 = 11.6 MB of pixels, which is ~15.5 MB
|
|
14
|
+
* once base64'd — a single image can therefore exceed anything a client will
|
|
15
|
+
* accept. `read_text` has had a character limit since the beginning; images had
|
|
16
|
+
* none, which is the asymmetry this closes. Images beyond the budget are named
|
|
17
|
+
* and omitted rather than silently dropped.
|
|
18
|
+
*/
|
|
19
|
+
export declare const MAX_IMAGE_RESPONSE_BYTES: number;
|
|
20
|
+
/**
|
|
21
|
+
* Ceiling on the pixels of a single image this server will re-encode.
|
|
22
|
+
*
|
|
23
|
+
* The encoders are plain JavaScript. Above this size the cost is measured in
|
|
24
|
+
* seconds, and a caller who wants such an image should say what size they want
|
|
25
|
+
* it at (`max_width` / `max_height`) rather than wait for the full one.
|
|
26
|
+
*/
|
|
27
|
+
export declare const MAX_IMAGE_PIXELS = 40000000;
|
|
28
|
+
/** Default JPEG quality for `read_images` when `format: "jpeg"` is asked for. */
|
|
29
|
+
export declare const DEFAULT_IMAGE_QUALITY = 80;
|
|
10
30
|
/** Maximum number of search results to return */
|
|
11
31
|
export declare const MAX_SEARCH_RESULTS = 100;
|
|
12
32
|
/** Default context characters around search matches */
|
package/dist/constants.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA;;GAEG;AAOH,0CAA0C;AAC1C,eAAO,MAAM,eAAe,QAAS,CAAC;AAEtC,4CAA4C;AAC5C,eAAO,MAAM,aAAa,QAAmB,CAAC;AAE9C,6CAA6C;AAC7C,eAAO,MAAM,kBAAkB,KAAK,CAAC;AAErC,iDAAiD;AACjD,eAAO,MAAM,kBAAkB,MAAM,CAAC;AAEtC,uDAAuD;AACvD,eAAO,MAAM,sBAAsB,KAAK,CAAC;AAEzC,kBAAkB;AAClB,eAAO,MAAM,WAAW,mBAAmB,CAAC;AAE5C,2EAA2E;AAC3E,eAAO,MAAM,cAAc,QAAsB,CAAC;AAElD;;;;;;;GAOG;AACH,eAAO,MAAM,yBAAyB,IAAI,CAAC;AAE3C,0CAA0C;AAC1C,eAAO,MAAM,iBAAiB,QAC8D,CAAC;AAE7F,2BAA2B;AAC3B,oBAAY,cAAc;IACxB,QAAQ,aAAa;IACrB,IAAI,SAAS;CACd"}
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA;;GAEG;AAOH,0CAA0C;AAC1C,eAAO,MAAM,eAAe,QAAS,CAAC;AAEtC,4CAA4C;AAC5C,eAAO,MAAM,aAAa,QAAmB,CAAC;AAE9C,6CAA6C;AAC7C,eAAO,MAAM,kBAAkB,KAAK,CAAC;AAErC;;;;;;;;GAQG;AACH,eAAO,MAAM,wBAAwB,QAAkB,CAAC;AAExD;;;;;;GAMG;AACH,eAAO,MAAM,gBAAgB,WAAa,CAAC;AAE3C,iFAAiF;AACjF,eAAO,MAAM,qBAAqB,KAAK,CAAC;AAExC,iDAAiD;AACjD,eAAO,MAAM,kBAAkB,MAAM,CAAC;AAEtC,uDAAuD;AACvD,eAAO,MAAM,sBAAsB,KAAK,CAAC;AAEzC,kBAAkB;AAClB,eAAO,MAAM,WAAW,mBAAmB,CAAC;AAE5C,2EAA2E;AAC3E,eAAO,MAAM,cAAc,QAAsB,CAAC;AAElD;;;;;;;GAOG;AACH,eAAO,MAAM,yBAAyB,IAAI,CAAC;AAE3C,0CAA0C;AAC1C,eAAO,MAAM,iBAAiB,QAC8D,CAAC;AAE7F,2BAA2B;AAC3B,oBAAY,cAAc;IACxB,QAAQ,aAAa;IACrB,IAAI,SAAS;CACd"}
|
package/dist/constants.js
CHANGED
|
@@ -10,6 +10,26 @@ export const CHARACTER_LIMIT = 25_000;
|
|
|
10
10
|
export const MAX_FILE_SIZE = 50 * 1024 * 1024;
|
|
11
11
|
/** Default page limit for text extraction */
|
|
12
12
|
export const DEFAULT_PAGE_LIMIT = 50;
|
|
13
|
+
/**
|
|
14
|
+
* Ceiling on the ENCODED image bytes one `read_images` response may carry (#22).
|
|
15
|
+
*
|
|
16
|
+
* A 200 dpi A4 scan decodes to 1654×2339×3 = 11.6 MB of pixels, which is ~15.5 MB
|
|
17
|
+
* once base64'd — a single image can therefore exceed anything a client will
|
|
18
|
+
* accept. `read_text` has had a character limit since the beginning; images had
|
|
19
|
+
* none, which is the asymmetry this closes. Images beyond the budget are named
|
|
20
|
+
* and omitted rather than silently dropped.
|
|
21
|
+
*/
|
|
22
|
+
export const MAX_IMAGE_RESPONSE_BYTES = 4 * 1024 * 1024;
|
|
23
|
+
/**
|
|
24
|
+
* Ceiling on the pixels of a single image this server will re-encode.
|
|
25
|
+
*
|
|
26
|
+
* The encoders are plain JavaScript. Above this size the cost is measured in
|
|
27
|
+
* seconds, and a caller who wants such an image should say what size they want
|
|
28
|
+
* it at (`max_width` / `max_height`) rather than wait for the full one.
|
|
29
|
+
*/
|
|
30
|
+
export const MAX_IMAGE_PIXELS = 40_000_000;
|
|
31
|
+
/** Default JPEG quality for `read_images` when `format: "jpeg"` is asked for. */
|
|
32
|
+
export const DEFAULT_IMAGE_QUALITY = 80;
|
|
13
33
|
/** Maximum number of search results to return */
|
|
14
34
|
export const MAX_SEARCH_RESULTS = 100;
|
|
15
35
|
/** Default context characters around search matches */
|
package/dist/constants.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAE5C,MAAM,OAAO,GAAG,aAAa,CAAC,
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAE5C,MAAM,OAAO,GAAG,aAAa,CAAC,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC;AAC/C,MAAM,WAAW,GAAG,OAAO,CAAC,iBAAiB,CAAwB,CAAC;AAEtE,0CAA0C;AAC1C,MAAM,CAAC,MAAM,eAAe,GAAG,MAAM,CAAC;AAEtC,4CAA4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AAgB,iBAAiB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,eAAe,CAS1E;AAED;;;GAGG;AACH,eAAO,MAAM,YAAY;aACvB,aAAa,cAAc,MAAM,KAAG,UAAU;aAK9C,eAAe,cAAc,MAAM,KAAG,UAAU;aAKhD,mBAAmB,cAAc,MAAM,KAAG,UAAU;aAKpD,QAAQ,QAAM,UAAU;aAIxB,UAAU,QAAM,UAAU;aAI1B,QAAQ,SAAS,MAAM,KAAG,UAAU;CAK5B,CAAC"}
|
package/dist/errors.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAiEH;;;GAGG;AACH,MAAM,UAAU,SAAS,CACvB,IAAkB,EAClB,OAAe,EACf,
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAiEH;;;GAGG;AACH,MAAM,UAAU,SAAS,CACvB,IAAkB,EAClB,OAAe,EACf,OAAO,GAKH,EAAE;IAEN,MAAM,GAAG,GAAoB,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;IACtD,IAAI,OAAO,CAAC,IAAI;QAAE,GAAG,CAAC,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;IAC1C,IAAI,OAAO,CAAC,YAAY,IAAI,OAAO,CAAC,YAAY,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAC5D,GAAG,CAAC,YAAY,GAAG,OAAO,CAAC,YAAY,CAAC;IAC1C,CAAC;IACD,IAAI,OAAO,CAAC,SAAS,KAAK,SAAS;QAAE,GAAG,CAAC,SAAS,GAAG,OAAO,CAAC,SAAS,CAAC;IACvE,IAAI,OAAO,CAAC,MAAM;QAAE,GAAG,CAAC,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAChD,OAAO,GAA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,EAAE,CAAC,GAAY,EAAc,EAAE,CAAC,CAAC;QACvC,MAAM,EAAE,YAAY;QACpB,MAAM,EAAE,mCAAmC;QAC3C,OAAO,EAAE,GAAG,CAAC,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC,SAAS;KACnC,CAAC;CACM,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -12,8 +12,8 @@ const _originalConsoleLog = console.log;
|
|
|
12
12
|
const _originalConsoleWarn = console.warn;
|
|
13
13
|
console.log = (...args) => console.error('[log]', ...args);
|
|
14
14
|
console.warn = (...args) => console.error('[warn]', ...args);
|
|
15
|
-
import { McpServer } from '@modelcontextprotocol/
|
|
16
|
-
import { StdioServerTransport } from '@modelcontextprotocol/
|
|
15
|
+
import { McpServer } from '@modelcontextprotocol/server';
|
|
16
|
+
import { StdioServerTransport } from '@modelcontextprotocol/server/stdio';
|
|
17
17
|
import { SERVER_NAME, SERVER_VERSION } from './constants.js';
|
|
18
18
|
import { registerAllTools } from './tools/index.js';
|
|
19
19
|
/**
|
|
@@ -38,7 +38,13 @@ What it does NOT do:
|
|
|
38
38
|
(verify_signatures / verify_integrity).
|
|
39
39
|
- No conformance judgement. validate_tagged / validate_metadata are deprecated in favour of
|
|
40
40
|
pdf-verify-mcp's validate_conformance, which delegates to veraPDF.
|
|
41
|
-
- No incremental-update history (that is pdf-verify-mcp verify_integrity), and no OCR.
|
|
41
|
+
- No incremental-update history (that is pdf-verify-mcp verify_integrity), and no OCR. It
|
|
42
|
+
does DETECT that OCR is needed and say so: every text-returning tool reports, per page,
|
|
43
|
+
whether the characters could be converted to Unicode at all (ISO 32000-2 §9.10.1) —
|
|
44
|
+
extracted / no_text_layer / not_extractable / not_observed. An empty extraction result is
|
|
45
|
+
therefore never on its own evidence that a page has no text. When a page cannot be read as
|
|
46
|
+
text, render_page rasterises it (PDFium-WASM, optional dependency) so a vision model can
|
|
47
|
+
read the pixels instead.
|
|
42
48
|
|
|
43
49
|
It DOES map content to coordinates: locate_objects turns an object number into a page and a
|
|
44
50
|
rectangle, and extract_structured_text with include_bbox does the same for a structure element.
|
|
@@ -49,6 +55,11 @@ measurement and a rectangle the file merely declares are not the same claim.
|
|
|
49
55
|
Where an observation here and a verdict from pdf-verify-mcp disagree, the verdict wins —
|
|
50
56
|
this server reads the file, the validator applies the rules.
|
|
51
57
|
|
|
58
|
+
This server never writes to the file system — every tool is read-only. That is also why
|
|
59
|
+
read_url returns text and nothing more: it does not save the fetched bytes, so pointing the
|
|
60
|
+
other tools at a URL's PDF means downloading the file first (the caller's job, not this
|
|
61
|
+
server's) and passing its local path.
|
|
62
|
+
|
|
52
63
|
For what the specification *requires*, ask pdf-spec-mcp. This server never quotes ISO clauses.`;
|
|
53
64
|
const server = new McpServer({
|
|
54
65
|
name: SERVER_NAME,
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA;;;;;GAKG;AAEH,8CAA8C;AAC9C,sEAAsE;AACtE,sEAAsE;AACtE,MAAM,mBAAmB,GAAG,OAAO,CAAC,GAAG,CAAC;AACxC,MAAM,oBAAoB,GAAG,OAAO,CAAC,IAAI,CAAC;AAC1C,OAAO,CAAC,GAAG,GAAG,CAAC,GAAG,IAAe,EAAE,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,OAAO,EAAE,GAAG,IAAI,CAAC,CAAC;AACtE,OAAO,CAAC,IAAI,GAAG,CAAC,GAAG,IAAe,EAAE,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,QAAQ,EAAE,GAAG,IAAI,CAAC,CAAC;AAExE,OAAO,EAAE,SAAS,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA;;;;;GAKG;AAEH,8CAA8C;AAC9C,sEAAsE;AACtE,sEAAsE;AACtE,MAAM,mBAAmB,GAAG,OAAO,CAAC,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IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
|
package/dist/schemas/common.d.ts
CHANGED
|
@@ -8,7 +8,7 @@ export declare const FilePathSchema: z.ZodString;
|
|
|
8
8
|
/** Optional page range parameter */
|
|
9
9
|
export declare const PagesSchema: z.ZodOptional<z.ZodString>;
|
|
10
10
|
/** Response format parameter */
|
|
11
|
-
export declare const ResponseFormatSchema: z.ZodDefault<z.
|
|
11
|
+
export declare const ResponseFormatSchema: z.ZodDefault<z.ZodEnum<typeof ResponseFormat>>;
|
|
12
12
|
/** URL parameter for remote PDFs */
|
|
13
|
-
export declare const UrlSchema: z.
|
|
13
|
+
export declare const UrlSchema: z.ZodURL;
|
|
14
14
|
//# sourceMappingURL=common.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../src/schemas/common.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAEjD,8CAA8C;AAC9C,eAAO,MAAM,cAAc,aAGqD,CAAC;AAEjF,oCAAoC;AACpC,eAAO,MAAM,WAAW,4BAGmE,CAAC;AAE5F,gCAAgC;AAChC,eAAO,MAAM,oBAAoB,
|
|
1
|
+
{"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../src/schemas/common.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAEjD,8CAA8C;AAC9C,eAAO,MAAM,cAAc,aAGqD,CAAC;AAEjF,oCAAoC;AACpC,eAAO,MAAM,WAAW,4BAGmE,CAAC;AAE5F,gCAAgC;AAChC,eAAO,MAAM,oBAAoB,gDAGsD,CAAC;AAExF,oCAAoC;AACpC,eAAO,MAAM,SAAS,UAEmC,CAAC"}
|
package/dist/schemas/common.js
CHANGED
|
@@ -15,12 +15,11 @@ export const PagesSchema = z
|
|
|
15
15
|
.describe('Page range to process. Format: "1-5", "3", or "1,3,5-7". Omit for all pages.');
|
|
16
16
|
/** Response format parameter */
|
|
17
17
|
export const ResponseFormatSchema = z
|
|
18
|
-
.
|
|
18
|
+
.enum(ResponseFormat)
|
|
19
19
|
.default(ResponseFormat.MARKDOWN)
|
|
20
20
|
.describe('Output format: "markdown" for human-readable, "json" for structured data');
|
|
21
21
|
/** URL parameter for remote PDFs */
|
|
22
22
|
export const UrlSchema = z
|
|
23
|
-
.string()
|
|
24
23
|
.url('Must be a valid URL')
|
|
25
24
|
.describe('URL pointing to a PDF file (HTTP or HTTPS)');
|
|
26
25
|
//# sourceMappingURL=common.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"common.js","sourceRoot":"","sources":["../../src/schemas/common.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAEjD,8CAA8C;AAC9C,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC;KAC5B,MAAM,EAAE;KACR,GAAG,CAAC,CAAC,EAAE,uBAAuB,CAAC;KAC/B,QAAQ,CAAC,mEAAmE,CAAC,CAAC;AAEjF,oCAAoC;AACpC,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC;KACzB,MAAM,EAAE;KACR,QAAQ,EAAE;KACV,QAAQ,CAAC,8EAA8E,CAAC,CAAC;AAE5F,gCAAgC;AAChC,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC;KAClC,
|
|
1
|
+
{"version":3,"file":"common.js","sourceRoot":"","sources":["../../src/schemas/common.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,cAAc,EA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