HTPD

io.github.narendrachampaneri由 GitHub 账号 narendrachampaneri 发布v0.1.2.post1更新于 Oct 30, 2026

Answer questions from PDFs converted to .htpd: exact text with pages, or 'Not found in this file.'

已验证STDIO仅桌面文件与存储知识与记忆

概览

AI 生成的概览

读取 HTPD 文档包(由 PDF 转换而来的分节文档),让助手用原文和页码回答问题。

可以做什么
  • 列出服务器可读取的已转换文档
  • 查看文档目录,并按 ID、文件名或章节号打开某一节的原文、页码、父节与相邻节
  • 按精确词搜索章节,或直接提问,只返回能回答该问题的章节,无法回答时返回 NOT FOUND
  • 以图片形式取回图表,并附标题、页码和所属章节
  • 检查文档包中的问题,例如失效链接或章节树不一致
适用场景
适合处理长篇 PDF(数据手册、参考手册、政策文件、报告),需要逐字引用原文并标注页码,或在文档没有答案时明确说明而不是猜测。主要面向已转换为 HTPD 格式的文档。
运行要求
以本地 stdio 进程运行:从 PyPI 安装 htpd-reader 包,并用 htpd-mcp 命令指定存放 HTPD 文档包的文件夹。文档需先用单独的 htpd 转换器从 PDF 转换。未声明需要账号、API 密钥或网络访问。
安装前请注意
该服务器只读取文档,不负责转换 PDF,转换器需另行下载。文档内容被当作数据而非指令,但来自不可信 PDF 的内容仍会进入助手上下文。扫描页依赖 OCR 并会加以标记,关键数值应与原页核对。

安装

在 SourceWeft 中

  1. 打开 控制台中的 HTPD,将其添加到工作区。
  2. 为需要使用其工具的对话启用该服务。

Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。

其他 MCP 客户端

参照 仓库 中的启动说明。

README

[HTPD - Hyper Text Portable Document]

[release] [PyPI] [MCP registry] [tests] [Apache-2.0]

Turn long PDFs into documents AI reads correctly - exact text, every answer with its page.

[Open HTPD Studio]   [Download]

In plain words  ·  See it work  ·  Install  ·  Use with your AI  ·  For developers  ·  Quality  

[A PDF becomes an HTPD file; a question uses only the sections it needs; the answer is exact text with its page]


In plain words

You have a long PDF - a 300-page datasheet, a 5000-page reference manual, a policy, a report - and a question about it. Given the whole PDF, an AI often answers slowly, misses details, mixes up tables and cannot show where its answer comes from.

HTPD prepares the document for the AI. The converter turns the PDF into one .htpd file: the same text, word for word, cut into the document's own chapters and sections, with the page of every paragraph, the tables as rows, and the figures as pictures. The AI then reads only the few sections a question needs and answers from the exact text - with the page, so you can check it.

[Exact text - Every fact has a page - Honest answers - 100 % local]

What you getWhat it means for you
Exact textValues, part numbers and register names exactly as in the PDF. Nothing is summarised or rewritten.
A page for every factEvery answer can be checked in the original document in seconds.
Honest answersWhen the document does not hold the answer, HTPD says so instead of guessing.
Tables and figuresTables stay rows with their columns; diagrams and photos are kept as pictures with their caption.
Scanned pages tooText in scans and pictures is read by OCR (free Tesseract), marked so you know.
Private and freeRuns on your own computer. No GPU, no account, no cloud. Open source.

Try it in the browser: HTPD Studio.


See it work

Real commands and their output on a public 109-page data sheet (NXP i.MX 93, shortened where long).

1. Convert the PDF once - about a second for 100 pages:

[htpd convert turns the 109-page data sheet into one .htpd file in 1.2 seconds]

2. Ask in your own words - the exact line from the document, with its page and section:

[htpd-read shows the contents and answers two questions with the exact table row and page]

3. Figures stay pictures - an AI that can see images looks at the diagram itself:

[htpd-read figure writes the block diagram of the data sheet as a picture]

In daily use you do not type these commands: you give the .htpd file to your AI, or let the plugin, the skill or the MCP server do it for you.


Install in one minute

You useDo this
Claude Code/plugin marketplace add narendrachampaneri/htpd then /plugin install htpd@htpd - converts PDFs and answers from them; the MCP server is included
Claude app and other apps with skillsAdd htpd-skill.zip under Customize → Skills
Any MCP client (Antigravity, Codex, Cursor, ...)pip install htpd-reader, then the command htpd-mcp --bundles <folder> - or find io.github.narendrachampaneri/htpd in the MCP registry
ChatGPT, GeminiUpload the .htpd file, or make a custom GPT / Gem with the ready instructions
The converter (PDF → .htpd)Download htpd-0.1.2-linux-x64.tar.gz (Linux, Windows with WSL) and run ./htpd convert manual.pdf --single

The converter and the reader run on your computer. What reaches an AI is only the text you give it.


Use it with your AI

Any AI chat - just upload the file

htpd convert manual.pdf --single writes one .htpd file. It begins with the reading rules for the model - answer only from this file, give the page of every fact, say so when the answer is not there - then the contents and every section with its pages.

Upload it to Claude, ChatGPT, Gemini or any other assistant instead of the PDF. If an app does not accept the extension, rename it to manual.htpd.txt - it is plain text. For a ChatGPT custom GPT or a Gemini Gem that always has your document, see docs/AI-APPS.md (instructions ready to paste).

Best for documents that fit in the chat (a datasheet of a few hundred pages). For very large manuals use the skill, the plugin or MCP below.

Claude app and apps with skills - the htpd skill
AppHow to add it
Claude appCustomize → Skills, upload htpd-skill.zip, switch it on (code execution must be on). Then upload a .htpd file to a chat and ask.
Claude CodeInstall the plugin (below), or unzip into ~/.claude/skills/.
Other agents that read SKILL.mdUnzip into their skills folder.

The skill runs a small script that needs only Python - no packages, no model. It finds the right sections and returns the exact lines with [page, section]. Because the AI reads only what the script returns, this works even for manuals of thousands of pages.

Claude Code - the htpd plugin
/plugin marketplace add narendrachampaneri/htpd/plugin install htpd@htpd

Then ask in plain words - "convert datasheet.pdf to htpd", "what is the maximum NPU frequency in datasheet.htpd?" - or run /htpd:convert datasheet.pdf --single. The first conversion downloads the released converter once (Linux and WSL, about 4 MB, checked by SHA-256). The PDF never leaves the computer.

Agents with MCP - the htpd-mcp server
sh
pip install htpd-reader                                   # htpd-read and htpd-mcp, nothing else neededclaude mcp add htpd -- htpd-mcp --bundles ~/manuals       # Claude Code

For Antigravity, Codex, Cursor or any MCP client: command htpd-mcp, arguments --bundles /path/to/your/htpd/files. The server is also listed in the official MCP registry as io.github.narendrachampaneri/htpd (clients start it with uvx htpd-reader). Tools: list_bundles, contents, open_section, search, ask, figure (the picture of a figure, as an image), check.


For developers

How it works

mermaid
flowchart LR    PDF["📄 PDF<br/>scanned or digital"] -->|htpd convert| H["HTPD<br/>sections · pages · tables · figures"]    H -->|upload| CHAT["AI chat<br/>(file + reading rules)"]    H -->|skill · plugin · MCP| AGENT["AI agent<br/>(Claude, Antigravity, Codex)"]    CHAT --> ANS["Answer from the exact text<br/>with page numbers"]    AGENT --> ANS
PartWhat it does
Converter htpd (C++23, PDFium)Reads every character with its position and font, removes headers and footers, finds the headings (bookmarks, the PDF's own tags, a printed table of contents, numbering, font size), cuts the text into sections, reads tables as rows (from the lines the page draws, the PDF's tags or the text; cells over columns or rows are marked) and keeps code as code, stores figures as PNG with their caption, reads scans with OCR.
Reader htpd-read (Python, standard library only)Finds the sections that answer a question (word search, the tree of titles, a small trained re-ranker), packs only that text with its pages, picks the exact answer lines, and says when the file cannot answer. Also as a skill, a plugin and an MCP server.

