modelcontextprotocol / modelcontextprotocol/ext-apps
pdf-server: make tombstone-persistence e2e runnable (basic-host iframe-reload replay or URL-keyed storage)
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 2.9k
- Forks
- 387
- Avg merge
- 3h 21m
- Merged PRs (30d)
- 6
Description
The e2e test tests/e2e/pdf-incremental-load.spec.ts › annotation tombstone preservation is currently test.fixme (see #639). It guards the restoredRemovedIds union in mcp-app.ts persistAnnotations() — a deletion on an unvisited page must survive a persistAnnotations() triggered elsewhere after a viewer reload.
Why it can't run today: the load-bearing scenario needs a fresh viewer load that reads the same localStorage key as the prior session. The key is pdf-annot:${toolId}, and:
- inner-iframe
location.reload()→ basic-host doesn't re-postMessage the cached tool result, so the viewer never gets data - a fresh
display_pdfcall → newtoolId→ new storage key → restore misses
Options (any one unblocks the test):
- basic-host replays tool result on iframe
onload(~10 lines in basic-host; benefits any MCP App that reloads its iframe). - URL-keyed annotation storage —
annotationStorageKey()keys on the PDF URL (or a hash) instead oftoolId. Annotations would survive across conversations for the same PDF, which is arguably the right product behaviour anyway. - Test-only
addInitScriptseed — one-shotlocalStorage.getItemshim returning the seeded diff for the firstpdf-annot:*lookup. No prod changes; tests the realrestoreAnnotations()→persistAnnotations()path.
The fix is currently covered by the computeDiff/serializeDiff contract tests in examples/pdf-server/src/pdf-annotations.test.ts, but those don't reach the DOM-coupled glue.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with tests/e2e/pdf-incremental-load.spec.ts and the annotation tombstone preservation case, then read mcp-app.ts persistAnnotations() and examples/pdf-server/src/pdf-annotations.test.ts. Compare the basic-host iframe reload behavior with the URL-keyed and test-only seeding options; done means the case is no longer test.fixme and passes through restoreAnnotations() and persistAnnotations().
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- frontend, testing
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100