Skip to main content
Glama
Custom PDF MCP Server
by Waicy

Custom PDF MCP Server

基于 FastMCP 构建的自定义 PDF 处理服务器,专为毕业论文文献处理设计。

功能特性

  • 读取PDF文本: 支持提取整个PDF或指定页面的文本内容

  • 提取表格数据: 可选择提取PDF中的表格结构

  • 获取PDF信息: 提取PDF的元数据信息(作者、标题等)

  • 列出PDF文件: 扫描目录下所有PDF文件

  • 安全限制: 只能访问当前工作目录下的文件

Related MCP server: MCP PDF Reader

安装方法

方法一:使用 uv(推荐)

# 克隆项目
git clone https://github.com/Waicy/-pdf-mcp-.git
cd pdf-mcp

# 创建虚拟环境并安装依赖
uv sync

方法二:使用 pip

# 克隆项目
git clone https://github.com/yourusername/pdf-mcp.git
cd pdf-mcp

# 安装依赖
pip install . --index-url https://pypi.tuna.tsinghua.edu.cn/simple

使用方法

1. 直接运行测试

# 如果使用 uv
uv run pdf-mcp

# 如果使用传统方式
python src/pdf_mcp_server.py

2. 配置 Claude Desktop

在 claude_desktop_config.json 中添加以下配置:

{
  "mcpServers": {
    "pdf-reader-custom": {
      "command": "uv",
      "args": [
         "--directory",
         "path/to/your/pdf-mcp",
         "run",
         "pdf-mcp"
      ]
    }
  }
}

注意:

  • 将 path/to/your/pdf-mcp 替换为实际的项目路径

可用工具

read_pdf_text

读取PDF文件并提取文本内容

参数:

  • file_path: PDF文件路径(相对于工作目录)

  • page_numbers: 可选,要提取的页面号列表

  • extract_tables: 可选,是否提取表格数据

get_pdf_info

获取PDF文件的基本信息和元数据

参数:

  • file_path: PDF文件路径

list_pdfs_in_directory

列出指定目录下的所有PDF文件

参数:

  • directory_path: 目录路径,默认为当前目录

使用示例

  1. 读取整个PDF:

    read_pdf_text("文献整理/某篇论文.pdf")
  2. 只读取特定页面:

    read_pdf_text("文献整理/某篇论文.pdf", [1, 2, 3])
  3. 提取表格数据:

    read_pdf_text("文献整理/某篇论文.pdf", extract_tables=True)
  4. 获取PDF信息:

    get_pdf_info("文献整理/某篇论文.pdf")
  5. 列出所有PDF:

    list_pdfs_in_directory("文献整理")

Available Tools

3 tools
get_pdf_infoB
获取PDF文件的基本信息

Args:
    file_path: PDF文件绝对路径(必须是绝对路径)

Returns:
    包含PDF元数据信息的字典

Inputs: file_path (required).

list_pdfs_in_directoryB
列出指定目录下的所有PDF文件

Args:
    directory_path: 目录绝对路径(必须是绝对路径)

Returns:
    包含PDF文件列表的字典

Inputs: directory_path (required).

read_pdf_textB
读取PDF文件并提取文本内容

Args:
    file_path: PDF文件绝对路径(必须是绝对路径)
    page_numbers: 要提取的页面号列表,如果为None则提取所有页面
    extract_tables: 是否提取表格数据

Returns:
    包含文本内容、页面信息等的字典

Inputs: file_path (required), page_numbers, extract_tables.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A3.5/5.0

    Scored across 3 tools

    Disambiguation5/5

    Each tool has a clearly distinct purpose: get_pdf_info retrieves metadata, list_pdfs_in_directory enumerates files, and read_pdf_text extracts content. There is no overlap in functionality, making tool selection unambiguous for an agent.

    Naming Consistency5/5

    All tool names follow a consistent verb_noun pattern with snake_case: get_pdf_info, list_pdfs_in_directory, and read_pdf_text. The naming is predictable and readable throughout the set.

    Tool Count4/5

    With 3 tools, the server is well-scoped for basic PDF operations, but it feels slightly thin as it lacks tools for creating, editing, or deleting PDFs. However, the tools provided are essential and earn their place.

    Completeness3/5

    The server covers core read-only operations (info, listing, text extraction) but has notable gaps in the PDF lifecycle, such as creation, modification, merging, or deletion. Agents can work around this for basic tasks, but advanced workflows may be limited.

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      B
      quality
      D
      maintenance
      A server that provides tools for reading and processing PDF documents, allowing users to list available PDFs and extract their content in Markdown format.
      2
      5
      MIT
    • A
      license
      A
      quality
      D
      maintenance
      A Model Context Protocol server that enables the extraction of text, metadata, and embedded images from PDF files. It provides tools for searching text with context, reading specific pages, and counting total pages within a document.
      7
      22 npm
      1
      MIT
    • A
      license
      A
      quality
      D
      maintenance
      A comprehensive tool server for reading, merging, and extracting content from PDF files via local paths or direct URLs. It enables metadata retrieval, regex searching, and page-specific text extraction with built-in caching and workspace-restricted security.
      9
      7,136 PyPI
      MIT
    • A
      license
      A
      quality
      C
      maintenance
      An MCP server for reading, rendering, and searching PDF files, specifically optimized for LLMs to extract text, tables, and technical diagrams. It enables metadata retrieval, multi-format text extraction, and page-to-image rendering using PyMuPDF.
      5
      83
      MIT