LangChain tools for the MrScraper web-scraping API
Project description
langchain-mrscraper
LangChain integration package for the MrScraper SDK.
This package exposes MrScraper capabilities as LangChain tools so agents can:
- Fetch rendered HTML from protected websites
- Create AI scrapers from natural-language prompts
- Rerun AI/manual scrapers (single and bulk)
- List and fetch scraping results
Installation
pip install -U langchain-mrscraper
or:
uv add langchain-mrscraper
mrscraper-sdk is installed automatically as a dependency, so users do not need to install it separately.
Quick start
import os
from langchain_mrscraper import MrScraperToolkit
os.environ["MRSCRAPER_API_KEY"] = "your-token"
tools = MrScraperToolkit().get_tools()
Use with an agent
from langgraph.prebuilt import create_react_agent
from langchain_openai import ChatOpenAI
from langchain_mrscraper import MrScraperToolkit
tools = MrScraperToolkit(token="your-token").get_tools()
agent = create_react_agent(ChatOpenAI(model="gpt-4o-mini"), tools)
Available tools
mrscraper_fetch_htmlmrscraper_create_scrapermrscraper_rerun_ai_scrapermrscraper_bulk_rerun_ai_scrapermrscraper_rerun_manual_scrapermrscraper_bulk_rerun_manual_scrapermrscraper_get_all_resultsmrscraper_get_result_by_id
API styles
You can initialize via:
MrScraperToolkit(...).get_tools()(recommended)load_mrscraper_tools(...)convenience function- per-tool constructors with
token="..."ormrscraper_api_key="..." - environment variables
MRSCRAPER_API_KEY(preferred) orMRSCRAPER_API_TOKEN
Tools vs. loaders
This integration is intentionally tools-first. MrScraper endpoints are action-oriented
(fetch, create, rerun, list, retrieve) and best represented as BaseTool methods that
agents can call explicitly.
A document loader abstraction is usually better when the primary job is deterministic "URL -> documents" ingestion into vector stores. MrScraper can support that in a separate package later, but this package should remain focused on agent tools.
Testing
pytest tests/unit_tests -v
Integration smoke tests (real API):
MRSCRAPER_API_KEY=your-token pytest tests/integration_tests -m integration -v
Local release workflow
- Update
versioninpyproject.toml - Build:
python -m build - Upload to TestPyPI:
twine upload --repository testpypi dist/* - Verify install from TestPyPI
- Upload to PyPI:
twine upload dist/*
Docs files for LangChain PR
- Provider page:
docs/providers/mrscraper.mdx - Tool pages:
docs/tools/*.mdx(one page per tool)
These are prepared to submit to langchain-ai/docs.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file langchain_mrscraper-0.1.1.tar.gz.
File metadata
- Download URL: langchain_mrscraper-0.1.1.tar.gz
- Upload date:
- Size: 6.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.15
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
619c068f7ad87d8501671932b7bcff1d6f4ab11d09643d73779d8ac403954069
|
|
| MD5 |
bc37e3f05a3568c5906ea5f745e777b9
|
|
| BLAKE2b-256 |
c5d80eda8033060ab39f6e08338ec66a1f0bcf4c8110a17982c69f54cb08c348
|
File details
Details for the file langchain_mrscraper-0.1.1-py3-none-any.whl.
File metadata
- Download URL: langchain_mrscraper-0.1.1-py3-none-any.whl
- Upload date:
- Size: 7.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.15
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f1be2e6a2e21b714b9bbd918cabbc2c59f64d8826644f78cad5a5c6e967f4bdb
|
|
| MD5 |
617bed1280f3392208348677df133327
|
|
| BLAKE2b-256 |
4189b4569f6edaf7aa84b82e860624f027e8b6d8c8e0e99aa2f8117e5cfe7054
|