ScrapeMCP — Web Scraping MCP Server
Servidor MCP para extracción estructurada de datos web. Scrapea páginas, tablas, listas, sitemaps y más. Incluye protección SSRF integrada.
Features / Funcionalidades
| Tool / Herramienta | Description / Descripción |
|---|---|
scrape |
Extrae contenido de una URL usando selectores CSS personalizados |
inspect |
Analiza la estructura de una página (meta tags, headings, links, images, forms, scripts) |
tables |
Extrae todas las tablas HTML de una página |
scrape_list |
Extrae una lista de items con campos personalizados desde selectores CSS |
scrape_recursive |
Navega páginas enlazadas recursivamente extrayendo datos |
sitemap |
Parsea el sitemap.xml de un sitio web |
scrape_sitemap |
Scrapea todas las URLs de un sitemap |
export |
Exporta datos a CSV, Markdown o JSON |
SSRF Protection / Protección SSRF
El servidor bloquea automáticamente accesos a:
- IPs privadas (
10.0.0.0/8,172.16.0.0/12,192.168.0.0/16) - Localhost/loopback (
127.0.0.0/8,::1) - Link-local (
169.254.0.0/16,fe80::/10) - Hostnames bloqueados:
localhost,metadata.google.internal,169.254.169.254 - Dominios
.internaly.local
Solo permite esquemas http:// y https://.
Tech Stack
- Python —
>=3.11 - Framework:
mcp(FastMCP) via stdio JSON-RPC - HTTP:
httpx(async) — replaced syncrequestsfor non-blocking I/O - Parsing:
beautifulsoup4+html5lib - Export: CSV (sanitized), Markdown, JSON
- Config:
python-dotenv— reads.envfile for all settings
Quick Start
# Instalar dependencias
pip install mcp requests beautifulsoup4 html5lib httpx
# Ejecutar servidor
python server.py
Ejemplos
# Scrapear página completa
result = await session.call_tool("scrape", {"url": "https://example.com"})
# Scrapear con selectores personalizados
result = await session.call_tool("scrape", {
"url": "https://example.com",
"selectors": {"title": "h1", "price": ".price"}
})
# Inspeccionar estructura de página
result = await session.call_tool("inspect", {"url": "https://example.com"})
# Extraer tablas
result = await session.call_tool("tables", {
"url": "https://example.com",
"selector": "table"
})
# Scrapear lista
result = await session.call_tool("scrape_list", {
"url": "https://example.com/items",
"item_selector": ".item",
"fields": {"name": "h2", "price": ".price"}
})
# Scrapear recursivamente
result = await session.call_tool("scrape_recursive", {
"start_url": "https://example.com/blog",
"link_selector": "a.post-link",
"item_selector": "article",
"fields": {"title": "h1", "content": "p"},
"max_pages": 10
})
# Exportar a CSV
result = await session.call_tool("export", {
"data": '[{"name": "Alice", "age": 30}]',
"format": "csv"
})
Project Structure
scrapemcp/
├── server.py # MCP server entry point (tools)
├── scrapers/
│ ├── __init__.py
│ ├── base.py # BaseScraper, ScrapeResult, SSRF validation
│ ├── page.py # PageScraper (scrape, inspect)
│ ├── table.py # TableScraper (tables)
│ ├── list_scraper.py # ListScraper (scrape_list, scrape_recursive)
│ └── sitemap.py # SitemapScraper (sitemap, scrape_sitemap)
├── exporters.py # CSV, Markdown, JSON export
├── client.py # Test client CLI
└── pyproject.toml
🔧 Recent Improvements
- SSRF Bypass Fixed — DNS resolution added: URL-encoded private IPs are now properly blocked
- Async HTTP — Replaced sync
requestswithhttpx.AsyncClient(non-blocking, async-compatible) - State Race Fixed — Removed shared mutable
_last_url/_last_soup(no more cross-call contamination) .envSupport — ReadsHTTP_TIMEOUT,SITEMAP_URL_LIMIT,MAX_RECURSIVE_PAGESfrom environment- Sitemap Discovery — Tries
robots.txtforSitemap:before falling back to/sitemap.xml - Recursive Timeout — 120s wall-clock timeout prevents runaway crawling
- Configurable Rate Limit — Recursive crawl delay via
RECURSIVE_DELAYenv var - Export Size Limit — Rejects data > 10MB before parsing
Metadata
Release files for scrapemcp 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| scrapemcp-1.0.0.tar.gz | 12.2 kB | Without provenance | Details for scrapemcp-1.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| scrapemcp-1.0.0-py3-none-any.whl | Python 3 | none | any | Details for scrapemcp-1.0.0-py3-none-any.whl |
Total release size: 42.1 kB
Release files / scrapemcp-1.0.0.tar.gz
| Download URL | scrapemcp-1.0.0.tar.gz |
|---|---|
| Size | 12.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
bc4b11705332998d7c1030b61c7f9d203727f47446a96b9c5c14dfb7c9bd093a
|
|
BLAKE2b-256 checksum How to use checksums |
a097413a4e6fcc65408e433ae057a5a5c2b8380622231ba034de37a39ab1b556
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.4
|
Release files / scrapemcp-1.0.0-py3-none-any.whl
| Download URL | scrapemcp-1.0.0-py3-none-any.whl |
|---|---|
| Size | 29.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c5dc3cc979023aa6d0b2d7b1dc433b0493c17735fed7d0959cd282ef8330444a
|
|
BLAKE2b-256 checksum How to use checksums |
1c7f97e6c8a962af72ee73bcf6ffffc576393a0d259a5ad8d394ea84937c0eb4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.4
|
Security for scrapemcp 1.0.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.