Token导航 LogoToken导航TokenDH.com
Pdf Spec MCP logo
文档知识未说明官方级别未说明来源级核验

Pdf Spec MCP

MCP Server

一个基于MCP协议的PDF规范解析服务器,提供结构化访问ISO 32000(PDF)规范文档的能力,支持导航、搜索和分析PDF规范。

工具数

8

提示词数

0

GitHub Stars

1

资源数

0
TypeScriptClaude结构化数据ClaudeCursor

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

作者 / 组织

shuji-bonji

提供方

shuji-bonji

最后核验

2026/5/17 20:19

快速接入

先看主来源和安装命令,再打开仓库或文档;下面只保留这个条目的关键接入事实。

详细介绍

PDF SPEC MCP服务器

![CI](https://github.com/shuji-bonji/pdf-spec-mcp/actions/workflows/ci.yml) ](https://www.npmjs.com/package/@shuji-bonji/pdf-spec-mcp)

日语版README在这里

MCP(模型上下文协议)服务器,提供对ISO 32000(PDF)规范文档的结构化访问。使LLM能够通过定义良好的工具导航、搜索和分析PDF规范。

\[!重要\] 此软件包中不包括PDF规范文件。 您必须单独获取PDF规范文档并将其放置在本地目录中。 下载地址: PDF协会——赞助标准 请参阅“设置“了解详情。

特性

  • 多规格支持 --自动发现和管理多达17个PDF相关文档(ISO 32000-2、PDF/UA、带标签的PDF指南等)
  • 结构化内容提取 --任何章节的标题、段落、列表、表格和注释
  • 全文搜索 --使用节感知上下文片段进行关键字搜索
  • 需求提取 --根据ISO惯例提取规范性语言(应/必须/可以)
  • 定义查找 --第3节(定义)中的术语定义
  • 表格提取 --通过头部合并进行多页表检测
  • 版本比较 --PDF 1.7与PDF 2.0节结构的差异
  • 有界并发处理 --大型文档的并行页面处理

建筑

graph LR
    subgraph Client["MCP Client"]
        LLM["LLM
(Claude, etc.)"]
    end

    subgraph Server["PDF Spec MCP Server"]
        direction TB
        MCP["MCP Server
index.ts"]

        subgraph Tools["Tools Layer"]
            direction LR
            T1["list_specs"]
            T2["get_structure"]
            T3["get_section"]
            T4["search_spec"]
            T5["get_requirements"]
            T6["get_definitions"]
            T7["get_tables"]
            T8["compare_versions"]
        end

        subgraph Services["Services Layer"]
            direction LR
            REG["Registry
Auto-discovery"]
            LOADER["Loader
LRU Cache"]
            SVC["PDFService
Orchestration"]
            CMP["CompareService
Version Diff"]
        end

        subgraph Extractors["Extractors"]
            direction LR
            OUTLINE["OutlineResolver
TOC & Section Index"]
            CONTENT["ContentExtractor
Structured Extraction"]
            SEARCH["SearchIndex
Full-text Search"]
            REQ["RequirementExtractor"]
            DEF["DefinitionExtractor"]
        end

        subgraph Utils["Utils"]
            direction LR
            CACHE["LRU Cache"]
            CONC["Concurrency"]
            VALID["Validation"]
        end
    end

    subgraph PDFs["PDF Spec Files (obtained separately)"]
        direction LR
        PDF1["ISO 32000-2
(PDF 2.0)"]
        PDF2["ISO 32000-1
(PDF 1.7)"]
        PDF3["TS 32001–32005
PDF/UA, etc."]
    end

    LLM |"stdio / JSON-RPC"| MCP
    MCP --> Tools
    Tools --> Services
    Services --> Extractors
    Services --> Utils
    LOADER --> PDFs
    REG -->|"Filename pattern
auto-discovery"| PDFs

    style Client fill:#e8f4f8,stroke:#2196F3
    style PDFs fill:#fff3e0,stroke:#FF9800
    style Tools fill:#e8f5e9,stroke:#4CAF50
    style Services fill:#f3e5f5,stroke:#9C27B0
    style Extractors fill:#fce4ec,stroke:#E91E63
    style Utils fill:#f5f5f5,stroke:#9E9E9E

层概述

责任
工具MCP工具模式定义和处理程序(输入验证)
服务业务逻辑(PDF注册表、加载器、编排)
提取器从PDF中提取信息(TOC、内容、搜索、要求、定义)
工具集共享实用程序(缓存、并发、验证)

设置

1.获取PDF规格文件

\[!警告\] PDF规格如下 受版权保护的文件 并且不包括在此包中。 从下面的源代码下载它们并将其放置在本地目录中。
文档来源
iso32000-2(PDF 2.0)PDF协会
ISO 32000-1(PDF 1.7)Adobe(免费)
TS 32001–32005、PDF/UA等。PDF协会——赞助标准

支持以下所有17个文件。您不需要所有这些,只需放置您需要的规格(至少建议使用ISO 32000-2)。

pdf-specs/
│
│ ── Standards ─────────────────────────────
├── ISO_32000-2_sponsored-ec2.pdf          # iso32000-2  : PDF 2.0 EC2 (recommended)
├── ISO_32000-2-2020_sponsored.pdf         # iso32000-2-2020 : PDF 2.0 original
├── PDF32000_2008.pdf                      # pdf17       : PDF 1.7 (for version comparison)
├── pdfreference1.7old.pdf                 # pdf17old    : Adobe PDF Reference 1.7
│
│ ── Technical Specifications (TS) ─────────
├── ISO_TS_32001-2022_sponsored.pdf        # ts32001     : Hash extensions (SHA-3)
├── ISO_TS_32002-2022_sponsored.pdf        # ts32002     : Digital signature extensions (ECC/PAdES)
├── ISO_TS_32003-2023_sponsored.pdf        # ts32003     : AES-GCM encryption
├── ISO-TS-32004-2024_sponsored.pdf        # ts32004     : Integrity protection
├── ISO-TS-32005-2023-sponsored.pdf        # ts32005     : Namespace mapping
│
│ ── PDF/UA (Accessibility) ────────────────
├── ISO-14289-1-2014-sponsored.pdf         # pdfua1      : PDF/UA-1
├── ISO-14289-2-2024-sponsored.pdf         # pdfua2      : PDF/UA-2
│
│ ── Guides ────────────────────────────────
├── Tagged-PDF-Best-Practice-Guide.pdf     # tagged-bpg  : Tagged PDF Best Practice
├── Well-Tagged-PDF-WTPDF-1.0.pdf          # wtpdf       : Well-Tagged PDF
├── PDF-Declarations.pdf                   # declarations: PDF Declarations
│
│ ── Application Notes ─────────────────────
├── PDF20_AN001-BPC.pdf                    # an001       : Black Point Compensation
├── PDF20_AN002-AF.pdf                     # an002       : Associated Files
└── PDF20_AN003-ObjectMetadataLocations.pdf # an003      : Object Metadata

2.安装

此软件包附带CLI二进制文件(pdf-spec-mcp)旨在由MCP客户端启动。 您不需要手动安装它 --只需将您的MCP客户端指向 npx @shuji-bonji/pdf-spec-mcp 如下一步骤所示。

如果你想直接从shell运行它(例如用于调试):

PDF_SPEC_DIR=/path/to/pdf-specs npx -y @shuji-bonji/pdf-spec-mcp

或者全局安装(可选):

npm install -g @shuji-bonji/pdf-spec-mcp
PDF_SPEC_DIR=/path/to/pdf-specs pdf-spec-mcp

3.配置MCP客户端

环境变量

变量描述默认值
PDF_SPEC_DIR包含PDF规范文件的目录(必填)

克劳德桌面版

添加 claude_desktop_config.json:

{
  "mcpServers": {
    "pdf-spec": {
      "command": "npx",
      "args": ["-y", "@shuji-bonji/pdf-spec-mcp"],
      "env": {
        "PDF_SPEC_DIR": "/path/to/pdf-specs"
      }
    }
  }
}

光标/VS代码

添加 .cursor/mcp.json 或VS代码MCP设置:

{
  "mcpServers": {
    "pdf-spec": {
      "command": "npx",
      "args": ["-y", "@shuji-bonji/pdf-spec-mcp"],
      "env": {
        "PDF_SPEC_DIR": "/path/to/pdf-specs"
      }
    }
  }
}

可用工具

所有工具都接受可选 spec 参数以针对特定规范(默认值: iso32000-2).

工具说明
list_specs列出所有已发现的PDF规范及其元数据
get_structure获取具有可配置深度的节层次结构(目录)
get_section获取特定部分的结构化内容
search_spec规范中的全文关键字搜索
get_requirements提取规范性要求(应/必须/可以)
get_definitions查找术语定义
get_tables从节中提取表结构
compare_versions比较PDF 1.7和PDF 2.0的截面结构

list_specs --发现规格

列出所有可用的规范文件。使用返回的ID作为 spec 其他工具中的参数。

// List all specs
{ }

// Filter by category
{ "category": "ts" }        // Technical specs only
{ "category": "pdfua" }     // PDF/UA only
{ "category": "guide" }     // Guide documents only

get_structure --目录

获取规范的节层次结构(TOC树)。

// PDF 2.0 top-level sections only
{ "max_depth": 1 }

// Expand to 2 levels
{ "max_depth": 2 }

// TS 32002 (Digital Signatures) full structure
{ "spec": "ts32002" }

// PDF/UA-2 structure
{ "spec": "pdfua2", "max_depth": 2 }

get_section --章节内容

获取特定章节的结构化内容(标题、段落、列表、表格、注释)。

// PDF 2.0 Section 7.3.4 (String Objects)
{ "section": "7.3.4" }

// PDF 2.0 Annex A
{ "section": "Annex A" }

// TS 32002 Section 5
{ "spec": "ts32002", "section": "5" }

// PDF/UA-2 Section 8 (Tagged PDF)
{ "spec": "pdfua2", "section": "8" }

search_spec --全文搜索

使用节感知上下文片段在规范中搜索。

// Search PDF 2.0 for "digital signature"
{ "query": "digital signature" }

// Limit results
{ "query": "font", "max_results": 5 }

// Search within TS 32002
{ "spec": "ts32002", "query": "CMS" }

get_requirements --规范性要求

根据ISO惯例提取规范性要求(应/必须/可以)。

// All requirements in section 12.8
{ "section": "12.8" }

// Only "shall" requirements
{ "section": "12.8", "level": "shall" }

// Only "shall not" requirements
{ "section": "7.3", "level": "shall not" }

// PDF/UA-2 requirements
{ "spec": "pdfua2", "section": "8", "level": "shall" }

get_definitions --术语定义

从第3节(定义)中查找术语定义。

// Search for "font" definitions
{ "term": "font" }

// List all definitions
{ }

// PDF/UA definitions
{ "spec": "pdfua2", "term": "artifact" }

get_tables --表格提取

从节中提取表结构(标题、行、标题)。多页表格会自动合并。

// All tables in section 7.3.4
{ "section": "7.3.4" }

// Specific table only (0-based index)
{ "section": "7.3.4", "table_index": 0 }

// TS spec tables
{ "spec": "ts32002", "section": "5" }

compare_versions --版本比较

比较PDF1.7(ISO32000-1)和PDF2.0(ISO32000-2)之间的截面结构。使用基于标题的自动匹配来检测匹配、添加和删除的部分。

\[!注意\] 此工具需要PDF 1.7(PDF32000_2008.pdf)和PDF 2.0文件 PDF_SPEC_DIR.
// Diff section 12.8 (Digital Signatures)
{ "section": "12.8" }

// Compare all top-level sections
{ }

支持的规格

服务器在以下位置自动发现PDF文件 PDF_SPEC_DIR 通过文件名模式匹配:

类别规格ID文档
标准iso32000-2, iso32000-2-2020, pdf17, pdf17oldiso32000-2(PDF 2.0)、iso32000-1(PDF 1.7)
技术规格ts32001ts32005哈希、数字签名、AES-GCM、完整性、命名空间
PDF/UApdfua1, pdfua2可访问性(ISO 14289-1、14289-2)
指南tagged-bpg, wtpdf, declarations标签PDF,标签PDF,声明
应用说明an001an003BPC、关联文件、对象元数据

目录结构

src/
├── index.ts              # MCP server entry point
├── config.ts             # Configuration & spec patterns
├── errors.ts             # Error hierarchy (PDFSpecError → sub-classes)
├── container.ts          # Service container (DI wiring)
├── services/
│   ├── pdf-registry.ts       # Auto-discovery of PDF files
│   ├── pdf-loader.ts         # PDF loading with LRU cache
│   ├── pdf-service.ts        # Orchestration layer
│   ├── compare-service.ts    # Version comparison
│   ├── outline-resolver.ts   # Section index builder
│   ├── content-extractor.ts  # Structured content extraction
│   ├── search-index.ts       # Full-text search index
│   ├── requirement-extractor.ts
│   └── definition-extractor.ts
├── tools/
│   ├── definitions.ts    # MCP tool schemas
│   └── handlers.ts       # Tool implementations
├── types/
│   └── index.ts          # Shared type definitions
└── utils/
    ├── concurrency.ts    # mapConcurrent (bounded Promise.all)
    ├── text.ts           # Text normalization
    ├── cache.ts          # LRU cache
    ├── validation.ts     # Input validation
    └── logger.ts         # Structured logger

发展

git clone https://github.com/shuji-bonji/pdf-spec-mcp.git
cd pdf-spec-mcp
npm install
npm run build

# Unit tests (237 tests)
npm run test

# E2E tests (212 tests — requires PDF files in ./pdf-spec/)
npm run test:e2e

# Lint & format
npm run lint
npm run format:check

许可证

麻省理工学院

目录标签

目录标签

TypeScriptClaude结构化数据PDF解析本地部署规范处理文档分析文本搜索

支持客户端

ClaudeCursor

接入字段

传输方式(transport,传输协议)

未说明

鉴权方式(authType,认证方式)

none

部署方式(deploymentType,部署类型)

local-only

工具数量(toolCount,工具数)

8

资源数量(resourceCount,资源数)

0

提示词数量(promptCount,提示词数)

0

权限和风险

未说明nonelocal-only

接入前请确认传输方式、认证方式和部署位置,并根据实际工具能力限制访问范围。

安装前确认

不要直接授予不必要的文件、网络或账号权限;先核对安装命令和配置内容。

仍需确认:installCommand

来源信息

继续浏览同类 MCP