Fix #1758: Fix Screenshot MCP Tool#1765
Open
priii-25 wants to merge 1 commit intounclecode:developfrom
Open
Conversation
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
Fix Screenshot MCP Tool saving screenshots only to the Docker filesystem instead of returning PNG data, and correct screenshot encoding format from BMP to PNG.
Fixes #1758
This PR ensures that screenshots are always returned as base64-encoded PNG data in the API response, making them accessible to remote MCP clients. It also fixes an incorrect image format encoding that caused scrollable screenshots to be returned as BMP instead of the documented PNG format.
List of files changed and why
crawl4ai/async_crawler_strategy.py
take_screenshot_scrollerto save stitched screenshots in PNG format instead of BMP."BMP"was explicitly specified, causing scrollable screenshots to return BMP-encoded data instead of PNG.deploy/docker/server.py
/screenshotendpoint to always include base64-encoded screenshot data in the response.output_pathwas provided, only a filesystem path inside the Docker container was returned, which is inaccessible to MCP clients.screenshotfield.How Has This Been Tested?
test_6_multi_endpoint.py,run_security_tests.py) continue to pass without modification.mcp_bridge.py) correctly serializes the updated response using genericjson.dumps, with no dependency on specific response keys.output_path: response shape remains unchanged.output_path: response now includes additionalscreenshotfield while preserving existing behavior.Note:
No existing unit tests specifically covered:
output_pathis providedNew tests should be added in future to cover these cases.
Checklist: