Skip to content

Commit fa23449

Browse files
authored
Merge pull request #4 from pietz/codex/add-view_website-tool-for-screenshots-o89t0k
Add view_website screenshot tool
2 parents bbbd6a4 + 843b0d0 commit fa23449

File tree

4 files changed

+17
-3
lines changed

4 files changed

+17
-3
lines changed

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ I created this package out of the frustration that most MCP servers enabling web
1111
- [x] Extracting content in nicely formatted Markdown
1212
- [x] Support for extracting content from PDFs
1313
- [x] Support for loading and displaying images
14+
- [x] Capture rendered webpage screenshots for visual context
1415
- [x] Usage options for advanced cases like loading raw HTML
1516

1617
## Installation
@@ -49,6 +50,10 @@ The fetching of web content is based on [Zendriver](https://github.com/stephanle
4950

5051
For web extraction, we use [Trafilatura](https://trafilatura.readthedocs.io/en/latest/index.html) which consistently outperforms other alternatives for extracting content from HTML pages. For PDFs, we use [PyMuPDF4LLM](https://pymupdf.readthedocs.io/en/latest/pymupdf4llm/) which similarly extracts content in an easy-to-read format for LLMs, with advanced layout support.
5152

53+
### Screenshots
54+
55+
Rendered page previews are powered by [Zendriver](https://github.com/stephanlensky/zendriver). The `view_website` tool navigates to a URL in a headless Chromium session and returns the resulting page as a PNG screenshot. By default only the current viewport is captured, but callers can request a full-page image by setting the `full_page` argument to `true`.
56+
5257
## Contributing
5358

5459
While it's impossible to support all pages and layouts, we thrive to make this package better over time. For unsupported sites, problems, or feature requests open an issue.

mcp_web_tools/__init__.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,16 @@ async def view_website(
6565
),
6666
] = False,
6767
) -> Image:
68-
"""Render the URL with Zendriver and return a PNG screenshot of the page (full page optional)."""
68+
"""Capture a rendered screenshot of a webpage using Zendriver.
69+
70+
Args:
71+
url: The HTTP(S) URL to navigate to before taking the screenshot.
72+
full_page: When ``True`` capture the full scroll height; defaults to the
73+
currently visible viewport when ``False``.
74+
75+
Returns:
76+
A PNG ``Image`` payload that can be streamed back to the MCP client.
77+
"""
6978

7079
return await capture_webpage_screenshot(url, full_page=full_page)
7180

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "mcp-web-tools"
3-
version = "0.7.8"
3+
version = "0.7.9"
44
description = "A powerful MCP server to equip LLMs with web access, search, and content extraction capabilities"
55
readme = "README.md"
66
authors = [

uv.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)