Metadata-Version: 2.4
Name: docpull
Version: 6.11.0
Summary: Web context for AI agents: fetch, lock, cite, and track changes to any public web source
Author-email: Zachary Roth <support@raintree.technology>
Maintainer-email: Raintree Technology <support@raintree.technology>
License-Expression: MIT
Project-URL: Homepage, https://github.com/raintree-technology/docpull
Project-URL: Documentation, https://github.com/raintree-technology/docpull#readme
Project-URL: Repository, https://github.com/raintree-technology/docpull
Project-URL: Source Code, https://github.com/raintree-technology/docpull
Project-URL: Bug Tracker, https://github.com/raintree-technology/docpull/issues
Project-URL: Releases, https://github.com/raintree-technology/docpull/releases
Project-URL: MCP Plugin, https://github.com/raintree-technology/docpull/tree/main/plugin
Project-URL: Comparison Guide, https://github.com/raintree-technology/docpull/blob/main/docs/alternatives.md
Project-URL: Download Stats, https://pepy.tech/project/docpull
Project-URL: Changelog, https://github.com/raintree-technology/docpull/blob/main/docs/CHANGELOG.md
Keywords: python,markdown,web-context,agent-context,ai-context,citations,documentation,web,website,web-extraction,web-to-markdown,source-ingestion,provenance,context-ci,content-extraction,developer-tools,cli,rag,llm,mcp,ai-agents,context-engineering,context-dependencies,context-packs,source-packs,research,claude,ai-training-data
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Information Technology
Classifier: Intended Audience :: Science/Research
Classifier: Intended Audience :: Education
Classifier: Environment :: Console
Classifier: Topic :: Internet :: WWW/HTTP :: Indexing/Search
Classifier: Topic :: Text Processing :: Markup :: HTML
Classifier: Topic :: Text Processing :: Markup :: Markdown
Classifier: Topic :: Utilities
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Classifier: Natural Language :: English
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Typing :: Typed
Requires-Python: >=3.11
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: beautifulsoup4>=4.12.0
Requires-Dist: html2text>=2020.1.16
Requires-Dist: defusedxml>=0.7.1
Requires-Dist: extruct>=0.15.0
Requires-Dist: aiohttp>=3.14.4
Requires-Dist: idna>=3.15
Requires-Dist: regex>=2024.11.6
Requires-Dist: rich>=13.0.0
Requires-Dist: pyyaml>=6.0
Requires-Dist: pydantic>=2.0
Requires-Dist: urllib3>=2.8.0
Provides-Extra: proxy
Requires-Dist: aiohttp-socks>=0.11.0; extra == "proxy"
Provides-Extra: normalize
Requires-Dist: url-normalize>=1.4.0; extra == "normalize"
Provides-Extra: trafilatura
Requires-Dist: trafilatura>=1.12.0; extra == "trafilatura"
Provides-Extra: tokens
Requires-Dist: tiktoken>=0.7.0; extra == "tokens"
Provides-Extra: mcp
Requires-Dist: cryptography>=50.0.0; extra == "mcp"
Requires-Dist: mcp<2,>=1.30.0; extra == "mcp"
Requires-Dist: pydantic-settings>=2.14.2; extra == "mcp"
Requires-Dist: pyjwt>=2.15.1; extra == "mcp"
Requires-Dist: python-multipart>=0.0.27; extra == "mcp"
Requires-Dist: starlette>=1.3.1; extra == "mcp"
Provides-Extra: serve
Requires-Dist: uvicorn>=0.30.0; extra == "serve"
Provides-Extra: parquet
Requires-Dist: pyarrow>=16.0.0; extra == "parquet"
Provides-Extra: markitdown
Requires-Dist: pypdf>=6.21.1; extra == "markitdown"
Requires-Dist: markitdown[docx,pdf]>=0.1.0; extra == "markitdown"
Provides-Extra: unstructured
Requires-Dist: pypdf>=6.21.1; extra == "unstructured"
Requires-Dist: unstructured[all-docs]>=0.24.1; (python_version >= "3.11" and python_version < "3.14") and extra == "unstructured"
Provides-Extra: pdf
Requires-Dist: pypdf>=6.21.1; extra == "pdf"
Provides-Extra: tables
Requires-Dist: pypdf>=6.21.1; extra == "tables"
Requires-Dist: pdfplumber>=0.11.10; extra == "tables"
Provides-Extra: parse
Requires-Dist: pypdf>=6.21.1; extra == "parse"
Requires-Dist: pdfplumber>=0.11.10; extra == "parse"
Requires-Dist: markitdown[docx,pdf]>=0.1.0; extra == "parse"
Requires-Dist: unstructured[all-docs]>=0.24.1; (python_version >= "3.11" and python_version < "3.14") and extra == "parse"
Provides-Extra: presidio
Requires-Dist: presidio-analyzer>=2.2.0; extra == "presidio"
Provides-Extra: provenance
Requires-Dist: cryptography>=50.0.0; extra == "provenance"
Provides-Extra: e2b
Requires-Dist: e2b>=2.0.0; extra == "e2b"
Provides-Extra: llm
Requires-Dist: tiktoken>=0.7.0; extra == "llm"
Provides-Extra: vectors
Requires-Dist: sqlite-vec>=0.1.9; extra == "vectors"
Requires-Dist: fastembed>=0.9.1; extra == "vectors"
Provides-Extra: all
Requires-Dist: aiohttp-socks>=0.11.0; extra == "all"
Requires-Dist: url-normalize>=1.4.0; extra == "all"
Requires-Dist: trafilatura>=1.12.0; extra == "all"
Requires-Dist: tiktoken>=0.7.0; extra == "all"
Requires-Dist: cryptography>=50.0.0; extra == "all"
Requires-Dist: mcp<2,>=1.30.0; extra == "all"
Requires-Dist: pydantic-settings>=2.14.2; extra == "all"
Requires-Dist: pyjwt>=2.15.1; extra == "all"
Requires-Dist: python-multipart>=0.0.27; extra == "all"
Requires-Dist: starlette>=1.3.1; extra == "all"
Requires-Dist: uvicorn>=0.30.0; extra == "all"
Requires-Dist: pyarrow>=16.0.0; extra == "all"
Requires-Dist: pypdf>=6.21.1; extra == "all"
Requires-Dist: pdfplumber>=0.11.10; extra == "all"
Requires-Dist: markitdown[docx,pdf]>=0.1.0; extra == "all"
Requires-Dist: unstructured[all-docs]>=0.24.1; (python_version >= "3.11" and python_version < "3.14") and extra == "all"
Requires-Dist: presidio-analyzer>=2.2.0; extra == "all"
Requires-Dist: e2b>=2.0.0; extra == "all"
Requires-Dist: sqlite-vec>=0.1.9; extra == "all"
Requires-Dist: fastembed>=0.9.1; extra == "all"
Provides-Extra: dev
Requires-Dist: pytest>=7.0.0; extra == "dev"
Requires-Dist: pytest-cov>=4.0.0; extra == "dev"
Requires-Dist: pytest-asyncio>=0.21.0; extra == "dev"
Requires-Dist: mypy>=1.0.0; extra == "dev"
Requires-Dist: ruff>=0.1.0; extra == "dev"
Requires-Dist: bandit>=1.7.0; extra == "dev"
Requires-Dist: pip-audit>=2.0.0; extra == "dev"
Requires-Dist: msgpack>=1.2.1; extra == "dev"
Requires-Dist: pre-commit>=3.0.0; extra == "dev"
Requires-Dist: types-beautifulsoup4>=4.12.0; extra == "dev"
Requires-Dist: types-defusedxml>=0.7.0; extra == "dev"
Requires-Dist: types-pyyaml>=6.0.0; extra == "dev"
Dynamic: license-file

<p align="center">
  <img src="https://raw.githubusercontent.com/raintree-technology/docpull/main/docs/launch-assets/logo-square-light-400.png" alt="DocPull" width="128" />
</p>

# DocPull

<!-- project-record: docpull -->

**Active open-source project · MIT License**

**Web context for AI agents.** DocPull fetches any public web source, locks exactly
what it fetched, serves agents cited passages from that locked copy, and tells you
when a change upstream breaks something an agent already cited.

A source can be a docs site, a pricing or product page, a changelog, a policy, a
feed, a GitHub repo, an npm or PyPI package, a paper, a standard, a dataset, or a
local PDF. Use DocPull when an agent's answers depend on the live web and you need
to know which pages it used, whether they changed, and how to rebuild the same
context later.

[![Python 3.11+](https://img.shields.io/badge/python-3.11+-blue.svg)](https://www.python.org/downloads/)
[![PyPI version](https://img.shields.io/pypi/v/docpull.svg?label=package)](https://pypi.org/project/docpull/)
[![License: MIT](https://img.shields.io/github/license/raintree-technology/docpull)](LICENSE)

<!-- mcp-name: io.github.raintree-technology/docpull -->

## Install and sync your first source

Five commands cover the daily loop:

```bash
pip install docpull
docpull init payments-context                                     # 1. declare sources
docpull add docs.stripe.com stripe.com/pricing npm:stripe github.com/stripe/stripe-node
docpull sync                                                      # 2. fetch and lock
docpull query "retry policy" --max-tokens 4000 > answer.json      # 3. cited passages
docpull impact answer.json                                        # 4. did a change break them?
docpull ci                                                        # 5. gate freshness and quality
```

`docpull add` works out what each input is: a site, a page, a package, a repo, a
paper (`doi:` or arXiv), a feed, an OpenAPI spec, or a PDF.

| Command | What it does |
| --- | --- |
| `init` / `add` | Create `docpull.yaml` and declare web pages, sites, packages, repos, papers, feeds, or files. |
| `sync` | Fetch sources into a new run and pin `.docpull/context.lock.json`. |
| `query` | Return deduplicated passages from locked archives with a token budget and exact source spans. |
| `impact` | Report saved citations that a later source change made stale, contradicted, or broken. |
| `ci` | Check freshness, citation coverage, pack quality, and rights; exit non-zero on a hard gate. |

`docpull --help` lists the core and pack commands. `docpull help --all` lists every
command, and `docpull help <command>` shows its options. No account or paid API is
required: fetching, discovery, extraction, indexing, diffs, and queries run locally.
See [Query locked context](docs/context-dependencies.md#query-locked-context) for
budget semantics and queries across projects.

![DocPull project diff showing changed pages, local semantic categories, and zero failed URLs](docs/launch-assets/docpull-project-diff-demo.png)

## MCP setup

Install the MCP extra and register the stdio server with the core toolset, which
exposes the query, impact, read, and fetch tools an agent needs day to day:

```bash
pip install 'docpull[mcp]'
claude mcp add --transport stdio docpull -- docpull mcp --toolset core
```

Add `--toolset project` or `--toolset packs` (repeat or comma-separate) for more
tools; the default is `all`. Project writes stay off unless you pass
`--allow-project-writes`. See [MCP server](#mcp-server) for HTTP and the full list.

## Ready-made packs

Popular sources are prebuilt in the signed public
[registry](https://github.com/raintree-technology/docpull-registry). A pack is a
recipe: source URLs, pinned pages, and content hashes, never content. DocPull
fetches the pages on your machine and reports which still match:

```bash
export DOCPULL_REGISTRY_PUBLIC_KEY=k2wv0zPUlj88D66zXXQD86Knnt66MoJN2ztFitdDg00=
docpull add stripe@latest
```

Packs rebuild daily from [`registry/catalog.yaml`](registry/catalog.yaml); a new
version appears only when the pages changed.

## GitHub Action

Check saved citations on every pull request. The action runs `docpull ci`, keeps
one comment on the PR ("2 cited claims changed upstream"), and fails on a hard gate:

```yaml
permissions:
  contents: read
  pull-requests: write
steps:
  - uses: actions/checkout@v4
  - uses: raintree-technology/docpull@v6.11.0
    with:
      args: --citations evidence/answers.json
```

See [Context CI](docs/context-ci.md#github-actions) for inputs and outputs.

## Why use DocPull

- **Reproduce agent context.** Stable IDs, hashes, manifests, and lockfiles show which
  source versions produced an answer or artifact.
- **Detect web drift.** Sync and diff docs, product and pricing pages, changelogs,
  policies, feeds, repositories, packages, standards, and local documents.
- **Catch stale citations.** `docpull impact` marks each saved citation valid, stale,
  contradicted, or broken; on a controlled
  [benchmark](bench/results/stale-citations/REPORT.md) it caught every changed
  fact that a cache-only agent would have kept serving.
- **Keep web text from steering agents.** Query results withhold passages that
  match prompt-injection patterns and say how many were withheld.
- **Keep evidence inspectable.** Markdown, NDJSON, SQLite, citations, and provenance
  sidecars remain readable without a hosted service.
- **Choose the downstream surface.** Export context for agent clients, vector import,
  data workflows, or a versioned context-pack release.
- **Keep expensive routes explicit.** Browser and cloud rendering require an explicit
  choice and can be blocked with a zero-dollar budget.

## How it works

```text
declared sources → local acquisition → versioned evidence → diff and validation → export
```

`docpull diff` compares runs with hash-based change reports, and
`docpull export context-pack --target cursor` writes context for an agent client.
Source URLs, content hashes, run IDs, and citations travel with every artifact.

DocPull's v3 pack contract separates raw extraction, agent-ready context, and
eval-grade evidence. Validate the level a downstream system requires:

```bash
docpull pack prepare packs/docs --eval-grade
docpull pack validate packs/docs --level eval
docpull ci --prepare
```

`docpull ci` checks freshness, citation coverage, pack quality, rights metadata, and
other configured gates. It writes `context-ci.report.json` and `CONTEXT_CI.md`, then
exits non-zero when a hard gate fails.

## Supported surfaces

| Surface | Use it for | Start here |
| --- | --- | --- |
| CLI | Fetch, sync, diff, validate, and export | [`docs/cli-recipes.md`](docs/cli-recipes.md) |
| Python SDK | Embed acquisition in Python applications | [`docs/surface-contract.md`](docs/surface-contract.md) |
| MCP server | Give local agent clients source tools | [MCP server](#mcp-server) |
| TypeScript SDK | Read local packs and invoke the CLI from Node or Bun | [`sdk/js/README.md`](sdk/js/README.md) |
| Agent plugin | Install the supported MCP workflow in an agent client | [`plugin/README.md`](plugin/README.md) |

Common source shapes include static and server-rendered websites, OpenAPI documents,
feeds, papers, public GitHub repositories, npm and PyPI packages, standards, datasets,
transcripts, Wikimedia pages, product and policy pages, and local PDF or office files.
See [context-pack workflows](docs/context-packs.md) for the complete surface.

## MCP server

```bash
pip install 'docpull[mcp]'
docpull mcp                                   # stdio, every tool
docpull mcp --toolset core,project            # fewer tools for a smaller agent context
```

| Toolset | Tools |
| --- | --- |
| `core` | `context_query`, `context_impact`, `read_doc`, `grep_docs`, `list_indexed`, `ensure_docs`, `list_sources`, `fetch_url`, `project_status` |
| `project` | `project_status`, `project_outdated`, `project_install`, `project_sync`, `project_update` |
| `packs` | Pack builders, `pack_*`, `graph_*`, `export_pack`, `audit_pack`, `refresh_pack`, `intelligence_bundle`, `workflow_run` |
| `all` | Everything above plus `render_url`, `explain_routes`, `validate_policy`, `serve_pack_status`, `add_source`, `remove_source` |

`DOCPULL_MCP_TOOLSET=core` sets the same choice from the environment. Calling a tool
outside the enabled toolsets returns an error that names the toolset to add.

For clients that speak Streamable HTTP, run the same server locally:

```bash
pip install 'docpull[mcp,serve]'
docpull mcp --transport http --toolset core   # http://127.0.0.1:8765/mcp
```

The HTTP server has no authentication. It binds 127.0.0.1 by default, rejects
requests whose Host or Origin header is not a loopback address (DNS rebinding
protection), and refuses a non-loopback `--host` unless you also pass `--allow-remote`.

## Limits and security boundary

DocPull is an evidence-acquisition engine, not a hosted competitive-intelligence
product. It owns fetching, explicit rendering adapters, versioning, citations,
hashing, validation, replay, and export. Downstream products own scheduling, human
review, approved claims, legal conclusions, accounts, and notifications.

The default path does not handle complex interactive browser workflows, CAPTCHAs,
stealth scraping, or private dashboards. JavaScript rendering is explicit. Authenticated
sources require environment-variable references; DocPull does not persist credential
values in project artifacts.

Security defaults include HTTPS-only fetching, robots.txt compliance, SSRF and DNS
rebinding protections, redirect guards, XXE protection, and path-traversal checks. Read
the [web-source boundary](docs/scraping-boundary.md), [security posture](docs/compliance.md),
and [evidence-engine decision](docs/adr/0001-evidence-acquisition-engine.md) before
extending acquisition behavior.

## Documentation and evidence

- [CLI recipes](docs/cli-recipes.md) — Common commands and advanced workflows.
- [Context dependencies](docs/context-dependencies.md) — Project and lockfile model.
- [Context Pack Contract v3](docs/context-pack-contract-v3.md) — Artifact levels and compatibility.
- [Public contracts](docs/contracts.md) — Schemas and versioning rules.
- [Alternatives](docs/alternatives.md) — Browser automation and hosted extraction tradeoffs.
- [JavaScript SDK and loaders](docs/sdk-js.md) — TypeScript client and LangChain/LlamaIndex loaders.
- [Dependency security](docs/dependency-security.md) — Locked dependency sets and optional parser support.
- [Evaluation lab](bench/docs/index.md) — Reproducible methods, results, and claim boundaries.
- [Changelog](docs/CHANGELOG.md) — Release history.

## Raintree open-source system

DocPull owns evidence acquisition and reproducible agent context. It can be used
independently; the sibling projects do not imply a required integration or shared
release cycle.

| Project | Responsibility |
| --- | --- |
| [Raintree Standards](https://github.com/raintree-technology/raintree.standards) | Defines governed requirements and evidence. |
| [Trellis](https://github.com/raintree-technology/trellis) | Enforces shared JavaScript and TypeScript code policy. |
| [HIG Doctor](https://github.com/raintree-technology/hig-doctor) | Audits interface source and provides HIG guidance. |
| [PolicyStrata](https://github.com/raintree-technology/policystrata) | Tests cross-layer policy behavior. |

See the [Raintree open-source portfolio](https://raintree.technology/portfolio#open-source)
for current lifecycle and distribution links.

Raintree also builds [BetterOff](https://betteroff.finance), which keeps a household's
spending, investments, assets, debts, and net worth in one current record.

## Project policies

[Contributing](.github/CONTRIBUTING.md) · [Code of Conduct](CODE_OF_CONDUCT.md) · [Security](.github/SECURITY.md) ·
[Metrics and evidence limits](METRICS.md) · [Source repository](https://github.com/raintree-technology/docpull) ·
[MIT License](LICENSE)
