Skip to main content

ByteCrawl

CI PyPI Python 3.9+ License: MIT

Give your AI agent focused web crawling. ByteCrawl is an MCP server (and a small Python library) that doesn't just scrape a page — it crawls a whole site and returns the pages most relevant to your topic first, using Shark-Search and OPIC in pure Python.

Quick start (MCP — nothing to install)

Point any MCP-capable agent (Claude Code, Claude Desktop, Cursor...) at the hosted endpoint:

claude mcp add --transport http bytecrawl https://bytecrawl.vercel.app/mcp

Now the agent has four tools:

Tool What it does
focused_crawl Crawl a site, rank pages by relevance to a query (Shark-Search / OPIC / BFS)
fetch_markdown One page → clean Markdown (5–10× fewer tokens than raw HTML)
extract Structured records via CSS selectors
fetch_json_api Hit a hidden JSON API

The hosted server is static-only, rate-limited per IP, caps crawls at 10 pages, and refuses non-public URLs (SSRF guard). For heavy use or JS-rendered sites, run it locally:

pip install bytecrawl[mcp]
claude mcp add bytecrawl -- bytecrawl-mcp                 # full power, on your machine
pip install bytecrawl[browser] && playwright install chromium   # + JS rendering

Why focused crawling?

Most crawlers visit pages in whatever order they find them. With a limited request budget, order is everything — Shark-Search chases the branches that smell like your query and lets the rest decay, so 100 requests get you the 100 most useful pages, not the 100 closest to the seed.

from bytecrawl import SharkSearch

result = SharkSearch(query="vector databases").crawl(
    "https://example.com", max_pages=100)

for page in result.top(10):
    print(f'{page["relevance"]:.3f}  {page["url"]}')
  • BFS — level by level, closest to the seed first.
  • Shark-Search (Hersovici et al., 1998) — topical best-first; links inherit their parent's relevance with decay.
  • OPIC (Abiteboul et al., 2003) — live PageRank via "cash" flow, no full graph needed (a pagerank() implementation is included to compare against).

Versus the alternatives: Scrapy is a framework you wire up yourself, Firecrawl is a paid SaaS — ByteCrawl is a plain library with a 3-package core and these frontier strategies built in.

Library API

from bytecrawl import Scraper

bot = Scraper()
page = bot.fetch("https://books.toscrape.com")   # auto: static, browser fallback
books = page.extract("article.product_pod",
                     {"title": "h3 a::attr(title)", "price": "p.price_color::text"})
page.markdown()   # clean Markdown for LLMs   ·   page.tokens()   # token estimate
bot.static(url)                                   # plain HTML
bot.api(url, params={...})                        # hidden JSON API
bot.browser(url, wait="div.results")              # JS via Playwright
bot.crawl(url, item="article", fields={...},
          next_page="li.next a::attr(href)")      # pagination
bot.session().login(url, data, csrf_field="csrf_token")   # authenticated

Install

pip install bytecrawl            # slim core (requests + beautifulsoup4 + lxml)
pip install bytecrawl[llm]       # + Markdown for LLMs
pip install bytecrawl[browser]   # + Playwright
pip install bytecrawl[mcp]       # + local MCP server
pip install bytecrawl[all]

Learn each scraping technique

A guided walkthrough with a runnable example against a practice site: static HTML · dynamic JS · hidden APIs · pagination · login · graph crawling · Markdown for LLMs · ethics

Contributing

pip install -e ".[llm,dev,mcp]"
pytest              # 109 tests, no network required
pytest -m live      # + live browser tests (needs the browser extra)
ruff check bytecrawl tests

Scrape responsibly: respect robots.txt, terms of service and rate limits. ByteCrawl ships with a configurable delay between requests.

License

MIT — see LICENSE.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

bytecrawl-1.0.0.tar.gz (29.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

bytecrawl-1.0.0-py3-none-any.whl (20.5 kB view details)

Uploaded Python 3

File details

Details for the file bytecrawl-1.0.0.tar.gz.

File metadata

  • Download URL: bytecrawl-1.0.0.tar.gz
  • Upload date:
  • Size: 29.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.14.7

File hashes

Hashes for bytecrawl-1.0.0.tar.gz
Algorithm Hash digest
SHA256 6bad9ca019855a9ca56011f6a97d82e1ee9f7c8b210ac38ade0f5e4b29b12b03
MD5 94c59242c8b9b75bacf0da664ebaeafc
BLAKE2b-256 409293d11c0d5899fe79bb1cfbe3e381e8533c501e5cb2006c06f6a3ff2b8dfa

See more details on using hashes here.

File details

Details for the file bytecrawl-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: bytecrawl-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 20.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.14.7

File hashes

Hashes for bytecrawl-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 238ba6f015b374e04ab0be2c171921570b66e1b3e8acef5986a132aeecc2d408
MD5 f925ac943955de3a4ea9e1de2a71d862
BLAKE2b-256 15411efed745badd3c0b6f44ed86a91aab7e5a6af22d7ad1ac587daf0ab793e1

See more details on using hashes here.

Release history Release notifications | RSS feed

1.2.0

2 files

This release

1.0.0 This release

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page