silkworm-mcp
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@silkworm-mcp fetch https://news.ycombinator.com and extract all story titles using CSS selector .titleline > a"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
silkworm-mcp
This is a full-featured MCP server for building scrapers with:
silkworm-rs: async crawling, fetching, follow links, and spider execution
scraper-rs: fast Rust-backed HTML parsing with CSS and XPath selectors
It is designed for LLM-assisted scraper development, so the server exposes both low-level page inspection tools and higher-level workflow helpers for validating selector plans and generating starter spider code.
An example: https://github.com/BitingSnakes/silkworm-example
Features
Fetch pages through silkworm's regular HTTP client or CDP renderer.
Query selectors directly against a CDP-rendered DOM snapshot.
Analyze inline and linked CSS with
tinycss2, then optionally map selectors back onto HTML.Extract structured records from live rendered pages before committing to a full crawl.
Cache HTML in a local document store and reuse it via
document_handle.Bound the document cache with max-document, max-bytes, and idle-TTL controls.
Inspect pages with summaries, parsed DOM trees, prettified HTML, CSS/XPath queries, selector comparisons, and link extraction.
Run ad hoc crawls from a structured
CrawlBlueprint.Generate reusable silkworm spider templates from the same blueprint and statically validate them, including pattern-specific variants for list-only, list+detail, sitemap/XML, and CDP-heavy crawls.
Expose MCP diagnostics plus HTTP
/healthzand/readyzroutes for production monitoring.Publish MCP resources and prompts so clients can discover workflows, Silkworm idioms, and blueprint schemas.
Related MCP server: Selenium MCP Server
Tools
store_html_documentlist_documentsdelete_documentclear_documentsserver_statusinspect_documentparse_html_documentparse_html_fragmentprettify_documentquery_selectoranalyze_css_selectorsfind_selectors_by_textcompare_selectorsextract_linkssilkworm_fetchsilkworm_fetch_cdpquery_selector_cdpextract_structured_data_cdprun_crawl_blueprintgenerate_spider_templatevalidate_spider_code
Run
Install dependencies:
uv syncRun over stdio for a desktop MCP client:
uv run python mcp_server.py --transport stdioRun over HTTP:
uv run python mcp_server.py --transport http --host 127.0.0.1 --port 8000HTTP deployments also expose:
GET /healthz: process livenessGET /readyz: readiness, optionally including a CDP browser probe
The project also exposes a console entrypoint:
uv run silkworm-mcp --transport stdioDocker
Build the image:
docker build -t silkworm-mcp .Run the container over HTTP on port 8000:
docker run --rm -it -p 8000:8000 silkworm-mcpThe container entrypoint starts two processes by default:
the MCP server over HTTP on
0.0.0.0:8000a bundled Lightpanda browser on
127.0.0.1:9222for CDP-backed tools such assilkworm_fetch_cdp,query_selector_cdp, andextract_structured_data_cdp
Useful container environment variables:
MCP_TRANSPORT(default:http)MCP_HOST(default:0.0.0.0)MCP_PORT(default:8000)MCP_PATHLIGHTPANDA_ENABLED(default:1)LIGHTPANDA_HOST(default:127.0.0.1)LIGHTPANDA_PORT(default:9222)LIGHTPANDA_ADVERTISE_HOST(default: unset, falls back toLIGHTPANDA_HOST)LIGHTPANDA_LOG_FORMAT(default:pretty)LIGHTPANDA_LOG_LEVEL(default:info)
When Lightpanda binds to 0.0.0.0 inside a container, set LIGHTPANDA_ADVERTISE_HOST to a reachable hostname such as the container DNS name. Otherwise /json/version can advertise ws://0.0.0.0:9222/, which remote CDP clients cannot use.
Example with custom document-cache limits:
docker run --rm -it \
-p 8000:8000 \
-e SILKWORM_MCP_DOCUMENT_MAX_COUNT=256 \
-e SILKWORM_MCP_DOCUMENT_MAX_TOTAL_BYTES=64000000 \
-e SILKWORM_MCP_DOCUMENT_TTL_SECONDS=7200 \
silkworm-mcpFor local development, compose.yml provides the same setup with health checks and restart policy:
docker compose up --buildThen verify the container is ready:
curl http://127.0.0.1:8000/readyzKey runtime environment variables:
SILKWORM_MCP_DOCUMENT_MAX_COUNTSILKWORM_MCP_DOCUMENT_MAX_TOTAL_BYTESSILKWORM_MCP_DOCUMENT_TTL_SECONDSSILKWORM_MCP_DOCUMENT_STORE_PATHSILKWORM_MCP_LOG_LEVELSILKWORM_MCP_READINESS_REQUIRE_CDPSILKWORM_MCP_READINESS_CDP_WS_ENDPOINT
Example Workflow
Call
silkworm_fetchfor the target page.Use the returned
document_handlewithinspect_document.Use
parse_html_documentorparse_html_fragmentwhen you need exact parser structure, node types, or parser errors.Use
find_selectors_by_textto derive candidates from visible text, then iterate onquery_selector,compare_selectors, andanalyze_css_selectorswhen stylesheet structure or hidden elements matter.For JS-heavy pages, use
query_selector_cdporextract_structured_data_cdpagainst the rendered DOM.Use
extract_linksto verify pagination or detail pages.Feed the stable plan into
run_crawl_blueprint.Convert the same blueprint into code with
generate_spider_template, then check it withvalidate_spider_code.
Useful built-in MCP references:
silkworm://reference/overviewsilkworm://reference/silkworm-cheatsheetsilkworm://reference/silkworm-playbooksilkworm://reference/template-variantssilkworm://reference/scraper-rs-cheatsheetsilkworm://reference/crawl-blueprint-schema
Use transport: "cdp" when pages require JavaScript rendering. run_crawl_blueprint will connect to the configured CDP endpoint, and generate_spider_template will emit a starter spider that runs through CDPClient instead of the default HTTP client.
Both run_crawl_blueprint and generate_spider_template accept a variant override. When omitted, they infer a crawl style from the blueprint:
list_only: listing pages emit items directly, with optional paginationlist_detail: listing pages schedule detail requests and a separateparse_detailsitemap_xml: sitemap/XML entrypoints are fetched withmeta={"allow_non_html": True}and parsed before scheduling page requestscdp_heavy: rendered-page crawls keep the CDP execution path and a general-purpose parse/follow flow
run_crawl_blueprint returns the resolved execution_variant, and generate_spider_template returns the resolved template_variant, so clients can see which crawl shape was actually used.
Testing
Run the automated test suite with:
just testAcknowledgement
This project builds on the excellent work behind FastMCP, silkworm-rs, and scraper-rs. Together they provide the MCP server framework, crawling runtime, and HTML parsing foundations that make this project possible.
Available Tools
22 toolsanalyze_css_selectorsC
Parse inline, linked, or raw CSS with tinycss2 and optionally match selectors back onto HTML.
Inputs: css, html, limit, html_chars, +13 more. Returns: warnings, selectors, source_url, stylesheets, +7 more
clear_documentsA
Clear every cached document from the in-memory store.
Inputs: no named parameters. Returns: deleted_count
compare_selectorsB
Compare multiple selectors against the same document to see which one is the most stable.
Inputs: selectors (required), html, mode, html_chars, +7 more. Returns: mode, source_url, comparisons, document_handle
delete_documentC
Delete a cached document handle.
Inputs: handle (required). Returns: handle, deleted
extract_linksC
Extract and absolutize link-like attributes from matching elements.
Inputs: html, mode, limit, query, +5 more. Returns: mode, links, query, attribute, +3 more
extract_structured_data_cdpC
Fetch a rendered page through CDP and extract structured records from the rendered DOM.
Inputs: url (required), fields (required), label, headers, +9 more. Returns: url, via, items, status, +9 more
find_selectors_by_textC
Find CSS/XPath selector candidates for the smallest matching elements by text.
Inputs: text_query (required), html, limit, match_type, +6 more. Returns: matches, match_type, source_url, text_query, +5 more
generate_regexC
Generate a regular expression from sample strings using grex.
Inputs: test_cases (required), verbose_mode, convert_words, convert_digits, +8 more. Returns: pattern, test_cases, verbose_mode, convert_words, +9 more
generate_spider_templateC
Generate a production starter spider that mirrors the crawl blueprint.
Inputs: blueprint (required), variant, class_name. Returns: code, class_name, spider_name, template_variant
inspect_documentC
Build a high-level summary for stored HTML or an inline HTML snippet.
Inputs: html, source_url, max_size_bytes, document_handle, +1 more. Returns: label, title, handle, status, +9 more
list_documentsA
List cached documents that can be reused by handle in later tool calls.
Inputs: no named parameters. Returns: Generic wrapper for non-object return types.
parse_html_documentC
Parse a full HTML document into a structured node tree using scraper_rs.parse_document.
Inputs: html, source_url, max_size_bytes, document_handle, +1 more. Returns: root, parse_mode, source_url, max_size_bytes, +2 more
parse_html_fragmentC
Parse an HTML fragment into a structured node tree using scraper_rs.parse_fragment.
Inputs: html, source_url, max_size_bytes, document_handle, +1 more. Returns: root, parse_mode, source_url, max_size_bytes, +2 more
prettify_documentC
Return prettified HTML for visual inspection.
Inputs: html, max_size_bytes, document_handle, max_output_chars, +1 more. Returns: source_url, output_chars, document_handle, prettified_html, +1 more
query_selectorC
Run a CSS or XPath query with scraper_rs and return structured match previews.
Inputs: query (required), html, mode, limit, +7 more. Returns: mode, query, matches, source_url, +4 more
query_selector_cdpA
Fetch a rendered page through CDP, then run a CSS or XPath query on the live DOM snapshot.
Inputs: url (required), query (required), mode, label, +10 more. Returns: mode, query, matches, source_url, +4 more
run_crawl_blueprintB
Run a configurable silkworm spider without writing code, useful for validating a scraping plan.
Inputs: blueprint (required), variant. Returns: items, max_items, spider_name, max_requests, +3 more
server_statusB
Return runtime status, cache metrics, and optional CDP readiness information.
Inputs: probe_cdp, include_documents. Returns: health, documents, server_name, configuration, +4 more
silkworm_fetchB
Fetch a page through silkworm's HttpClient and optionally cache the HTML for later selector work.
Inputs: url (required), label, method, params, +8 more. Returns: url, via, method, status, +8 more
silkworm_fetch_cdpB
Fetch rendered HTML through silkworm's CDP client for JavaScript-heavy pages.
Inputs: url (required), label, headers, ws_endpoint, +3 more. Returns: url, via, method, status, +8 more
store_html_documentC
Store raw HTML in the server's in-memory document cache and return a scraper_rs summary.
Inputs: html (required), label, source_url, max_size_bytes, +1 more. Returns: label, title, handle, status, +9 more
validate_spider_codeB
Statically validate generated spider code for syntax and common silkworm/CDP wiring.
Inputs: code (required), expected_class_name. Returns: issues, syntax_ok, spider_classes, uses_cdp_client, +3 more
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 22 tools
Most tools have clear, distinct purposes, and the _cdp suffix separates rendered from static operations. However, the cluster of selector-related tools (query_selector, compare_selectors, analyze_css_selectors, find_selectors_by_text) and overlapping inspection tools (inspect_document, prettify_document, parse_html_document) could cause some misselection without careful reading.
Tool names largely follow a verb_noun snake_case pattern (e.g., store_html_document, list_documents, parse_html_fragment). Minor inconsistencies like server_status (noun-first) and the silkworm_ prefix on some fetch tools break the strict pattern but remain readable and predictable.
At 22 tools, this is on the heavy side but justified by the broad scope of a web scraping framework covering fetching, caching, parsing, selector analysis, and code generation. The count is manageable, but agents may need to scan many options before choosing.
The toolset covers the full scraping lifecycle from fetching (normal and CDP) to caching, parsing, selector analysis, structured extraction, and spider validation/generation. Minor gaps exist, such as no explicit export/save tool for extracted data and no update operation for cached documents, but these are workable.
Maintenance
Related MCP Connectors
Web scraping MCP server — scrape, extract structured data, screenshot any site with anti-bot bypass.
One MCP server for all web data. Scrape, search, crawl, and AI research in one install.
Programmatic web-scraping MCP server powered by x402 micro-transactions on Base.
Web scraping MCP server: any URL to Markdown or JSON, with JavaScript rendering and batch jobs.
Related MCP Servers
- AlicenseAqualityDmaintenanceA headless web-scraping MCP server built on Scrapy, providing tools for polite fetching, CSS/XPath extraction, link/table extraction, sitemap and robots.txt reading, and bounded asynchronous crawls.10MIT
- FlicenseNot gradedqualityDmaintenanceMCP server for crawling and extracting data from web pages using Selenium with CSS/XPath selectors. Supports 17 tools including smart extraction, pagination, infinite scroll, and screenshots.3-
- AlicenseNot gradedqualityDmaintenanceA comprehensive web scraping MCP server with 26 tools for fetching, parsing, extracting, and assisting with web content, returning Markdown-formatted results.MIT
- FlicenseNot gradedqualityDmaintenancePython MCP server that scrapes web pages with JS rendering, structured metadata, tables, PDFs, screenshots, and multi-page crawling.-