MCP PDF Forms
MCP PDF 表单
使用MCP和 PyMuPDF 构建的 PDF 表单操作工具包。
特征
跨多个目录查找 PDF 文件
从 PDF 文件中提取表单字段信息
PDF 文档中的表单字段可视化
Related MCP server: PDF MCP Server
安装
# Install package from PyPI
pip install mcp_pdf_forms
# Or install from source
git clone https://github.com/Wildebeest/mcp_pdf_forms.git
cd mcp_pdf_forms
pip install -e .服务器
服务器组件通过 MCP 的 API 提供 PDF 相关工具:
# Start the server with one or more directories to scan for PDFs
uv run -m mcp_pdf_forms.server examples或者添加到 claude-code:
claude mcp add pdf-forms uv run -- --with mcp-pdf-forms -m mcp_pdf_forms.server .用法
安装完成后,您可以使用该软件包处理 PDF 表单。该软件包通过 MCP 界面提供相关工具。
PDF 发现工具
PDF 发现工具可帮助您在指定目录中查找 PDF 文件。
输入:搜索 PDF 的目录路径
输出:在指定目录中找到的 PDF 文件列表
用途:使用此功能快速找到项目或指定文件夹中的所有 PDF 文件
表单字段提取工具
表单字段提取工具提取有关 PDF 文档中所有表单字段的信息。
输入:PDF 文件的路径
输出:每个表单字段的详细信息,包括字段名称、类型、位置和其他属性
用途:使用它来分析表单结构并了解可供填写的字段
字段突出显示可视化工具
字段突出显示工具在 PDF 中创建表单字段的可视化表示。
输入:PDF 文件的路径
输出:修改后的 PDF,所有表单字段均突出显示,以便于识别
用途:使用它来直观地检查文档中表单字段的布局和位置
使用的库
执照
麻省理工学院
Available Tools
6 toolsextract_form_fieldsC
Extract all form fields from a PDF
Args:
pdf_path: Path to the PDF file
Returns:
Dictionary of form field names and their properties
| Name | Required | Description | Default |
|---|---|---|---|
| pdf_path | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations provided, the description carries full burden for behavioral disclosure. It states what the tool does but doesn't describe important behaviors: whether it works with encrypted PDFs, what happens with malformed PDFs, if there are size limitations, what 'properties' are included in the return dictionary, or error conditions. The description is minimal and lacks operational context.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is perfectly concise and well-structured: a clear purpose statement followed by Args and Returns sections. Every sentence earns its place - the purpose is front-loaded, and the parameter/return information is efficiently presented without redundancy. No wasted words.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given no annotations, no output schema, and 0% schema description coverage, the description is incomplete. It doesn't explain what 'properties' are included in the return dictionary, how nested form fields are handled, what happens with empty forms, or error scenarios. For a tool that extracts structured data from PDFs, more context about the output format and limitations is needed.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 0%, so the description must compensate. It adds the meaning of 'pdf_path' as 'Path to the PDF file', which provides basic semantics beyond the schema's title 'Pdf Path'. However, it doesn't elaborate on path format (absolute/relative), supported file systems, or expected PDF characteristics. With only one parameter, this is adequate but not comprehensive.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
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 'Extract all form fields from a PDF' - a specific verb ('extract') and resource ('form fields from a PDF'). It distinguishes from sibling tools like 'extract_text' (extracts text content) and 'highlight_form_field' (highlights specific fields). However, it doesn't explicitly contrast with 'list_pdfs' or 'render_pdf_page', keeping it from a perfect 5.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
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 when to choose 'extract_form_fields' over 'extract_text' for form-specific extraction, or when to use 'highlight_form_field' for individual field operations. There's no context about prerequisites or typical use cases.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
extract_textA
Extract text from PDF pages
Args:
pdf_path: Path to the PDF file
start_page: Page number to start extraction (0-indexed). If None, starts from first page.
end_page: Page number to end extraction (0-indexed, inclusive). If None, ends at start_page if specified, otherwise extracts all pages.
Returns:
If extracting a single page: string containing the page text
If extracting multiple pages: dictionary mapping page numbers to page text
| Name | Required | Description | Default |
|---|---|---|---|
| pdf_path | Yes | ||
| start_page | No | ||
| end_page | No |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations provided, the description carries full burden and does well by detailing the return behavior (single page vs. multiple pages output format). It clarifies the 0-indexed page numbering and default behaviors for start_page and end_page, adding valuable context beyond basic functionality.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is front-loaded with the core purpose, followed by well-structured sections for Args and Returns. Each sentence adds essential information without redundancy, 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.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
For a tool with no annotations and no output schema, the description is quite complete, covering purpose, parameters, and return values. However, it lacks details on potential errors (e.g., invalid file paths, unsupported PDF formats) or performance considerations, leaving minor gaps in full contextual understanding.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 0%, so the description must compensate fully. It provides detailed semantics for all three parameters: pdf_path as the file path, start_page and end_page with 0-indexing, defaults, and inclusive/exclusive logic, effectively documenting what the schema lacks.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the verb 'extract' and resource 'text from PDF pages', making the purpose specific and unambiguous. It distinguishes from siblings like extract_form_fields (which extracts form data) and search_text (which searches within text), establishing clear differentiation.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description implies usage for text extraction from PDFs, with parameters defining page ranges. However, it does not explicitly state when to use this tool versus alternatives like extract_form_fields for form data or render_pdf_page for visual rendering, leaving some ambiguity in sibling tool selection.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
highlight_form_fieldA
Generate an image with the specified form field highlighted with a red box
Args:
pdf_path: Path to the PDF file
field_name: Name of the form field to highlight
Returns:
Image of the page with the field highlighted
| Name | Required | Description | Default |
|---|---|---|---|
| pdf_path | Yes | ||
| field_name | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations are provided, so the description carries the full burden. It mentions the action (generate image with red box highlight) but lacks details on behavioral traits such as error handling (e.g., if the field doesn't exist), performance (e.g., processing time), or side effects (e.g., whether the original PDF is modified). The description is minimal and does not compensate for the absence of annotations.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is appropriately sized and front-loaded: the first sentence states the core purpose clearly, followed by brief, structured sections for Args and Returns. Every sentence earns its place with no redundant information, 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.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the complexity (a tool with 2 parameters, no annotations, and no output schema), the description is adequate but has gaps. It covers the basic purpose and parameters but lacks behavioral context (e.g., error cases, output format details like image type). Without an output schema, it should ideally explain more about the return value, but it only states 'Image of the page with the field highlighted', which is minimal.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 0%, so the description must compensate. It adds meaning by explaining that pdf_path is the 'Path to the PDF file' and field_name is the 'Name of the form field to highlight', which clarifies the purpose beyond the schema's basic titles. However, it does not provide format details (e.g., file path conventions, field name syntax), keeping it from a perfect score.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the specific action ('Generate an image with the specified form field highlighted with a red box'), identifies the resource (form field in a PDF), and distinguishes from siblings like extract_form_fields (which extracts data) or render_pdf_page (which renders without highlighting). It uses precise verbs and specifies the visual outcome.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description implies usage when highlighting a specific form field is needed, but does not explicitly state when to use this tool versus alternatives like render_pdf_page (for general rendering) or extract_form_fields (for data extraction). No exclusions or prerequisites are mentioned, leaving usage context somewhat inferred rather than clearly defined.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
list_pdfsB
List PDF files in configured base paths
Args:
path_filter: Optional string to filter PDF paths
Returns:
List of PDF paths matching the filter
| Name | Required | Description | Default |
|---|---|---|---|
| path_filter | No |
TDQS
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 'configured base paths' which hints at setup requirements, but doesn't describe what happens if no paths are configured, whether the operation is read-only (implied by 'List'), error conditions, or return format details beyond 'List of PDF paths'. For a tool with zero annotation coverage, this leaves significant behavioral gaps.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is extremely concise and well-structured: a clear purpose statement followed by dedicated 'Args' and 'Returns' sections. Every sentence earns its place, with no redundant information. The formatting enhances readability for an AI agent.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
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 optional parameter, no output schema, no annotations), the description is minimally adequate. It covers the basic purpose, parameter meaning, and return type. However, it lacks important context like error handling, what 'configured base paths' means, or whether the list is paginated/limited. For a simple list operation, this is borderline complete.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The description adds meaningful context for the single parameter: 'Optional string to filter PDF paths' explains what 'path_filter' does beyond the schema's title 'Path Filter'. With 0% schema description coverage, this compensates well by clarifying the parameter's purpose and optionality. However, it doesn't specify filter syntax or examples.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the tool's purpose: 'List PDF files in configured base paths' - a specific verb ('List') and resource ('PDF files') with scope ('in configured base paths'). It distinguishes from siblings like 'extract_text' or 'render_pdf_page' by focusing on listing rather than content extraction or rendering. However, it doesn't explicitly differentiate from potential sibling list operations (though none exist in this server).
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
No guidance is provided on when to use this tool versus alternatives. The description doesn't mention prerequisites (e.g., needing configured base paths), when this tool is appropriate versus other PDF operations, or any limitations. The agent must infer usage from the purpose alone.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
render_pdf_pageB
Generate an image of a PDF page without any highlighting
Args:
pdf_path: Path to the PDF file
page_num: Page number to render (0-indexed)
zoom: Zoom factor for rendering (higher values for better quality)
Returns:
Image of the specified page
| Name | Required | Description | Default |
|---|---|---|---|
| pdf_path | Yes | ||
| page_num | No | ||
| zoom | No |
TDQS
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 tool generates an image without highlighting, which is useful, but it doesn't cover other important aspects such as performance characteristics (e.g., processing time, memory usage), error handling (e.g., what happens if the PDF path is invalid or page_num is out of range), or output format details (e.g., image type, size). This leaves gaps in understanding how the tool behaves beyond its basic function.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is well-structured and concise, with a clear purpose statement followed by 'Args:' and 'Returns:' sections that efficiently list parameters and output. Every sentence earns its place by providing essential information without redundancy, making it easy to scan and understand quickly.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
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 partially complete. It covers the purpose and parameters well, but it lacks details on behavioral aspects like error handling or performance, and without an output schema, it doesn't fully explain the return value (e.g., image format or encoding). This makes it adequate but with clear gaps for effective tool invocation.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The schema description coverage is 0%, so the description must compensate. It provides clear semantics for all three parameters: 'pdf_path' as the path to the PDF file, 'page_num' as the 0-indexed page number to render, and 'zoom' as a factor for rendering quality. This adds meaningful context beyond the schema's basic titles and types, effectively documenting the parameters despite the low schema coverage.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the tool's purpose: 'Generate an image of a PDF page without any highlighting.' It specifies the verb ('generate'), resource ('image of a PDF page'), and a key constraint ('without any highlighting'), which distinguishes it from sibling tools like 'highlight_form_field'. However, it doesn't explicitly differentiate from other rendering or extraction tools beyond the highlighting aspect.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description implies usage by specifying what the tool does (generate an image without highlighting), which suggests it should be used when a visual representation of a PDF page is needed without annotations. However, it lacks explicit guidance on when to use this tool versus alternatives like 'extract_text' for text content or 'list_pdfs' for file listings, and it doesn't mention any prerequisites or exclusions.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
search_textA
Search for text pattern in a PDF file
Args:
pdf_path: Path to the PDF file
pattern: Regular expression pattern to search for
case_sensitive: Whether to perform case-sensitive matching
start_page: Page number to start search (0-indexed). If None, starts from first page.
end_page: Page number to end search (0-indexed, inclusive). If None, searches all pages.
Returns:
List of matches with page number, match text, and context
| Name | Required | Description | Default |
|---|---|---|---|
| pdf_path | Yes | ||
| pattern | Yes | ||
| case_sensitive | No | ||
| start_page | No | ||
| end_page | No |
TDQS
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 effectively describes key behaviors: it searches using regular expressions, supports case sensitivity, allows page range specification, and returns matches with context. However, it lacks details on error handling, performance limits, or file size constraints.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is well-structured with a clear purpose statement followed by parameter and return sections. Every sentence adds value, though it could be slightly more concise by integrating the return explanation into the purpose statement. No wasted text is present.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the tool's moderate complexity (5 parameters, no annotations, no output schema), the description is largely complete. It covers purpose, parameters, and returns adequately. However, it lacks output format details (e.g., structure of 'List of matches') and error scenarios, leaving minor gaps for an AI agent.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 0%, so the description must compensate. It adds significant meaning beyond the schema by explaining each parameter's purpose, defaults, and behavior (e.g., '0-indexed', 'If None, searches all pages'), which is crucial for correct usage. This fully compensates for the lack of schema descriptions.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the tool's purpose with a specific verb ('Search') and resource ('text pattern in a PDF file'), distinguishing it from siblings like extract_text (extracts all text) or list_pdfs (lists files). It precisely defines what the tool does without being vague or tautological.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description implies usage through parameter explanations (e.g., 'If None, starts from first page'), but it does not explicitly state when to use this tool versus alternatives like extract_text for full text extraction or highlight_form_field for form interactions. No explicit exclusions or named alternatives are provided.
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.
6 tool updates
- First observed
extract_form_fields - First observed
extract_text - First observed
highlight_form_field - First observed
list_pdfs - First observed
render_pdf_page - First observed
search_text
TDQS
Scored across 6 tools
Each tool has a clearly distinct purpose with no ambiguity. extract_form_fields handles form-specific metadata, extract_text retrieves raw text, highlight_form_field visually marks form fields, list_pdfs enumerates files, render_pdf_page generates page images, and search_text performs pattern matching. The descriptions reinforce these unique roles, making tool selection straightforward.
All tools follow a consistent verb_noun pattern with snake_case, such as extract_form_fields, highlight_form_field, and render_pdf_page. The naming is predictable and readable throughout, with no deviations or mixed conventions, enhancing clarity and usability.
With 6 tools, the server is well-scoped for PDF form and content processing. Each tool earns its place by covering distinct aspects like extraction, rendering, listing, and searching, without being overly sparse or bloated. This count aligns well with the domain's typical operations.
The tool set provides strong coverage for PDF form and text operations, including extraction, rendering, listing, and searching. A minor gap exists in form field modification (e.g., fill_form or update_form_field), but agents can work around this by using other tools or external methods. Core workflows are well-supported.
Maintenance
Related MCP Connectors
MCP server for detecting and redacting PII (Personally Identifiable Information) in PDF documents.
MCP server for the PDFGate API. Generate PDFs, manage documents and handle e-signatures.
MCP server for managing FormDesigner forms, fields, logic rules, themes, and entries
MCP server for Api2Pdf — generate PDFs & images from HTML, URLs or office files; merge, barcodes.
Related MCP Servers
- FlicenseNot gradedqualityDmaintenanceAn MCP server that provides comprehensive PDF processing capabilities including text extraction, image extraction, table detection, annotation extraction, metadata retrieval, page rendering, and document structure analysis.-
- AlicenseNot gradedqualityBmaintenanceAn MCP server for PDF form filling, basic editing, and OCR text extraction. It enables users to merge, rotate, annotate, and sign PDFs, while also supporting text extraction from both searchable and scanned image-based documents.5Apache 2.0
- AlicenseNot gradedqualityDmaintenanceAn MCP server that provides tools for reading, writing, and manipulating PDF files, including text extraction, metadata retrieval, and merging or splitting documents. It also enables users to create PDFs from plain text and convert specific pages or entire documents into images.89 npmISC
- AlicenseAqualityDmaintenanceAn MCP server for local PDF manipulation including merging, splitting, rotating, watermarking, and text extraction. It works with various MCP-compatible clients and processes PDFs entirely on-device without cloud services.116 npmMIT