html-reader-llm
HTML simplification and intelligent extraction for LLM.
Features
- HTML Simplification — 7-step pipeline to clean HTML for LLM consumption
- Render Detection — Compare HTTP vs Chrome to decide if browser rendering is needed
- LLM Analysis — Page classification (list/detail) + CSS selector rule generation
- CSS Selector Validation — Verify selectors against actual HTML
- MCP Server — Expose tools to LLM agents via stdio protocol
Installation
pip install html-reader-llm
# or
uv tool install html-reader-llm
CLI Usage
# Simplify HTML
html-reader-llm simplify < page.html
html-reader-llm simplify --file page.html --stats
# Detect if browser rendering is needed
html-reader-llm detect https://example.com
html-reader-llm detect https://example.com --proxy http://127.0.0.1:7890
# Full analysis with LLM
html-reader-llm analyze https://example.com
html-reader-llm analyze https://example.com --dry-run
html-reader-llm analyze https://example.com --base-url https://api.openai.com/v1 --api-key sk-xxx
# Fetch HTML
html-reader-llm fetch https://example.com
html-reader-llm fetch https://example.com --chrome
html-reader-llm fetch https://example.com --json --detect-only
# Validate CSS selectors
html-reader-llm validate https://example.com --rules-file selectors.json
html-reader-llm validate --html-file page.html --rules-file selectors.json --json
MCP Mode
Expose tools to LLM agents via stdio protocol:
# Start MCP server
uvx html-reader-llm --mcp
MCP Client Configuration
Claude Desktop (claude_desktop_config.json):
{
"mcpServers": {
"html-reader-llm": {
"command": "uvx",
"args": ["html-reader-llm", "--mcp"]
}
}
}
Cursor (.cursor/mcp.json):
{
"mcpServers": {
"html-reader-llm": {
"command": "uvx",
"args": ["html-reader-llm", "--mcp"]
}
}
}
Available MCP Tools
| Tool | Input | Output |
|---|---|---|
simplify_html |
html |
Simplified HTML + per-step stats |
prepare_analysis |
html, max_tokens? |
System prompt + user prompt for LLM analysis |
validate_selectors |
html, rules |
Per-selector validation results |
extract_data |
html, rules |
Extracted data (detail) or list of items (list) |
All tools accept HTML strings directly — no network calls. The caller is responsible for fetching HTML.
Agent Workflow
Agent fetches HTML (browser tool, curl, etc.)
│
├─ simplify_html(html)
│ → Cleaned HTML for analysis
│
├─ prepare_analysis(html)
│ → System prompt + user prompt
│ → Agent analyzes page, generates extraction rules
│
├─ validate_selectors(html, rules)
│ → Verify rules work against actual HTML
│
└─ extract_data(html, rules)
→ Get extracted content (detail values or list items)
Proxy Support
All network-dependent commands support --proxy:
html-reader-llm fetch https://example.com --proxy http://127.0.0.1:7890
html-reader-llm detect https://example.com --proxy http://127.0.0.1:7890
html-reader-llm analyze https://example.com --proxy http://127.0.0.1:7890
html-reader-llm validate https://example.com --rules-file rules.json --proxy http://127.0.0.1:7890
License
MIT
Metadata
Release files for html-reader-llm 0.0.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| html_reader_llm-0.0.3.tar.gz | 162.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| html_reader_llm-0.0.3-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 194.3 kB
Release files / html_reader_llm-0.0.3.tar.gz
| Download URL | html_reader_llm-0.0.3.tar.gz |
|---|---|
| Size | 162.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5afdd81c04a19f8acd7242895a336f856c34e5d6434eeb66226007a053f824e8
|
|
BLAKE2b-256 checksum How to use checksums |
6360bea0439cbe917c04a0081001bbdcb367d3bd228a0c4cef67df5a6af0949c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
python-requests/2.33.1
|
Release files / html_reader_llm-0.0.3-py3-none-any.whl
| Download URL | html_reader_llm-0.0.3-py3-none-any.whl |
|---|---|
| Size | 32.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ff4a5799e474cb33308d99d7106af36fea3450c0fc7b76ce6fc89810f0a9623d
|
|
BLAKE2b-256 checksum How to use checksums |
cb525e2f18f8645c6723a96aa910da623ab1ccb4d47a6569cc9d77b18895a3da
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
python-requests/2.33.1
|