PDF Reader MCP Server
Enables reading, searching, and metadata extraction from PDF files without loading the entire content into the context window. It provides efficient tools for text cleaning, page-specific extraction, and context-aware search results.
README
PDF Reader MCP Server
A Model Context Protocol (MCP) server that provides efficient PDF text extraction capabilities for Claude Code. This server allows you to read, search, and extract metadata from PDF files without loading the entire content into Claude's context window.
npm package: @fabriqa.ai/pdf-reader-mcp Author: Cengiz Han Blog Post: How I Built This Tool to Save My Context
Features
- Read PDF Files: Extract full text content from PDF files with optional text cleaning
- Search PDFs: Search for specific text within PDFs with context-aware results
- Extract Metadata: Get detailed metadata including title, author, page count, dates, etc.
- Efficient Context Usage: Process large PDFs without consuming excessive Claude Code context
- Flexible Options: Support for page ranges, case-sensitive search, and more
Installation
Option A: Install from npm (Recommended)
npm install -g @fabriqa.ai/pdf-reader-mcp
After installation, the server will be available globally. You can configure it by running:
# The package will be installed in your global node_modules
# Typically: /usr/local/lib/node_modules/@fabriqa.ai/pdf-reader-mcp
Option B: Install from source
- Clone this repository:
git clone https://github.com/hancengiz/read_pdf_as_text_mcp.git
cd read_pdf_as_text_mcp
- Install dependencies:
npm install
Configuration
If installed via npm (Recommended):
Option 1: Using Claude Code CLI (Easiest)
# Add the MCP server
claude mcp add pdf-reader npx @fabriqa.ai/pdf-reader-mcp@latest
# Or use the convenience script
npx @fabriqa.ai/pdf-reader-mcp/update-config.js
Option 2: Manual Configuration
Add to your ~/.claude.json:
{
"mcpServers": {
"pdf-reader": {
"command": "npx",
"args": [
"@fabriqa.ai/pdf-reader-mcp@latest"
]
}
}
}
This uses npx to automatically run the globally installed package without needing to specify paths.
Quick Setup Script (Optional):
After installing via npm, you can use the included configuration script to automatically update your ~/.claude.json:
npx @fabriqa.ai/pdf-reader-mcp/update-config.js
Or if installed from source:
node update-config.js
This will automatically add the MCP server using npx, making it available machine-wide across all your projects.
Manual Configuration:
For Claude Desktop, edit ~/Library/Application Support/Claude/claude_desktop_config.json (macOS) or %APPDATA%\Claude\claude_desktop_config.json (Windows):
{
"mcpServers": {
"pdf-reader": {
"command": "npx",
"args": [
"@fabriqa.ai/pdf-reader-mcp@latest"
]
}
}
}
Usage
Once configured, restart Claude Code. The following tools will be available:
1. read-pdf
Extract text content from a PDF file.
Parameters:
file(required): Path to the PDF filepages(optional): Page range (e.g., '1-5', '1,3,5', 'all'). Default: 'all'clean_text(optional): Clean and normalize extracted text. Default: falseinclude_metadata(optional): Include PDF metadata in output. Default: true
Example:
Can you read the PDF at /path/to/document.pdf?
2. search-pdf
Search for specific text within a PDF file.
Parameters:
file(required): Path to the PDF filequery(required): Text to search forcase_sensitive(optional): Case sensitive search. Default: falsewhole_word(optional): Match whole words only. Default: false
Example:
Search for "machine learning" in /path/to/document.pdf
3. pdf-metadata
Extract metadata from a PDF file.
Parameters:
file(required): Path to the PDF file
Example:
Get metadata from /path/to/document.pdf
Example Workflow
Here's how you might use this MCP server with Claude Code:
-
Extract metadata first to understand the document:
What's the metadata for ~/Documents/research-paper.pdf? -
Search for specific topics without reading the entire file:
Search for "neural networks" in ~/Documents/research-paper.pdf -
Read specific sections when you know what you're looking for:
Read pages 10-15 from ~/Documents/research-paper.pdf with cleaned text
Benefits
- Context Efficiency: Process large PDF files without loading everything into Claude's context
- Faster Analysis: Search and extract only what you need
- Better Performance: Reduce token usage when working with multiple or large PDFs
- Flexible Extraction: Choose what information to extract and how to format it
Technical Details
- Built with the @modelcontextprotocol/sdk
- Uses pdf-parse for PDF text extraction
- Runs as a local Node.js process communicating via stdio
- Supports all PDF versions that pdf-parse can handle
Troubleshooting
Server not appearing in Claude Code
- Verify the path in your configuration file is correct
- Ensure Node.js is installed and in your PATH
- Check that dependencies are installed:
npm install - Restart Claude Code completely
- Check Claude Code logs for any error messages
PDF not found errors
- Use absolute paths to PDF files
- Verify file permissions
- Ensure the PDF file exists at the specified location
Text extraction issues
- Some PDFs (scanned images) may not contain extractable text
- Try enabling
clean_textoption for better formatting - Complex layouts may affect text extraction quality
Development
To modify or extend the server:
- Edit
index.jsto add new tools or modify existing ones - Update the
ListToolsRequestSchemahandler to register new tools - Add corresponding handlers in the
CallToolRequestSchemahandler - Restart the server (restart Claude Code) to test changes
License
MIT
Author
Created by Cengiz Han
Contributing
Feel free to submit issues or pull requests to improve this MCP server.
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。