[A PDF page becomes a clean HTPD section with its place in the document and page marks]

Quick start

Download (no build needed) from the release page:

sh
tar xzf htpd-0.1.2-linux-x64.tar.gzcd htpd-0.1.2-linux-x64./htpd convert manual.pdf --single           # writes manual.htpdsudo apt install tesseract-ocr               # optional: read scanned pages too

Build from source - Linux (Ubuntu 24.04, also WSL), g++ 13+, make or CMake, Python 3.10+:

sh
git clone https://github.com/narendrachampaneri/htpd.git && cd htpd./scripts/get_pdfium.sh        # the PDF engine, once (about 4 MB)make                           # builds build/htpdmake test                      # the C++ tests

Convert and ask:

sh
./build/htpd convert manual.pdf --single     # one file: manual.htpd  (for AI chats)./build/htpd convert manual.pdf              # a folder: manual.htpd/ (for tools and agents)
pip install htpd-reader                      # or: python3 -m pip install -e .htpd-read ask examples/single-file/sample.htpd "What is the maximum bus voltage?"
[page 2, 2.1.1 Limits]  Parameter | Min | Typ | Max | Unit  Bus voltage | 200 | 400 | 480 | V

Every answer line is copied word for word from the file; --context adds the whole sections for the AI. More commands: contents, section, search, figure, check - see reader/README.md.

The format

An HTPD document is plain UTF-8 text: Markdown with a few fields. Any model, editor or grep can read it.

One section of an HTPD file (shortened)
markdown
<!-- htpd section {"n":14,"id":"sections/0014-4-1-5-maximum-frequency-of-main-modules","number":"4.1.5","level":3,"pages":[18,18,18],"parent":"sections/0008-4-1-chip-level-conditions"} -->## [S14] 4.1.5 Maximum frequency of main modules
Path: 4 Electrical characteristics > 4.1 Chip-level conditions > 4.1.5 Maximum frequency of main modules - page 18
<!-- page 18 -->
```textCortex®-A55 cores | 0.9 GHz | 1.4 GHz | 1.7 GHzDRAM | 933 MHz | 1400 MHz | 1866 MHzNPU | 500 MHz | 800 MHz | 1000 MHz```
  • Sections follow the document's own headings and form a tree: parent, children, previous, next.
  • Page marks <!-- page N --> stand above the text of every page.
  • Tables are rows with | between cells (a cell over columns or rows is marked [>] / [=] where the page draws the lines of the table); code and listings keep their spacing.
  • Figures are PNG pictures with caption and page, stored inside the file.
  • Two forms, same content: a single .htpd file (for chats) and a folder with one file per section (for tools), which is also a valid Open Knowledge Format bundle.

The full specification is docs/FORMAT.md. Examples: examples/single-file/sample.htpd and examples/sample.htpd/.


Quality

Speed and size - single file, figures and OCR on, a 2-core cloud machine:

DocumentPagesSectionsFiguresPDF → .htpdTime
NXP i.MX 93 Automotive Data Sheet109114531.7 MB → 2.5 MB1.2 s
NXP i.MX 93 Reference Manual5 6525 92963756.3 MB → 39.8 MB67 s
RISC-V Debug Specification11916432.4 MB → 0.7 MB3.4 s
Arm AAPCS646512550.4 MB → 0.3 MB0.3 s
RISC-V Unprivileged ISA670760254.5 MB → 2.8 MB4.9 s

Most of a file with figures is their pictures, at its very end; the text comes first. --figures off leaves them out.

Finding the answer - 133 test questions about two public manuals (eval/report.md, written by the evaluation harness):

Right section firstRight section in the first 5Right pageAnswer in the text for the AI
HTPD reader0.780.950.640.86
Plain word search over HTPD sections0.640.870.550.83
Plain word search over 500-token chunks0.320.720.510.83

The text handed to the AI is about 6 % of the whole document, and the reader correctly says "not in this file" for 95 % of the questions the manuals do not answer.

Many kinds of PDF - 45 PDFs of known text, made by Word, LaTeX, Chrome, wkhtmltopdf and slide software, scanned, and with letters drawn as shapes (tests/zoo): 99 % of the text in order, 96 % of the headings, 89 % of the table rows exact.

Robustness - a stress test of 34 difficult PDFs (two columns, sideways tables, rotated pages, 1500 pages, encrypted, truncated and corrupted files): no crash, no hang, every file valid, no word lost. 102 C++ tests and 155 Python tests run on every change.


Project layout

Folders and documentation
include/ src/ cli/      the converter (C++23, PDFium is used in one file only)reader/htpd_reader/     the reader: bundle, check, search, retriever, re-ranker, packer, answer, MCP serverskills/htpd/            the skill for AI apps (scripts/build_skill.py packs it)skills/convert/         the plugin's skill that converts PDFs.claude-plugin/         the Claude Code plugin and its marketplace (this repository is both)eval/                   evaluation harness, baselines, reportmodel/                  the training of the re-rankertests/                  C++ tests, test PDFs, the stress test, the document zoodocs/                   FORMAT.md · CONVERTER.md · READER.md · AI-APPS.md · BACKGROUND.mdexamples/               a converted document in both forms
DocumentFor
docs/FORMAT.mdThe format: anyone can write a reader from it
docs/CONVERTER.mdBuilding, options, how the converter works, what was tested, limits
reader/README.mdThe reader, its commands and its Python API
docs/READER.mdHow the reader finds the answer, and how it is measured
docs/AI-APPS.mdChatGPT custom GPT and Gemini Gem
docs/BACKGROUND.mdWhy HTPD is built the way it is
AGENTS.mdRules for contributors and coding agents

Contributing

Issues and pull requests are welcome. Before you change anything, read AGENTS.md; the short version:

  • All tests pass before a change is merged: make test and python3 -m pytest.
  • Every new rule in the code comes with a test that fails without it.
  • Never lose text and never make text up.
  • A change to what is written into an HTPD file updates docs/FORMAT.md in the same commit.

License

HTPD is open source under the Apache License 2.0: you may use, change and share it, also in commercial products, as long as you keep the copyright and license notices (NOTICE) and mark what you changed. The license includes a patent grant from every contributor.

PDFium, which the converter uses, is not part of this repository and has its own license (BSD-style with an Apache-2.0 part); after scripts/get_pdfium.sh its license texts are in third_party/pdfium/licenses/. If you give the program to others together with libpdfium.so, give them those files too.


Made by Narendra Champaneri  ·  HTPD Studio  ·  Releases  ·  PyPI

来源:README.md,提交 f2f3fd7

工具

7

list_bundles

List the HTPD bundles (converted documents) this server can read.

无需输入参数。

contents

The table of contents of a bundle: every section with its ID, number, title and pages. Start here to see how the document is built.

输入参数depthbundle必填

open_section

The exact text of one section, with the page of every paragraph, its place in the document, its parent, subsections and neighbours. Use the ID, the file name or the section number (e.g. '3.1').

输入参数bundle必填section必填

ask

Give a question; get back only the few sections of the document that answer it, with their exact text and pages - or NOT FOUND when the document does not answer it. Quote the text and cite the pages in the answer.

输入参数budgetbundle必填question必填

figure

The picture of one figure (a diagram, chart or photo of the document) as an image, with its caption, page and section. Figures stand in the text as a line '![F12: caption]'; ask for 'F12' to see it.

输入参数bundle必填figure必填

check

List every problem of a bundle (broken links, a tree that disagrees, ...).

输入参数bundle必填

版本历史

1
  1. v0.1.2.post1最新Oct 23, 2026

评分

已满足适用检查项的 90%

该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。

  • 近 30 天内可连通25 分
  • 已声明认证方式10 分

    请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。

  • 已列出工具必需15 分
  • 描述必需15 分
  • 图标10 分
  • 文档15 分
  • 许可证10 分