You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
server-pdf: read_pdf_bytes hides the byte payload in structuredContent only — text content is a bare size summary, so CLI clients can't read the PDF #762
@modelcontextprotocol/server-pdf v2.0.0's read_pdf_bytes returns the requested bytes only inside structuredContent. The content[0].text block contains just a size summary like 256 bytes at 0/641720 with no data.
Clients that render only content[] text blocks (e.g. terminal/CLI MCP clients like opencode) never see the bytes — they are silently dropped. The description also warns "The model should NOT call this tool directly", yet it is the only server-side way to get raw PDF content when the interactive viewer path is unavailable.
Reproduction
Run the server: npx @modelcontextprotocol/server-pdf --stdio <allowed-dir>
The base64 bytes decode to the real %PDF-1.4 header, so the data is correct — it's just unreachable to text-only clients.
Expected behavior
The byte payload should be reachable through the standard content[] text block, e.g. include the JSON payload (or the base64 bytes) in the text content, not only in structuredContent. Any MCP client that renders content[] should be able to consume the data without requiring structured-content support.
Related issue: display_pdf + interact requires an interactive viewer
display_pdf returns a viewUUID and interact get_text waits for the viewer iframe to poll within 8 seconds ("Viewer never connected for viewUUID ... (no poll within 8s)"). In headless/CLI contexts no iframe mounts, so text extraction via this path always fails. There is no non-viewer server-side text-extraction tool, so headless clients have no working path to PDF text today.
Environment
Package: @modelcontextprotocol/server-pdf 2.0.0 (installed via npx, run with --stdio under Docker isolation)
Client: opencode CLI (terminal MCP client)
The server runs fine: connection, init, and tool discovery all succeed; only content delivery is affected.
@modelcontextprotocol/server-pdf is maintained in modelcontextprotocol/ext-apps (examples/pdf-server), not this repo. Transferring so the right people see it.
I'd like to take this. I've opened a fix in #782: read_pdf_bytes now also returns the serialized JSON in content[0].text (per the spec's recommendation for tools with structured content), and the viewer keeps reading structuredContent. One trade-off, noted in the PR: each chunk now goes over the wire twice. If you'd prefer, I can include the text copy only for clients that don't support MCP Apps. I left the headless text-extraction part out for a separate change.
Activity
olaservo commentedon Aug 28, 2026
@modelcontextprotocol/server-pdfis maintained in modelcontextprotocol/ext-apps (examples/pdf-server), not this repo. Transferring so the right people see it.DLeibner commentedon Sep 22, 2026
I'd like to take this. I've opened a fix in #782:
read_pdf_bytesnow also returns the serialized JSON incontent[0].text(per the spec's recommendation for tools with structured content), and the viewer keeps readingstructuredContent. One trade-off, noted in the PR: each chunk now goes over the wire twice. If you'd prefer, I can include the text copy only for clients that don't support MCP Apps. I left the headless text-extraction part out for a separate change.