Expose crawler_config on all MCP scrape tools#1965
Open
SohamKukreti wants to merge 1 commit into
Open
Conversation
MCP tools (md, html, screenshot, pdf, execute_js) hardcoded
CrawlerRunConfig() with no user input, so wait_until,
delay_before_return_html, cache_mode, and all other
CrawlerRunConfig fields were silently ignored. /crawl already
had full passthrough; this brings the remaining tools to parity.
- schemas.py: add crawler_config: Optional[Dict] to all five
request schemas so mcp_bridge.py exposes the field in MCP
tool inputSchemas automatically
- server.py: handlers now load via CrawlerRunConfig.load() then
stamp endpoint-required fields on top (screenshot, pdf, js_code);
fix screenshot_wait_for/wait_for_images defaults from 2/False to
None so they only override crawler_config when explicitly passed
- api.py: handle_markdown_request accepts crawler_config kwarg;
cache_mode precedence uses key-presence check instead of falsy
check so crawler_config.cache_mode correctly wins over legacy c
Tests: tests/mcp/test_mcp_crawler_config.py — 7 MCP SSE tests
proving delay_before_return_html is honoured server-side on all tools
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
MCP tools (md, html, screenshot, pdf, execute_js) hardcoded
CrawlerRunConfig()with no user input, sowait_until,delay_before_return_html,cache_mode, and all otherCrawlerRunConfigfields were silently ignored. /crawl already had full passthrough; this brings the remaining tools to parity.Addresses #1963
List of files changed and why
crawler_config: Optional[Dict]to all five request schemas so mcp_bridge.py exposes the field in MCP tool inputSchemas automaticallyCrawlerRunConfig.load()then stamp endpoint-required fields on top (screenshot, pdf, js_code); fixscreenshot_wait_for/wait_for_imagesdefaults from 2/False to None so they only override crawler_config when explicitly passedhandle_markdown_requestaccepts crawler_config kwarg;cache_modeprecedence uses key-presence check instead of falsy check so crawler_config.cache_mode correctly wins over legacy cdelay_before_return_htmlis honoured server-side on all toolsHow Has This Been Tested?
Ran tests in tests/mcp/ folder and docker tests to verify none of the existing functionality broke.
Created new tests to verify crawler config is respected when passed via MCP
Checklist: