Skip to main content
Glama
Waicy
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元数据信息的字典
ParametersJSON Schema
NameRequiredDescriptionDefault
file_pathYes

TDQS

B3.1/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It mentions the tool returns a dictionary of PDF metadata, which is helpful, but lacks details on error handling (e.g., for invalid paths), performance characteristics, or any side effects. This is a significant gap for a tool that interacts with file systems.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is appropriately concise and well-structured, with a clear purpose statement followed by Args and Returns sections. Every sentence adds value, though it could be slightly more efficient by integrating the path requirement into the purpose statement.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's moderate complexity (file I/O operation), lack of annotations, and no output schema, the description is minimally adequate. It covers the purpose and parameter semantics but misses usage guidelines and detailed behavioral context, leaving gaps for the agent to infer.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The description adds meaningful context beyond the input schema, which has 0% coverage. It specifies that 'file_path' must be an absolute path to a PDF file, clarifying the parameter's semantics and constraints. Since there's only one parameter, this adequately compensates for the schema's lack of description.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose as '获取PDF文件的基本信息' (get basic information of PDF files), which is a specific verb+resource combination. However, it doesn't explicitly differentiate from sibling tools like 'list_pdfs_in_directory' (which lists files) or 'read_pdf_text' (which extracts content), so it falls short of a perfect score.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention the sibling tools or clarify scenarios where this tool is appropriate (e.g., for metadata extraction rather than content reading or file listing). This leaves the agent with insufficient context for tool selection.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

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

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

Returns:
    包含PDF文件列表的字典
ParametersJSON Schema
NameRequiredDescriptionDefault
directory_pathYes

TDQS

B3.1/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden of behavioral disclosure. It mentions that the directory path must be absolute, which adds some context, but it does not cover critical behaviors such as error handling (e.g., if the path is invalid), permissions needed, whether it recursively searches subdirectories, or the format of the returned dictionary. For a tool with no annotations, this leaves significant gaps in understanding its behavior.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is concise and well-structured, with a clear purpose statement followed by 'Args' and 'Returns' sections. Each sentence serves a purpose: stating the tool's function, explaining the parameter, and describing the return value. It avoids unnecessary details, making it efficient and easy to parse.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's low complexity (one parameter, no annotations, no output schema), the description is minimally adequate. It covers the basic purpose and parameter requirement but lacks details on behavior, error handling, and output structure. Without annotations or an output schema, the description should provide more context about what the returned dictionary contains and how the tool behaves in edge cases.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The description adds meaningful semantics for the single parameter 'directory_path' by specifying it must be an absolute path, which is not covered in the input schema (0% schema description coverage). This compensates well for the lack of schema details, providing essential guidance for correct usage. With only one parameter, the description effectively clarifies its purpose beyond the schema.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose: '列出指定目录下的所有PDF文件' (List all PDF files in the specified directory). It specifies the verb (list) and resource (PDF files in a directory), making the action clear. However, it does not explicitly differentiate from sibling tools like 'get_pdf_info' or 'read_pdf_text', which focus on individual PDFs rather than listing them.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. It does not mention sibling tools or contexts where listing PDFs is preferred over other operations. The only usage hint is the parameter requirement, which is insufficient for distinguishing from other tools.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

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

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

Returns:
    包含文本内容、页面信息等的字典
ParametersJSON Schema
NameRequiredDescriptionDefault
file_pathYes
page_numbersNo
extract_tablesNo

TDQS

B3.1/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden of behavioral disclosure. It mentions that 'file_path' must be an absolute path, which is useful context not in the schema. However, it lacks details on permissions needed, error handling (e.g., for invalid paths), performance considerations (e.g., large file handling), or output format specifics beyond '包含文本内容、页面信息等的字典' (dictionary containing text content, page info, etc.). For a tool with no annotations, this leaves significant gaps in understanding its behavior.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is appropriately sized and front-loaded, starting with the core purpose followed by parameter and return explanations. Each sentence adds value: the first states the tool's function, and the subsequent lines clarify inputs and outputs. There's no redundant information, making it efficient, though minor improvements in structure (e.g., bullet points) could enhance readability.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's moderate complexity (3 parameters, no annotations, no output schema), the description is minimally adequate. It covers the basic purpose and parameter meanings but lacks details on behavioral aspects (e.g., error handling, performance) and output specifics. Without an output schema, the return value description ('字典' - dictionary) is vague. It meets the baseline for a read-only tool but doesn't fully address all contextual needs.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The description adds meaningful semantics beyond the input schema, which has 0% description coverage. It explains that 'file_path' is an absolute path, 'page_numbers' extracts specific pages or all if None, and 'extract_tables' controls table data extraction. This clarifies the purpose and usage of each parameter, compensating well for the schema's lack of descriptions. However, it doesn't detail formats (e.g., array structure for page_numbers) or constraints (e.g., valid page ranges), keeping it from a perfect score.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose: '读取PDF文件并提取文本内容' (Read PDF file and extract text content). It specifies the verb ('读取并提取' - read and extract) and resource ('PDF文件' - PDF file), making the function unambiguous. However, it doesn't explicitly differentiate from sibling tools like 'get_pdf_info' or 'list_pdfs_in_directory', which likely serve different purposes (metadata retrieval vs. directory listing).

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention sibling tools or suggest scenarios where 'read_pdf_text' is preferred over 'get_pdf_info' (e.g., for full text extraction vs. metadata) or 'list_pdfs_in_directory' (e.g., for processing files vs. listing them). Usage is implied by the purpose but lacks explicit context or exclusions.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Tool Schema Changelog

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

  1. 3 tool updates
    • First observedget_pdf_info
    • First observedlist_pdfs_in_directory
    • First observedread_pdf_text

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.

Maintenance

ActivityInactive
ResponsivenessNo issues

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
    C
    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
    19 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
    5,664 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
    77
    MIT