Skip to content

Inline Nitro PDF viewer in Claude#90

Closed
SudNitro23 wants to merge 5 commits into
mainfrom
inline-pdf-viewer
Closed

Inline Nitro PDF viewer in Claude#90
SudNitro23 wants to merge 5 commits into
mainfrom
inline-pdf-viewer

Conversation

@SudNitro23

@SudNitro23 SudNitro23 commented Jun 19, 2026

Copy link
Copy Markdown

What

Adds view_pdf — renders a PDF in Nitro's reader inline inside the Claude conversation (MCP-App iframe). No browser popup, no second login, no network.

How it works

The viewer is Nitro's nitro-pdf-reader Angular web component (apps/public-reader). The MCP-App sandbox has no origin and blocks all outbound network, so the multi-file build is folded into one self-contained HTML:

  • scripts/inline-viewer.mjs — collapses app chunks + dynamic imports into one ESM bundle (esbuild), embeds the worker as a Blob URL, injects the Pdfium WASM via emscripten wasmBinary (sandbox CSP blocks fetch() of even data: URLs), inlines the Kendo theme + IBM Plex fonts as data: URLs.
  • scripts/viewer-bridge.js — connects via @modelcontextprotocol/ext-apps, streams the PDF bytes over the MCP transport, reroutes Download through the host, adds a widescreen toggle + Esc/⌘Z/⌘⇧Z shortcuts.
  • src/tools/viewer.ts — registers view_pdf, the get_pdf_for_viewer byte provider, and a save_pdf_edits stub.

Notes for reviewers

  • src/assets/mcp-app.html is a generated ~26 MB single-file bundle (built by inline-viewer.mjs), committed so the release workflow produces a working extension. Excluded from lint/format.
  • manifest.json version unchanged — the Publish Release workflow owns version bumps.

🤖 Generated with Claude Code

SudNitro23 and others added 5 commits June 16, 2026 10:36
Render PDFs inside the Claude conversation using Nitro's nitro-pdf-reader
web component, folded into one self-contained MCP-App HTML — no browser
popup, no network, no second login.

- view_pdf tool mounts the viewer as an MCP-App resource; PDF bytes stream
  over the MCP transport via get_pdf_for_viewer (the sandbox CSP blocks all
  outbound network).
- scripts/inline-viewer.mjs bundles the multi-file public-reader build into
  one HTML: app chunks + worker inlined, Pdfium WASM fed via emscripten
  wasmBinary, Kendo CSS + IBM Plex fonts inlined as data: URLs.
- scripts/viewer-bridge.js connects via @modelcontextprotocol/ext-apps,
  loads the file, reroutes Download through the host, and adds a widescreen
  toggle.
- save_pdf_edits is a stub pending a component save event.
- Remove the legacy popup/companion editor and its express/open deps.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@SudNitro23

Copy link
Copy Markdown
Author

Closing — keeping this as a POC branch (inline-pdf-viewer), not merging into main for now. The work stays on the branch; can reopen a PR if/when we decide to land it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant