DEV Community

Alex Serebriakov
Alex Serebriakov

Posted on

How to Give Your AI Agent Real Web Access (Screenshot, Scrape, Extract JSON from Any URL)

Most AI agents hallucinate when you ask them about live web content. Not because they're broken — but because they don't actually have web access. They're reasoning from training data that may be months old.

Here's how we solved this at snapapi.pics: a single API that gives agents real-time access to any webpage — screenshot, scraped text, structured JSON extraction, PDF generation, and video recording.

The problem

When your Claude Code or Cursor agent needs to:

  • Check a competitor's pricing page
  • Extract structured data from a JS-rendered site
  • Take a screenshot of a deployment for visual QA
  • Generate a PDF of a web page

...it either hallucates, asks you to do it manually, or requires a whole Playwright/Puppeteer setup just to fetch a URL.

The solution: one API call

# Screenshot any URL
curl -X POST https://api.snapapi.pics/v1/screenshot \
  -H "X-Api-Key: YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{"url": "https://example.com", "format": "png"}'
Enter fullscreen mode Exit fullscreen mode
# Scrape page content as markdown
curl -X POST https://api.snapapi.pics/v1/scrape \
  -H "X-Api-Key: YOUR_KEY" \
  -d '{"url": "https://news.ycombinator.com"}'
Enter fullscreen mode Exit fullscreen mode
# Extract structured JSON using a schema
curl -X POST https://api.snapapi.pics/v1/extract \
  -H "X-Api-Key: YOUR_KEY" \
  -d '{
    "url": "https://somesite.com/pricing",
    "schema": {
      "plan_name": "string",
      "price": "number",
      "features": "array"
    }
  }'
Enter fullscreen mode Exit fullscreen mode

Using it in Claude Code via MCP

The real unlock for agents is our MCP server. Add it once to your Claude Code or Cursor config:

{
  "mcpServers": {
    "snapapi": {
      "command": "npx",
      "args": ["snapapi-mcp"],
      "env": { "SNAPAPI_KEY": "your_key_here" }
    }
  }
}
Enter fullscreen mode Exit fullscreen mode

Now your agent can call screenshot, scrape, extract, pdf, and video as native tools — no manual fetching, no hallucinations.

Stack behind it

For those curious about the implementation: we run Node.js + TypeScript + Fastify v4, with Playwright (Chromium) for browser automation, BullMQ for job queuing, PostgreSQL + Redis for storage, and PM2 for process management. All browser jobs go async through the queue — critical for not timing out on heavy pages.

One hard-learned lesson: never process Playwright jobs synchronously in the request handler. Each browser context spikes 200-400MB. Queue them.

Free tier

200 requests/month free, no credit card. SDKs available in JavaScript, Python, Go, PHP, Swift, Kotlin.

snapapi.pics | npm: snapapi-mcp

Happy to answer questions about the architecture or the MCP integration in the comments.

Top comments (0)