Skip to content
Merged
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
1279c43
feat(pdf-server): Interactive PDF viewer example
ochafik Jan 13, 2026
0697d04
chore: Add pdf-server to screenshot generation list
ochafik Jan 13, 2026
2dcd3e4
refactor(pdf-server): Simplify and generalize PDF loading
ochafik Jan 13, 2026
311d058
feat(pdf-server): Include title and selection in model context
ochafik Jan 13, 2026
11fbda5
fix(pdf-server): Restore default URL in view_pdf schema
ochafik Jan 13, 2026
7799788
refactor(pdf-server): Further simplifications
ochafik Jan 13, 2026
c9f51c3
refactor(pdf-server): Major simplification for didactic focus
ochafik Jan 13, 2026
12b1213
feat(pdf-server): Add file:// URL support for local files
ochafik Jan 13, 2026
db71488
fix(pdf-server): Improve selection detection with logging
ochafik Jan 13, 2026
a001c9f
feat(pdf-server): Format model context as markdown with front matter
ochafik Jan 13, 2026
7fb4687
refactor(pdf-server): Extract smart truncation helpers
ochafik Jan 13, 2026
ae20433
fix(pdf-server): Truncate inside selection tags when selection too long
ochafik Jan 13, 2026
870c23d
refactor(pdf-server): Remove unused read_pdf_text, use Attention pape…
ochafik Jan 13, 2026
02f173d
refactor(pdf-server): Simplify to use URL as ID, rename view_pdf to d…
ochafik Jan 13, 2026
7c154e2
feat(pdf-server): Normalize arxiv URLs to PDF format
ochafik Jan 13, 2026
19e364d
docs(pdf-server): Add prompt engineering to display_pdf description
ochafik Jan 13, 2026
35a7e6d
fix(pdf-server): Sharp rendering on retina displays
ochafik Jan 13, 2026
6008f60
fix(pdf-server): Normalize arxiv URLs in read_pdf_bytes too
ochafik Jan 13, 2026
ab98f5f
add to e2e spec
ochafik Jan 13, 2026
12c0a26
add to e2e spec
ochafik Jan 13, 2026
31bd981
add to e2e spec
ochafik Jan 13, 2026
f51eeae
add to e2e spec
ochafik Jan 13, 2026
fcec16a
regen
ochafik Jan 13, 2026
ed89586
chore: regenerate package-lock.json and fix hono vulnerability
ochafik Jan 13, 2026
4b84450
docs: add pdf-server screenshot to READMEs
ochafik Jan 13, 2026
69a5975
regen
ochafik Jan 13, 2026
6df8f40
Merge branch 'main' into ochafik/pdf-server2
ochafik Jan 14, 2026
5c3e98b
ci: add missing examples to pkg-pr-new publish
ochafik Jan 14, 2026
cc480b4
ci: add pdf-server to npm publish examples
ochafik Jan 14, 2026
c02eef5
Update README.md
ochafik Jan 14, 2026
0dc44a6
Merge remote-tracking branch 'origin/main' into ochafik/pdf-server2
ochafik Jan 14, 2026
b11153a
pdf-server: improve tool response text for better model context
ochafik Jan 14, 2026
7347cf2
revert unrelated screenshot changes
ochafik Jan 14, 2026
70d360e
pdf-server: dynamically add arxiv URLs in read_pdf_bytes
ochafik Jan 14, 2026
7835283
cap length of context update in pdf-server
ochafik Jan 14, 2026
0797b25
Merge branch 'main' into ochafik/limit-context-length-pdf
ochafik Jan 14, 2026
6b52c4e
format
ochafik Jan 14, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion examples/pdf-server/src/mcp-app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ import { TextLayer } from "pdfjs-dist";
import "./global.css";
import "./mcp-app.css";

// const MAX_MODEL_CONTEXT_LENGTH = 5000;
const MAX_MODEL_CONTEXT_LENGTH = 1500;

// Configure PDF.js worker
pdfjsLib.GlobalWorkerOptions.workerSrc = new URL(
"pdfjs-dist/build/pdf.worker.mjs",
Expand Down Expand Up @@ -273,7 +276,11 @@ async function updatePageContext() {
}

// Format content with selection and truncation
const content = formatPageContent(pageText, 5000, selection);
const content = formatPageContent(
pageText,
MAX_MODEL_CONTEXT_LENGTH,
selection,
);

const markdown = `---
title: ${pdfTitle || ""}
Expand Down
Loading