npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@sin-gang-ya-rou-geng-hao-chih/pdf-mcp-server

v1.0.5

Published

Model Context Protocol (MCP) server for PDF processing with OCR support

Downloads

348

Readme

@sin-gang-ya-rou-geng-hao-chih/pdf-mcp-server

支援 OCR 功能的 PDF 處理 Model Context Protocol (MCP) 伺服器。此伺服器為 Cursor IDE 和其他 MCP 相容客戶端提供完整的 PDF 操作功能。

中文 | English

功能特點

  • PDF 文字提取:從 PDF 檔案中提取文字內容
  • OCR 支援:使用 Tesseract.js 對掃描的 PDF 進行文字辨識
  • 元資料提取:取得 PDF 元資料(頁數、作者、標題等)
  • 文字搜尋:在 PDF 文件中搜尋文字
  • PDF 合併:將多個 PDF 檔案合併為一個
  • PDF 拆分:將 PDF 拆分為多個檔案
  • PDF 轉圖片:將 PDF 頁面轉換為圖片(PNG、JPG、WebP)
  • 頁面提取:提取指定頁面到新 PDF
  • 多語言 OCR:支援 15+ 種語言,包括中文、日文、韓文

系統需求

  • Node.js >= 18.0.0
  • 支援的作業系統:Windows、Linux、macOS

安裝

全域安裝(推薦用於 Cursor)

npm install -g @sin-gang-ya-rou-geng-hao-chih/pdf-mcp-server

本地安裝

npm install @sin-gang-ya-rou-geng-hao-chih/pdf-mcp-server

從源碼安裝

git clone https://github.com/j0482k6j041/pdf-mcp-server.git
cd pdf-mcp-server
npm install

配置

Cursor IDE 配置

在 Cursor 的 MCP 設定檔(~/.cursor/mcp.json 或專案層級的 .cursor/mcp.json)中加入以下內容:

STDIO 模式(推薦)

{
  "mcpServers": {
    "@sin-gang-ya-rou-geng-hao-chih/pdf-mcp-server": {
      "command": "pdf-mcp-server",
      "args": [],
      "env": {}
    }
  }
}

SSE 模式(HTTP)

{
  "mcpServers": {
    "pdf-mcp-server": {
      "url": "http://localhost:3335/sse",
      "enabled": true
    }
  }
}

環境變數

在專案根目錄建立 .env 檔案:

# 傳輸模式:stdio(預設)或 sse
TRANSPORT=stdio

# HTTP 伺服器設定(用於 SSE 模式)
PORT=3335
HOST=0.0.0.0

# 日誌級別:error, warn, info, debug
LOG_LEVEL=info

# SSE 連線的 Ping 間隔(毫秒)
PING_INTERVAL=60000

可用工具

| 工具名稱 | 功能說明 | |----------|----------| | pdf_read_text | 讀取 PDF 並提取文字內容 | | pdf_ocr | 對 PDF 進行 OCR 辨識(支援掃描檔) | | pdf_metadata | 取得 PDF 元資料(頁數、作者、標題等) | | pdf_search | 在 PDF 中搜尋指定文字 | | pdf_merge | 合併多個 PDF 檔案 | | pdf_split | 拆分 PDF 為多個檔案 | | pdf_to_images | 將 PDF 頁面轉換為圖片 | | pdf_page_count | 取得 PDF 頁數 | | pdf_extract_pages | 提取指定頁面到新 PDF | | pdf_ocr_languages | 取得支援的 OCR 語言列表 |

使用範例

讀取 PDF 文字

pdf_read_text({ filePath: "C:/Documents/report.pdf" })

OCR 辨識(繁體中文)

pdf_ocr({ 
  filePath: "scanned_document.pdf", 
  language: "chi_tra",  // 繁體中文
  pages: [1, 2, 3]      // 可選:指定頁面
})

搜尋文字

pdf_search({ 
  filePath: "document.pdf", 
  searchText: "重要",
  caseSensitive: false
})

合併 PDF

pdf_merge({ 
  filePaths: ["part1.pdf", "part2.pdf", "part3.pdf"],
  outputPath: "combined.pdf"
})

拆分 PDF

// 每頁分開
pdf_split({ 
  filePath: "document.pdf",
  outputDir: "C:/Output"
})

// 按範圍拆分
pdf_split({ 
  filePath: "document.pdf",
  outputDir: "C:/Output",
  pageRanges: [[1, 5], [6, 10]]
})

轉換為圖片

pdf_to_images({ 
  filePath: "document.pdf",
  outputDir: "C:/Images",
  format: "png",
  density: 300
})

提取頁面

pdf_extract_pages({ 
  filePath: "document.pdf",
  pageNumbers: [1, 3, 5],
  outputPath: "extracted.pdf"
})

支援的 OCR 語言

| 代碼 | 語言 | |------|------| | eng | English(英文) | | chi_tra | 繁體中文 | | chi_sim | 简体中文 | | jpn | 日本語 | | kor | 한국어 | | fra | Français(法文) | | deu | Deutsch(德文) | | spa | Español(西班牙文) | | ita | Italiano(義大利文) | | por | Português(葡萄牙文) | | rus | Русский(俄文) | | ara | العربية(阿拉伯文) | | hin | हिन्दी(印地文) | | tha | ไทย(泰文) | | vie | Tiếng Việt(越南文) |

多語言 OCR

使用 + 組合多種語言:

pdf_ocr({ 
  filePath: "document.pdf", 
  language: "eng+chi_tra"  // 英文 + 繁體中文
})

執行伺服器

STDIO 模式(預設)

pdf-mcp-server

SSE 模式

TRANSPORT=sse pdf-mcp-server

或在 Windows 上:

