Skip to content

feat: PDF viewer POC — preview panel + MCP Apps inline viewer#78

Draft
SudNitro23 wants to merge 1 commit into
mainfrom
feature/pdf-viewer-poc
Draft

feat: PDF viewer POC — preview panel + MCP Apps inline viewer#78
SudNitro23 wants to merge 1 commit into
mainfrom
feature/pdf-viewer-poc

Conversation

@SudNitro23

Copy link
Copy Markdown

⚠️ [POC - DO NOT MERGE] feat: PDF viewer — preview panel + MCP Apps inline viewer

This PR is for reference and documentation purposes only. It should NOT be merged into main.


Summary

This branch captures a proof-of-concept PDF viewer built on top of the Nitro MCP server, developed during a 2-day sprint. It serves as a reference for future implementation once the Nitro web editor is ready to integrate.


What was built

Preview Panel Viewer (v1)

  • Vanilla JS + PDF.js viewer served via a local Express server
  • Registered as an MCP tool (open_in_viewer) — Claude opens the PDF in a side panel when asked
  • Features: zoom, rotate, page navigation, add text overlays, save edits to disk via pdf-lib
  • Nitro branding applied throughout

MCP Apps Inline Viewer (v2)

  • Rebuilt using the @modelcontextprotocol/ext-apps spec (same pattern as PR #1183)
  • React/Vite app bundled into a single HTML file via vite-plugin-singlefile
  • Registered as a ui:// resource — designed to render inline in the conversation without a side panel
  • PDF bytes and save operations flow via callServerTool — no localhost required
  • Blocked: requires a Claude Desktop build that supports text/html;profile=mcp-app inline rendering

Why not merging

The team has decided to integrate the official Nitro web editor (provided by the frontend team) instead of maintaining a custom viewer. This branch is preserved so the patterns, tooling decisions, and implementation details can be referenced during that integration.


Reference

  • Internal POC: PR #1183 (doc-intelligence-api) by @rpalekar — MCP Apps smart redact pattern

- viewer-app/: vanilla JS PDF.js viewer (zoom, rotate, add text, save)
- src/viewer/: Express server serving the viewer HTML + PDF bytes
- src/tools/viewer.ts: open_in_viewer, get_pdf_for_viewer, save_pdf_edits
- mcp-viewer-app/: React/Vite MCP Apps inline viewer (ext-apps pattern)
- build.mjs: copies viewer assets into dist/ for mcpb packaging
- Taskfile.yml: deploy-viewer shortcut

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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