webpage screenshot mcp

webpage screenshot mcp

Captures screenshots of web URLs or local HTML files using Playwright Chromium and exposes them as resources.

Category
Visit Server

README

Webpage Screenshot MCP

<img src="https://i.postimg.cc/LRfcTXD9/Chat-GPT-Image-Aug-2-2025-06-52-39-PM.webp" width="50%" alt="Webpage Screenshot MCP">

Capture screenshots of web URLs or local .html files using Playwright Chromium. Each capture is saved to disk and exposed as a Resource with URI scheme screenshots://{screenshotId}, that compatible MCP clients can read.

Usage & Requirements

Requirements

  • Node.js v20+
  • pnpm v10.x

Configure MCP in your IDE

Claude Code

claude mcp add webpageScreenshot pnpm dlx @srigi/mcp-webpage-screenshot

JSON configuration

Add the following configuration to your MCP settings:

{
  "mcpServers": {
    "webpageScreenshot": {
      "command": "pnpm",
      "args": ["dlx", "@srigi/mcp-webpage-screenshot"],
      "autoApprove": [
        "create_webpage_file_screenshot",
        "create_webpage_url_screenshot"
      ]
    }
  }
}

Usage examples

Prompts you can try:

Screenshot of an URL

  • Take a screenshot of https://example.com and save it as example-website.png.
  • Make another screenshot with viewport width 640 and height 1280px.

Screenshot of a local file

  • Capture a full-page screenshot of example/page.html and save it alongside.

Logging

You can configure logging by adding flags to the args array in your MCP configuration:

"webpageScreenshot": {
  "command": "pnpm",
  "args": [
    "dlx", "@srigi/mcp-webpage-screenshot",
    "--debug", "/absolute/path/to/debug.log",
    "--pretty-print"
  ]
}

Debug flags:

  • No --debug: logging disabled
  • --debug: writes to debug.log in the current working directory of the running MCP
  • --debug /absolute/path/to/debug.log: writes logs to that absolute path (absolute paths only)
  • --pretty-print: pretty formatted JSON logs

🛠️ Tools & Resources

Tool: create_webpage_file_screenshot

Create a screenshot of a local HTML file:

  • loads the local HTML via file://
  • waits for networkidle
  • captures PNG (Buffer), supports full-page height
  • saves the image to a workspace-relative path
  • adds an in-memory Resource entry and returns a screenshots:// URI

Parameters:

  • screenshotFilePath: File where to save the screenshot (relative to the current workspace)
  • webpageFilePath: HTML file path of the webpage to screenshot (relative to the current workspace)
  • workspacePath: The current workspace absolute path
  • viewport (optional):
    • width: number (default 1280)
    • height: number | "fullpage" (default 768). Use "fullpage" to capture the entire page height.

Security constraints: all paths are resolved relative to workspacePath

Tool: create_webpage_url_screenshot

Create a screenshot of a web URL:

  • validates HTTP/HTTPS URLs only (rejects file://, data://, etc.)
  • implements retry logic with progressive timeouts (5s, 9s, 15s)
  • waits for networkidle and dynamic content loading
  • applies security headers (DNT, User-Agent) and safe browser settings
  • captures PNG (Buffer), supports full-page height
  • saves the image to a workspace-relative path
  • adds an in-memory Resource entry and returns a screenshots:// URI

Parameters:

  • screenshotFilePath: File where to save the screenshot (relative to the current workspace)
  • url: URL of the webpage to screenshot (HTTP/HTTPS only)
  • workspacePath: The current workspace absolute path
  • viewport (optional):
    • width: number (default 1280)
    • height: number | "fullpage" (default 768). Use "fullpage" to capture the entire page height.

Security features: protocol validation, security headers, download blocking, CSP respect, HTTPS error handling

Resource: screenshots://{screenshotId}

Each created screenshot is added to an in-memory registry and exposed as a Resource with:

  • uri: screenshots://<screenshotId>
  • blob: data:image/png;base64,...
  • mimeType: image/png
  • text: original webpage file path or URL used for the screenshot

Note:

  • Listing resources is not implemented (list is not available).

Development

Requirements

  • Node.js v20+
  • PNPM v10

The install step will post-install Playwright Chromium, but it's not guaranteed to work. To ensure the shell browser is installed, run:

pnpm playwright install --with-deps --only-shell chromium

Steps

  1. Install dependencies:
    pnpm install
    
  2. Start the TypeScript compiler in watch mode:
    pnpm dev
    
  3. (Optional) Start the MCP Inspector:
    pnpm dev:inspector
    
  4. Update your MCP configuration for development (adjust the path to the compiled JS):
    {
      "mcpServers": {
        "webpageScreenshot": {
          "command": "node",
          "args": ["/absolute/path/to/compiled/src/index.js", "--debug", "--pretty-print"],
          "autoApprove": [
             "create_webpage_file_screenshot", "create_webpage_url_screenshot"
           ]
        }
      }
    }
    

Testing

Run tests:

pnpm test

Tests use Vitest with global logger setup in vitest.setup.ts to handle TypeScript/JavaScript module isolation.

Notes:

  • Restart the MCP in your IDE after source changes to pick up newly compiled code.

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured