Summary
When using @modelcontextprotocol/server-pdf (v1.6.0) in VS Code with GitHub Copilot Chat, display_pdf opens a viewer but get_viewer_state always reports pageCount: 1 and get_text returns empty content for all PDFs -- local files and remote URLs alike.
Expected Behavior
get_viewer_state should return the correct page count
get_text should extract text content from PDF pages
get_screenshot should return a page image
Actual Behavior
For every PDF tested:
get_viewer_state returns { currentPage: 1, pageCount: 1, zoom: 100, ... }
get_text returns --- Page 1 --- with no text content
get_screenshot returns ERROR: No screenshot returned
- The
totalBytes in the display_pdf response is correct, suggesting the file is loaded by the server
Reproduction Steps
- Configure the server in VS Code user
mcp.json:
{
"servers": {
"pdf": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-pdf", "--stdio"]
}
}
}
- Open GitHub Copilot Chat (Agent mode)
- Ask it to display any PDF, for example the default arxiv paper:
display_pdf with url https://arxiv.org/pdf/1706.03762
- Then ask it to get the viewer state or extract text:
get_viewer_state
get_text page 1
- Observe: pageCount is 1, text is empty
PDFs Tested (all show same behavior)
| PDF |
Type |
Pages (pdfinfo) |
Pages (MCP) |
Text (MCP) |
| Local LaTeX Beamer slides (362x272 pts) |
Local file |
51 |
1 |
empty |
| Local pdflatex A4 article |
Local file |
3 |
1 |
empty |
https://arxiv.org/pdf/1706.03762 (Attention paper) |
Remote URL |
15 |
1 |
empty |
All PDFs have verified text content via pdftotext and correct page counts via pdfinfo.
Environment
- VS Code: latest stable (April 2026)
- GitHub Copilot Chat extension: v0.44.1
- server-pdf version: 1.6.0 (latest)
- OS: macOS (Apple Silicon)
- Node: via npx
Analysis
The display_pdf tool returns a correct totalBytes value, so the server reads the file. The issue appears to be that get_viewer_state and get_text query the PDF.js viewer (MCP App), but the viewer either hasn't finished loading the document or isn't properly communicating its state back through the command queue.
This could be a timing issue (commands sent before PDF.js finishes rendering) or a VS Code MCP App host issue where the iframe doesn't properly initialize.
Summary
When using
@modelcontextprotocol/server-pdf(v1.6.0) in VS Code with GitHub Copilot Chat,display_pdfopens a viewer butget_viewer_statealways reportspageCount: 1andget_textreturns empty content for all PDFs -- local files and remote URLs alike.Expected Behavior
get_viewer_stateshould return the correct page countget_textshould extract text content from PDF pagesget_screenshotshould return a page imageActual Behavior
For every PDF tested:
get_viewer_statereturns{ currentPage: 1, pageCount: 1, zoom: 100, ... }get_textreturns--- Page 1 ---with no text contentget_screenshotreturnsERROR: No screenshot returnedtotalBytesin thedisplay_pdfresponse is correct, suggesting the file is loaded by the serverReproduction Steps
mcp.json:{ "servers": { "pdf": { "command": "npx", "args": ["-y", "@modelcontextprotocol/server-pdf", "--stdio"] } } }PDFs Tested (all show same behavior)
https://arxiv.org/pdf/1706.03762(Attention paper)All PDFs have verified text content via
pdftotextand correct page counts viapdfinfo.Environment
Analysis
The
display_pdftool returns a correcttotalBytesvalue, so the server reads the file. The issue appears to be thatget_viewer_stateandget_textquery the PDF.js viewer (MCP App), but the viewer either hasn't finished loading the document or isn't properly communicating its state back through the command queue.This could be a timing issue (commands sent before PDF.js finishes rendering) or a VS Code MCP App host issue where the iframe doesn't properly initialize.