Add MCPB packaging and Claude Code plugin for pdf-server#491
Merged
ochafik merged 2 commits intomodelcontextprotocol:mainfrom Feb 24, 2026
Merged
Conversation
Two distribution paths for the pdf-server: 1. **MCPB bundle** (Claude Desktop MCP Directory): - manifest.json: v0.3 manifest with tools, compatibility, privacy - .mcpbignore: excludes source/tests from bundle - icon.png: 64x64 PDF document icon 2. **Claude Code plugin** (plugin/): - .mcp.json: declares local stdio server via npx - commands: /pdf-research:read, /pdf-research:summarize - skills: pdf-reading skill for document navigation - Tested end-to-end: MCP server connects, all tools available The plugin uses a local stdio MCP server pattern — the first known instance in a knowledge-work plugin (all existing plugins use remote HTTP connectors). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@modelcontextprotocol/ext-apps
@modelcontextprotocol/server-basic-react
@modelcontextprotocol/server-basic-vanillajs
@modelcontextprotocol/server-budget-allocator
@modelcontextprotocol/server-cohort-heatmap
@modelcontextprotocol/server-customer-segmentation
@modelcontextprotocol/server-map
@modelcontextprotocol/server-pdf
@modelcontextprotocol/server-scenario-modeler
@modelcontextprotocol/server-shadertoy
@modelcontextprotocol/server-sheet-music
@modelcontextprotocol/server-system-monitor
@modelcontextprotocol/server-threejs
@modelcontextprotocol/server-transcript
@modelcontextprotocol/server-video-resource
@modelcontextprotocol/server-wiki-explorer
commit: |
ochafik
previously approved these changes
Feb 23, 2026
Contributor
ochafik
left a comment
There was a problem hiding this comment.
Thanks @bryan-anthropic !
Can you please run npm run prettier:fix + commit to get the CI green?
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
ochafik
approved these changes
Feb 24, 2026
ochafik
added a commit
that referenced
this pull request
Feb 24, 2026
Bug fixes / improvements since 1.1.0: - fix: add audio/video support for basic-host (#460) - fix(pdf-server): remove page-loading overlay (#493) - pdf-server: remove domain allowlist, require HTTPS only (#487) - Set audioSession.type to playback in sheet music app (#489) - Add MCPB packaging and Claude Code plugin for pdf-server (#491)
ochafik
added a commit
that referenced
this pull request
Feb 24, 2026
Bug fixes / improvements since 1.1.0: - fix: add audio/video support for basic-host (#460) - fix(pdf-server): remove page-loading overlay (#493) - pdf-server: remove domain allowlist, require HTTPS only (#487) - Set audioSession.type to playback in sheet music app (#489) - Add MCPB packaging and Claude Code plugin for pdf-server (#491)
ochafik
added a commit
that referenced
this pull request
Feb 24, 2026
Bug fixes / improvements since 1.1.0: - fix: add audio/video support for basic-host (#460) - fix(pdf-server): remove page-loading overlay (#493) - pdf-server: remove domain allowlist, require HTTPS only (#487) - Set audioSession.type to playback in sheet music app (#489) - Add MCPB packaging and Claude Code plugin for pdf-server (#491)
ochafik
added a commit
that referenced
this pull request
Apr 2, 2026
ochafik
added a commit
that referenced
this pull request
Apr 2, 2026
* fix(pdf-server): stub DOMMatrix/ImageData/Path2D for npx without @napi-rs/canvas pdfjs-dist/legacy/build/pdf.mjs does `new DOMMatrix()` at module scope. Its own polyfill loads @napi-rs/canvas (an optionalDependency), but npx frequently misses the platform-native binary (npm/cli#4828), so the server crashed on `npx @modelcontextprotocol/server-pdf --stdio`: ReferenceError: DOMMatrix is not defined at pdfjs-dist/legacy/build/pdf.mjs:17078 The server only uses pdfjs for text/metadata/form-field extraction — never canvas rendering — so no-op stubs suffice and avoid shipping ~130MB of native binaries. The polyfill is a separate ESM module kept --external in the bun bundle so it executes before pdfjs's hoisted static import; inlined body code would run too late. Broken since 1.3.0 (#506). Thanks to Bryan Thompson for the analysis and fix shape from the npm-to-mcpb pipeline. * fix(pdf-server): MCPB bundle missing runtime deps + display_name with spaces `mcpb pack` zips whatever is on disk; in this monorepo all runtime deps are hoisted to root node_modules, so the published .mcpb shipped without pdfjs-dist/ajv/express/etc. and crashed on import in Claude Desktop. build-mcpb.mjs stages dist/ + manifest into a clean temp dir, runs a non-workspace `npm install --omit=dev --omit=optional` (the new DOMMatrix polyfill makes @napi-rs/canvas's ~130MB of native binaries unnecessary), syncs manifest.version to package.json, then packs. Result: 12.3MB / 38.8MB unpacked, full MCP handshake + tools/list pass. Also rename display_name "PDF (By Anthropic)" → "pdf-viewer" — spaces in display_name break MCP App UI rendering for MCPBs in Claude Desktop. CI now smoke-tests the extracted bundle starts (`dist/index.js --stdio` prints "Ready") so a deps-less bundle can't ship again. * fix(pdf-server): list interact in MCPB manifest tools (was stale since #491)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds two distribution paths for the pdf-server:
manifest.json,.mcpbignore,icon.png)claude plugin install(plugin/directory)MCPB packaging files
manifest.json.mcpbignoreicon.pngThese enable building a
.mcpbbundle viamcpb packfor distribution through the MCP Directory.Claude Code plugin (
plugin/)The key innovation:
.mcp.json{ "mcpServers": { "pdf": { "command": "npx", "args": ["@modelcontextprotocol/server-pdf", "--stdio"] } } }This declares a local stdio MCP server that starts automatically when the plugin loads. No remote deployment, no API keys —
npxfetches and runs the pdf-server package locally.Test results
Tested end-to-end in Claude Code:
list_pdfsdisplay_pdf/pdf-research:read,/pdf-research:summarize)pdf-research:pdf-reading)Install and test
Context
This was developed as part of an investigation into how the pdf-server could support knowledge-work workflows in Cowork. The plugin follows the
anthropics/knowledge-work-pluginsconventions but uses a local server instead of a remote connector — the first known instance of this pattern.A corresponding PR has been opened at anthropics/knowledge-work-plugins to add this plugin to the marketplace.
Test plan
claude plugin validate examples/pdf-server/pluginclaude --plugin-dir examples/pdf-server/plugin/pdf-research:readopens a PDFlist_pdfsanddisplay_pdftools are available🤖 Generated with Claude Code