PDF MCP Server
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@PDF MCP Server extract the first 1000 characters from reports/quarterly-report.pdf"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
PDF MCP Server
Node.js server implementing Model Context Protocol (MCP) for PDF text extraction operations. Built for Claude Desktop integration with secure directory access controls.
Based on the patterns from @modelcontextprotocol/server-filesystem.
Features
Single Tool:
extract_pdf_text- Extract plain text from PDF filesDirectory Access: Same security model as filesystem MCP server
Text Limiting:
max_charsparameter to control output size and token usageSecure: Path validation and sandboxed directory access
Fast: Lightweight Node.js implementation using unpdf
Related MCP server: Document Intelligence MCP Server
Installation
General MCP Clients
Add the following to your mcp server configuration file:
{
"mcpServers": {
"pdf-reader": {
"command": "npx",
"args": ["-y", "@johangorter/mcp-pdf-server", "/Users/username/Desktop"]
}
}
}Desktop Extension (.mcpb) for Claude Desktop
For more information about Desktop Extensions, see the official MCPB documentation.
Download the
.mcpbfile from the Releases page.Navigate to Settings > Extensions in Claude Desktop
Click "Install Extension" and select the
.mcpbfile
Usage
The server provides one main tool:
extract_pdf_text
Extract text content from PDF files with optional character limiting.
Parameters:
path(string, required): Path to PDF file within allowed directoriesmax_chars(number, optional): Maximum characters to return (default: unlimited)
Example:
// Claude will call this tool when you ask:
// "Extract the first 1000 characters from report.pdf"
{
"tool": "extract_pdf_text",
"arguments": {
"path": "reports/quarterly-report.pdf",
"max_chars": 1000
}
}Configuration
Directory Access
Specify allowed directories as command-line arguments:
npx @johangorter/mcp-pdf-server /path/to/documents /path/to/pdfsRoots Protocol Support
The server supports dynamic directory updates via MCP Roots protocol, enabling runtime directory changes without restart.
Error Handling
Standard MCP error codes:
-32602: Invalid params (file not found, invalid path)-32603: Internal error (PDF parsing failed, file corrupted)
Dependencies
{
"@modelcontextprotocol/sdk": "^1.17.0",
"pdf-parse": "^1.1.1",
"zod-to-json-schema": "^3.23.5"
}Development
Prerequisites
Node.js 22+
TypeScript
Setup
# Clone the repository
git clone https://github.com/johan-gorter/mcp-pdf-server.git
cd mcp-pdf-server
# Install dependencies
npm install
# Build the project
npm run buildContinuous Integration
This project uses GitHub Actions for automated testing and deployment:
CI Pipeline: Runs on every push and pull request
Tests on Ubuntu and Windows
Runs linting, formatting checks, and tests
Release Pipeline: Triggers on package.json version changes
Creates GitHub releases with MCPB bundle
Builds and publishes Docker images
Development Scripts
# Build TypeScript to JavaScript
npm run build
# Build in watch mode (rebuilds on file changes)
npm run watch
# Run the server locally for development
npm run dev
# Start the compiled server
npm run start
# Run tests
npm test
# Run tests in watch mode
npm run test:watch
# Run tests with coverage
npm run test:coverage
# Lint the code
npm run lint
# Fix linting issues
npm run lint:fix
# Format code with Prettier
npm run format
# Check code formatting
npm run format:check
# Clean build artifacts
npm run cleanTesting
The project uses Jest for testing with TypeScript support:
# Run all tests
npm test
# Run tests in watch mode during development
npm run test:watch
# Generate test coverage report
npm run test:coverageTest files are located in src/__tests__/ and follow the pattern *.test.ts.
MCPB Bundle Creation
This project supports creating MCPB (MCP Bundle) files for easy distribution and installation:
# Build the MCPB bundle
npm run build:mcpbThe MCPB bundle includes:
Compiled TypeScript server (
dist/)Runtime dependencies (
node_modules/)Bundle manifest (
manifest.json)Documentation and license files
MCPB bundles can be installed in Claude Desktop and other MCP-compatible clients with a single click.
Docker Development
Build and run with Docker:
# Build Docker image
docker build -t mcp-pdf-server .
# Run with Docker
docker run -i --rm \
--mount type=bind,src=/path/to/pdfs,dst=/pdfs \
mcp-pdf-server /pdfsOr use the pre-built Docker image:
# Pull from GitHub Container Registry
docker pull ghcr.io/johan-gorter/mcp-pdf-server:latest
# Run the container
docker run -i --rm \
--mount type=bind,src=/path/to/pdfs,dst=/pdfs \
ghcr.io/johan-gorter/mcp-pdf-server:latest /pdfsCode Quality
The project enforces code quality through:
TypeScript: Strong typing and compile-time error checking
ESLint: Code linting with TypeScript-specific rules
Prettier: Consistent code formatting
Jest: Comprehensive unit testing
Project Structure
mcp-pdf-server/
├── src/
│ ├── __tests__/ # Test files
│ │ ├── lib.test.ts
│ │ ├── path-utils.test.ts
│ │ └── roots-utils.test.ts
│ ├── index.ts # Main server entry point
│ ├── lib.ts # Core functionality
│ ├── path-utils.ts # Path handling utilities
│ ├── path-validation.ts # Security validation
│ └── roots-utils.ts # MCP roots support
├── dist/ # Compiled JavaScript (generated)
├── coverage/ # Test coverage reports (generated)
├── package.json # Dependencies and scripts
├── tsconfig.json # TypeScript configuration
├── jest.config.cjs # Jest testing configuration
├── .eslintrc.cjs # ESLint configuration
├── .prettierrc # Prettier configuration
├── Dockerfile # Docker build configuration
└── README.mdLimitations
Text Only: No image, table, or metadata extraction
No OCR: Scanned PDFs without embedded text won't work
Memory: Large PDFs (>100MB) may cause memory issues
No Concurrent Processing: Processes one PDF at a time
License
MIT License
Available Tools
2 toolsextract_pdf_textA
Extract text content from PDF files with optional character limiting. This tool reads PDF files and extracts their text content. Supports limiting the output size via max_chars parameter to prevent context overflow. Only works with PDF files containing embedded text - scanned PDFs without OCR won't work. Only works within allowed directories.
Inputs: path (required), max_chars.
list_allowed_directoriesA
Returns the list of directories that this server is allowed to access. Subdirectories within these allowed directories are also accessible. Use this to understand which directories and their nested paths are available before trying to access PDF files.
Inputs: no named parameters.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 2 tools
The two tools have clearly distinct purposes: one extracts PDF text, the other lists accessible directories. There is no overlap or ambiguity in when to use each.
Both tool names use snake_case and follow a predictable verb-first pattern. The convention is consistent across the set.
Two tools is thin for a PDF-focused server, even one centered on extraction. The directory listing tool is useful, but the overall surface feels under-scoped.
The server lacks common PDF operations such as page-range extraction, metadata retrieval, batch processing, and OCR for scanned documents. These are significant gaps that will limit agent workflows.
Maintenance
Related MCP Connectors
Parse, extract, split, and ask over digital PDFs (text layer, no OCR) from Cursor and Claude.
Generate and read PDFs for AI agents: a generate_pdf and a read_pdf tool, priced per document.
PDF AI for your own documents: ask from any MCP client and get answers that cite the source.
Safe folder access for ChatGPT and Claude: read, write and search files, risky tools opt-in.
Related MCP Servers
- AlicenseAqualityAmaintenanceConvert any file (PDF, Word, PowerPoint, Excel, EPUB, HTML, images, audio, video) to clean Markdown for AI agents. Local-first Rust MCP server and CLI with no API key.41,078MIT
- FlicenseNot gradedqualityDmaintenanceEnables Claude to read and analyze PDF documents with automatic OCR processing for scanned files. Features intelligent text extraction, caching for performance, and secure file access with search capabilities.1-

pdfluent-mcpofficial
AlicenseAqualityBmaintenanceEnables MCP clients to read local PDFs as markdown, plain text, tables, or positioned blocks; inspect metadata; search documents; list and fill form fields into new files; and identify pages needing vision, while keeping documents on-machine and limiting access to allowed directories.9158 PyPIMIT- AlicenseNot gradedqualityDmaintenanceEnables MCP clients such as VS Code Copilot and Claude Desktop to open PDF files, read metadata and page counts, extract text from whole documents or specific page ranges, and summarize or answer questions about a document's content. It exposes these capabilities through tools and prebuilt prompts backed by PyPDF2.MIT