Silkworm
FreeNot checkedA full-featured MCP server for building scrapers, with tools for page fetching, HTML parsing, CSS/XPath querying, and spider generation using silkworm-rs and sc
About
A full-featured MCP server for building scrapers, with tools for page fetching, HTML parsing, CSS/XPath querying, and spider generation using silkworm-rs and scraper-rs.
README
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.
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 sync
Run over stdio for a desktop MCP client:
uv run python mcp_server.py --transport stdio
Run over HTTP:
uv run python mcp_server.py --transport http --host 127.0.0.1 --port 8000
HTTP 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 stdio
Docker
Build the image:
docker build -t silkworm-mcp .
Run the container over HTTP on port 8000:
docker run --rm -it -p 8000:8000 silkworm-mcp
The container entrypoint starts two processes by default:
- the MCP server over HTTP on
0.0.0.0:8000 - a 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-mcp
For local development, compose.yml provides the same setup with health checks and restart policy:
docker compose up --build
Then verify the container is ready:
curl http://127.0.0.1:8000/readyz
Key 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 test
Acknowledgement
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.
Install Silkworm in Claude Desktop, Claude Code & Cursor
unyly install silkworm-mcpInstalls into Claude Desktop, Claude Code, Cursor & VS Code — handles npx, uvx and build-from-source repos for you.
First time? Get the CLI: curl -fsSL https://unyly.org/install | sh
Or configure manually
Run in your terminal:
claude mcp add silkworm-mcp -- uvx --from git+https://github.com/BitingSnakes/silkworm-mcp silkworm-mcpFAQ
Is Silkworm MCP free?
Yes, Silkworm MCP is free — one-click install via Unyly at no cost.
Does Silkworm need an API key?
No, Silkworm runs without API keys or environment variables.
Is Silkworm hosted or self-hosted?
A hosted option is available: Unyly runs the server in the cloud, no local setup required.
How do I install Silkworm in Claude Desktop, Claude Code or Cursor?
Open Silkworm on unyly.org, pick your client tab (Claude Desktop, Claude Code, Cursor) and press Install — the config is generated automatically, no JSON editing.
Related MCPs
GitHub
PRs, issues, code search, CI status
by GitHubFilesystem
Secure file operations with configurable access controls.
Memory
Knowledge graph-based persistent memory system.
Template MCP Server
A CLI tool to create a new Model Context Protocol server project with TypeScript support, dual transport options, and an extensible structure
by mcpdotdirectCompare Silkworm with
Not sure what to pick?
Find your stack in 60 seconds
Author?
Embed badge for your README
Browse similar
All development MCPs
