Skip to content

longshot

A full page screenshot CLI for one page, a list or a whole site, on desktop and mobile, that doubles as an MCP server for coding agents.

On this page

A browser screenshot stops where your window stops. The interesting part of a landing page usually doesn’t. longshot is a full page screenshot CLI that captures one page, a hand picked list or a whole crawled site, top to bottom, on desktop and mobile. It also speaks MCP, so a coding agent can ask for the picture itself.

A full page screenshot CLI with three commands

It started on 13 June 2026 as a design document with a plain purpose: capture how sites look, for design reference, audits and redesign work. Letting AI tools pull a visual of a page was the second purpose. The code, both front doors and the tests landed the next day.

bash
longshot page <url...>   # these pages, no crawling
longshot site <url>      # crawl same-origin links, capture each
longshot mcp             # serve the same thing to an agent over stdio

Flags cover the output folder, skipping mobile, an extra settle delay and forcing a recapture. A site crawl also takes a page cap (50 by default) and a depth cap (3 by default). In page mode you can set how many captures run in parallel, three by default.

Most of the work happens before the shutter

Playwright already has a full page screenshot option. One flag, done? Not quite. A modern page is a stage set that only builds the scenery you walk past. Take the photo on arrival and you get empty boxes where lazy images were going to be.

So longshot walks the set first, and only then takes the picture.

flowchart TD
  load["Load the page"] --> html{"Is it HTML?"}
  html -->|no| skip["Record it as an error"]
  html -->|yes| quiet["Let the network go quiet, then settle"]
  quiet --> scroll["Scroll down a step"]
  scroll --> more{"Moved, with steps left?"}
  more -->|yes| scroll
  more -->|no| still["Zero animations and transitions"]
  still --> top["Return to the top"]
  top --> shot["Full page PNG"]

The waiting has limits: 30 seconds for the load event, up to 5 for the network, a 500 ms settle delay by default, then steps of at least 600 pixels with an 80 ms pause, 200 of them at most. That last limit matters. An infinite feed will happily keep producing floor under your feet, and a screenshot tool needs a way to say that’s enough page, thank you.

Mobile is a second visit, not a resize

Each device gets a fresh browser context and loads the page for itself.

SettingDesktopMobile
Viewport1440 by 900390 by 844
Touch and mobile modeoffon
User agentbrowser defaultiPhone

Why not shrink the desktop window and shoot again? Because sites decide things at load time: which markup to send, which images to fetch, whether you have a finger or a mouse. A resized desktop page can show a layout no phone ever receives.

A crawler small enough to read

Site mode needs to find pages. The frontier is a breadth first queue, and every link has to earn its place in it.

flowchart TD
  found["Link found on a rendered page"] --> room{"Room left in the crawl?"}
  room -->|no| drop["Leave it out"]
  room -->|yes| norm["Normalize the URL"]
  norm --> new{"Same origin, a page, not seen?"}
  new -->|no| drop
  new -->|yes| queue["Join the queue"]

Normalizing drops the fragment, query and credentials, lowercases the host and trims the trailing slash. “A page” means the extension isn’t an image, archive, PDF, script, stylesheet or one of their friends. Links come from anchors in the rendered page, so navigation drawn by JavaScript shows up. Each path becomes a file name: the root is home, and /about/team becomes about-team.

The folder is the database

A run leaves behind everything needed to understand it:

In the output folderHolds
desktop/ and mobile/one PNG per page
manifest.jsonURL, status, title, time, files, any error
index.htmla gallery of cards linking to the images

The manifest is also the cache. Ask for a page again and this is the whole decision:

flowchart TD
  ask["A URL is requested"] --> fresh{"Recapture forced?"}
  fresh -->|no| have{"Marked ok, with files present?"}
  have -->|yes| reuse["Reuse the images"]
  have -->|no| shoot["Capture it"]
  fresh -->|yes| shoot
  shoot --> won{"Worked?"}
  won -->|yes| ok["Record the files"]
  won -->|no| err["Record the error, carry on"]

Changed a couple of pages since the last run? Name them in page mode with the force flag and those get shot again while the other captures stay as they were. Delete a PNG and that page is captured again. A failed page shows up in the gallery as a failure and gets another try on the next run. One broken URL doesn’t get to cancel forty good ones.

No server, no database, nothing to migrate. If you want to know what happened, open the folder.

Agents get paths, not piles of pixels

An agent that edits a website should probably be allowed to look at it. The MCP side exposes three tools over the same core the CLI uses:

ToolDoesDefault viewport
snap_pageone URLdesktop
snap_pagesa list of URLsdesktop
snap_sitecrawl and captureboth

A single look defaults to one image per page, a site survey to two. Each call answers with JSON holding absolute file paths. Full page PNGs of long pages are large, and fifty of them poured into a model’s context would be a spectacular way to forget the question. The agent reads the one image it cares about.

Where do the files go? A command run by a person can sensibly write next to where they’re standing. A server spawned by an MCP client has no meaningful “here”, so the MCP default is a folder under your home directory, grouped by hostname, with an environment variable to move it.

Two designs that lost

The design note weighed two other shapes first.

DesignAppealWhy it lost
A single scriptquick to writesequential, with every concern knotted together
Crawleequeues, retries, concurrencytoo heavy for about fifty lines of crawl logic

A knotted script is exactly what you regret when you add a second front door.

What won is a small library with two thin callers: the CLI and the MCP server. Crawling, capturing, the manifest and the gallery each sit in their own module, and one orchestration layer ties them together. If you want the same idea applied to text instead of pixels, that’s sitegraf.

longshot is a v1 in TypeScript on Node 20 or later, about a thousand lines of source, built on Playwright, commander and the MCP SDK. It takes pictures of web pages, all the way down.