pdf-navigator-mcp

pdf-navigator-mcp

Provides PDF reading, text search, navigation, and form filling capabilities through MCP, with cross-platform PDF viewer integration for seamless document interaction.

Category
访问服务器

README

PDF Navigator MCP

A comprehensive Model Context Protocol (MCP) server for PDF reading, navigation, and text search with cross-platform PDF viewer integration. Eliminates PyMuPDF dependency issues by providing PDF functionality through MCP.

Features

  • PDF text extraction - Read full PDFs or specific pages/ranges
  • PDF structure analysis - Extract table of contents and page summaries
  • Text search with location - Find text and jump to results
  • Direct PDF navigation - Open PDFs to specific pages
  • PDF form filling - Extract form fields to markdown, edit, and fill PDFs
  • Cross-platform PDF viewers - Supports Skim, Zathura, Evince, and more
  • MCP integration - Works with Claude Code and other MCP clients
  • No dependency issues - PyMuPDF isolated in MCP server environment

Installation

# Install with pipx (recommended)
pipx install git+https://github.com/matsengrp/pdf-navigator-mcp.git

# Or install in current environment
pip install git+https://github.com/matsengrp/pdf-navigator-mcp.git

Claude Code Integration

Add to your ~/.claude.json:

{
  "mcpServers": {
    "pdf-navigator": {
      "type": "stdio",
      "command": "pdf-navigator-mcp"
    }
  }
}

Usage

In Claude Code, you can:

  • "Read the abstract from paper.pdf" → Extracts and shows text content
  • "What's the table of contents for paper.pdf?" → Shows PDF structure
  • "Read pages 5-10 of paper.pdf" → Extracts specific page range
  • "Search for 'parameter efficiency' in paper.pdf" → Finds text and locations
  • "Open paper.pdf to page 5" → Opens PDF viewer to specific page
  • "Extract form fields from application.pdf" → Creates markdown file with form fields
  • "Fill the PDF form with my data" → Fills PDF using edited markdown data

MCP Tools

Reading Tools

  • read_pdf_text(file_path, start_page, end_page) - Extract text from page range
  • read_pdf_page(file_path, page_number) - Extract text from single page
  • get_pdf_structure(file_path) - Get table of contents and page summaries
  • get_pdf_info(file_path) - Get document metadata

Navigation Tools

  • search_pdf_text(file_path, query) - Search text and return locations
  • open_pdf_page(file_path, page_number) - Open PDF viewer to specific page
  • search_and_open(file_path, query, result_index) - Search and open to result

Form Filling Tools

  • extract_form_to_markdown(file_path, output_md_path) - Extract form fields to markdown with multi-line detection
  • fill_form_from_markdown(pdf_path, markdown_path, output_pdf_path, distribute_text=True, max_chars_per_field=50, respect_line_breaks=True) - Fill PDF from markdown with intelligent text distribution

PDF Form Filling Workflow

The PDF form filling feature uses a markdown-based workflow:

  1. Extract form fields - Analyze the PDF and create a markdown file with all detected fields
  2. Edit the markdown - Fill in values using any text editor
  3. Fill the PDF - Apply the markdown data back to create a filled PDF

Example Workflow

# Step 1: Extract form fields to markdown
# Creates a markdown file with placeholders for each field
extract_form_to_markdown("application.pdf", "application_form.md")

# Step 2: Edit application_form.md in your editor
# Fill in values after each arrow (→)

# Step 3: Fill the PDF with your data
fill_form_from_markdown("application.pdf", "application_form.md", "application_filled.pdf")

Markdown Format

The extracted markdown looks like:

# PDF Form: application.pdf
Type: Interactive Form
Generated: 2025-08-03

## Form Fields

### Page 1
- Full Name → John Smith
- Email → john@example.com
- Phone → 555-0123
- [ ] Subscribe to newsletter → true

Form Types Supported

  • Interactive Forms - PDFs with actual form fields (fillable PDFs)
  • Static Forms - PDFs with underlines/boxes (creates moveable text annotations)

Enhanced Multi-line Form Detection

The PDF Navigator now includes advanced multi-line form detection and intelligent text distribution:

Features

  • Multi-line Section Detection - Automatically detects when multiple consecutive blank lines follow a section header (e.g., "I love..." followed by several underscores)
  • Smart Text Distribution - Distributes long text across multiple related fields using natural break points
  • Natural Break Points - Respects sentences, commas, conjunctions, and explicit line breaks
  • Configurable Parameters - Control text distribution behavior

Text Distribution Strategies

  1. Sentence splitting - "I love reading. Playing games is fun." → separate fields
  2. Comma/semicolon splitting - "Reading books, playing games, going to parks" → separate fields
  3. Conjunction splitting - "Reading and playing and going" → separate fields
  4. Word boundary splitting - Intelligent length-based splitting while preserving whole words

Configuration Options

  • distribute_text: bool - Enable/disable multi-line text distribution (default: True)
  • max_chars_per_field: int - Target character limit per field (default: 50)
  • respect_line_breaks: bool - Honor newlines in input text (default: True)

Example

Instead of cramming "Reading books with my parents, doing puzzles and addition, going on trips, anything with my big sister" into one tiny field, it automatically distributes as:

  • Field 1: "Reading books with my parents"
  • Field 2: "doing puzzles and addition"
  • Field 3: "going on trips"
  • Field 4: "anything with my big sister"

Form Filling Best Practices

For optimal text distribution in multi-line fields:

- personal_interests_love_1 (I love...) → Reading books with my parents
Doing puzzles and addition
Going on trips
Anything with my big sister

The newlines enable intelligent distribution across multiple PDF fields, preventing cramped text. Use the extract_and_fill_form and format_multiline_form_data MCP prompts for guided workflows.

Supported PDF Readers

  • Skim (macOS) - skim:// URL scheme
  • Zathura (Linux) - --page argument
  • Evince (Linux) - --page-index argument
  • SumatraPDF (Windows) - -page argument
  • Adobe Acrobat (Cross-platform) - /A page=N argument

Configuration

Configure your PDF reader in ~/.pdf-navigator-config.json:

{
  "pdf_reader": "skim",
  "reader_path": "/Applications/Skim.app"
}

Development

git clone https://github.com/matsengrp/pdf-navigator-mcp.git
cd pdf-navigator-mcp
pip install -e ".[dev]"

License

MIT License

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选