- javascript
0
GitHub Stars
javascript
Language
4 months ago
First Indexed
2 months ago
Catalog Refreshed
Documentation & install
Readme and setup notes from the catalogue, plus a client-ready config you can copy for your MCP host.
This MCP server enables you to read and extract text from PDF files, turning PDFs into a searchable knowledge base for large language models. It offers high-quality, layout-aware extraction when Python is available and a reliable fallback to ensure you can always obtain text from PDFs even in constrained environments.
How to use
Connect this server to your MCP client to start extracting content from PDFs. The server is designed to run locally and be invoked by your MCP configuration. Use the high-quality Python-backed extraction when Python is present, and rely on the Node.js fallback otherwise. You can specify page ranges to focus on relevant sections of large documents.
How to install
Prerequisites you need before installation:
-
Node.js v18 or newer
-
Python v3.10+
-
pip
Setup steps you will run in your terminal or command prompt:
npm install
# Optional: enable Python-backed extraction
# Create or activate a virtual environment if desired
python3 -m pip install -r python/requirements.txt
# Build the server after dependencies are installed
npm run build
Configuration example
Configure your MCP client to run the PDF reader server using the following stdio configuration. This starts the Node.js process that loads the index from the built distribution.
{
"mcpServers": {
"pdf_reader": {
"command": "node",
"args": ["/absolute/path/to/mcpPdf/dist/index.js"],
"env": {
"PYTHON_PATH": "/path/to/python"
}
}
}
}
Tool: read_pdf
The read_pdf tool reads and extracts text content from a PDF file. It accepts the following inputs: path (absolute path to the PDF), start_page (optional, 1-based), and end_page (optional, 1-based). When Python is available, it attempts high-quality extraction using marker-based models and LaTeX equation conversion. If Python-backed extraction fails or is unavailable, it falls back to a Node.js-based parser that returns raw text with potentially reduced formatting.
Troubleshooting
If you encounter permission issues, the project uses a local cache directory for models to avoid system permissions problems. Ensure the project directory is writable. If performance is slow, remember that high-quality extraction relies on deep learning models and may be slower on large documents without a GPU. Use start_page and end_page to limit processing to the portions you need.
Available tools
read_pdf
Reads and extracts text content from a PDF file. Takes inputs path, start_page, and end_page. Uses Python-based high-quality extraction when available, otherwise falls back to a Node.js parser.