$env:TRANSPORT="sse"; pdf-mcp-server

開發

測試

npm test

啟動開發伺服器

npm start

依賴套件

  • @modelcontextprotocol/sdk:MCP SDK 伺服器實作
  • pdf-parse:PDF 文字提取
  • pdf-lib:PDF 操作(合併、拆分、提取)
  • tesseract.js:OCR 引擎
  • sharp:圖片處理
  • pdf2pic:PDF 轉圖片

授權

ISC License - 詳見 LICENSE 檔案

相關連結

聯絡資訊

如有問題或建議,請:

  • 提交 Issue
  • 或聯絡開發團隊

English

Features

  • PDF Text Extraction: Extract text content from PDF files
  • OCR Support: Recognize text from scanned PDFs using Tesseract.js
  • Metadata Extraction: Get PDF metadata (pages, author, title, etc.)
  • Text Search: Search for text within PDF documents
  • PDF Merge: Combine multiple PDF files into one
  • PDF Split: Split PDF into multiple files
  • PDF to Images: Convert PDF pages to images (PNG, JPG, WebP)
  • Page Extraction: Extract specific pages to a new PDF
  • Multi-language OCR: Support for 15+ languages including Chinese, Japanese, Korean

System Requirements

  • Node.js >= 18.0.0
  • Supported OS: Windows, Linux, macOS

Installation

Global Installation (Recommended for Cursor)

npm install -g @sin-gang-ya-rou-geng-hao-chih/pdf-mcp-server

Local Installation

npm install @sin-gang-ya-rou-geng-hao-chih/pdf-mcp-server

Configuration

Cursor IDE Configuration

Add the following to your Cursor MCP settings (~/.cursor/mcp.json or project-level .cursor/mcp.json):

STDIO Mode (Recommended)

{
  "mcpServers": {
    "@sin-gang-ya-rou-geng-hao-chih/pdf-mcp-server": {
      "command": "pdf-mcp-server",
      "args": [],
      "env": {}
    }
  }
}

SSE Mode (HTTP)

{
  "mcpServers": {
    "pdf-mcp-server": {
      "url": "http://localhost:3335/sse",
      "enabled": true
    }
  }
}

Available Tools

| Tool | Description | |------|-------------| | pdf_read_text | Extract text content from PDF | | pdf_ocr | Perform OCR on PDF (supports scanned documents) | | pdf_metadata | Get PDF metadata (pages, author, title, etc.) | | pdf_search | Search for text in PDF | | pdf_merge | Merge multiple PDF files | | pdf_split | Split PDF into multiple files | | pdf_to_images | Convert PDF pages to images | | pdf_page_count | Get PDF page count | | pdf_extract_pages | Extract specific pages to new PDF | | pdf_ocr_languages | Get supported OCR languages |

Usage Examples

Read PDF Text

pdf_read_text({ filePath: "C:/Documents/report.pdf" })

OCR with Chinese

pdf_ocr({ 
  filePath: "scanned_document.pdf", 
  language: "chi_tra",  // Traditional Chinese
  pages: [1, 2, 3]      // Optional: specific pages
})

Search Text

pdf_search({ 
  filePath: "document.pdf", 
  searchText: "important",
  caseSensitive: false
})

Merge PDFs

pdf_merge({ 
  filePaths: ["part1.pdf", "part2.pdf", "part3.pdf"],
  outputPath: "combined.pdf"
})

Split PDF

// Split into single pages
pdf_split({ 
  filePath: "document.pdf",
  outputDir: "C:/Output"
})

// Split by page ranges
pdf_split({ 
  filePath: "document.pdf",
  outputDir: "C:/Output",
  pageRanges: [[1, 5], [6, 10]]
})

Convert to Images

pdf_to_images({ 
  filePath: "document.pdf",
  outputDir: "C:/Images",
  format: "png",
  density: 300
})

Extract Pages

pdf_extract_pages({ 
  filePath: "document.pdf",
  pageNumbers: [1, 3, 5],
  outputPath: "extracted.pdf"
})

Supported OCR Languages

| Code | Language | |------|----------| | eng | English | | chi_tra | Chinese Traditional (繁體中文) | | chi_sim | Chinese Simplified (简体中文) | | jpn | Japanese (日本語) | | kor | Korean (한국어) | | fra | French (Français) | | deu | German (Deutsch) | | spa | Spanish (Español) | | ita | Italian (Italiano) | | por | Portuguese (Português) | | rus | Russian (Русский) | | ara | Arabic (العربية) | | hin | Hindi (हिन्दी) | | tha | Thai (ไทย) | | vie | Vietnamese (Tiếng Việt) |

Multi-language OCR

Combine languages with +:

pdf_ocr({ 
  filePath: "document.pdf", 
  language: "eng+chi_tra"  // English + Traditional Chinese
})

Running the Server

STDIO Mode (Default)

pdf-mcp-server

SSE Mode

TRANSPORT=sse pdf-mcp-server

Or on Windows:

$env:TRANSPORT="sse"; pdf-mcp-server

Development

Clone and Install

git clone https://github.com/j0482k6j041/pdf-mcp-server.git
cd pdf-mcp-server
npm install

Run in Development

npm start

Run Tests

npm test

Dependencies

  • @modelcontextprotocol/sdk: MCP SDK for server implementation
  • pdf-parse: PDF text extraction
  • pdf-lib: PDF manipulation (merge, split, extract)
  • tesseract.js: OCR engine
  • sharp: Image processing
  • pdf2pic: PDF to image conversion

License

ISC License - See LICENSE file

Repository

https://github.com/j0482k6j041/pdf-mcp-server

Issues

https://github.com/j0482k6j041/pdf-mcp-server/issues