feat(mrscraper): add MrScraper integration for page scraping, Google search, and account usage by riandradiva18 · Pull Request #9277 · simstudioai/sim · GitHub
Skip to content

feat(mrscraper): add MrScraper integration for page scraping, Google search, and account usage - #9277

Open
riandradiva18 wants to merge 2 commits into
simstudioai:stagingfrom
mrscraper-com:feat/mrscraper-integration
Open

riandradiva18 wants to merge 2 commits into
simstudioai:stagingfrom
mrscraper-com:feat/mrscraper-integration

Conversation

@riandradiva18

Copy link
Copy Markdown

Summary

Adds a MrScraper block with three operations:

  • Scrape Page: fetch a URL as HTML, Markdown, and/or a screenshot. Supports browser rendering (auto/on/off), real-device routing, proxy country, wait-for-selector, resource blocking, and retry/token-cap controls.
  • Google Search: search by query text or a pasted Google search URL (q, gl, hl, start are picked up). Returns organic results, search metadata, and pagination, or the raw results page HTML.
  • Get Account: subscription status, token usage/limit/remaining, and rate limit.

Also includes the icon, docs page, registry entries, and regenerated tool metadata, integration catalog, deployment config, and block names.

Some MrScraper API behavior that shaped the scrape tool:

  • HTML-only requests go to the fetch endpoint as a GET with the target URL in the query. That endpoint replays the incoming method against the target site, so a POST fails on sites that reject it (books.toscrape.com answers 405). Markdown requests go to the browser scraper as a POST with a JSON body.
  • The fetch endpoint returns raw text/html and reports token_usage in a response header; the browser scraper returns JSON. The transform handles both and reads metrics from headers as a fallback.
  • Screenshots come back as PNG from the fetch endpoint and JPEG from the browser scraper, so the file type comes from the base64 signature.
  • maxRetries and tokenCap only apply to the browser scraper, so those fields only show when Markdown is on.
  • The API key is sent in headers only, never in the query string.
  • The SERP endpoint reports current_page: 1 for every page, so the tool reports the page that was requested instead.

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation
  • Other: ___________

Testing

Ran every operation against the live MrScraper API with a real key. Each call went through the tool's own request builder (via prepareToolRequest) and transformResponse, with block defaults mapped through the block's tools.config.params. All 11 live calls passed, and calls with an invalid key fail with a 401 as expected. The full results and sample responses are in the comment below.

Locally: bun run lint, bun run type-check, bun run check:audits, and check-block-registry.ts against staging.

I didn't add unit tests. Following the repo's testing guidance, I tested against the real API instead.

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

- send HTML-only and screenshot-only scrapes as GET with the target URL in
  the query; the fetch endpoint replays the request method, so a POST fails
  on sites that reject it
- read raw text/html responses and take token usage from response headers
- send screenshot=full and detect PNG vs JPEG from the returned image
- keep the API key out of the query string
- report the requested search page; the SERP API returns current_page 1
  for every page
- show retry and token-cap fields only for Markdown requests
- use defaultValue for switch defaults
- regenerate the integration catalog, tool metadata, block names, and docs
  manifest
@riandradiva18

Copy link
Copy Markdown
Author

@vercel

vercel Bot commented Oct 21, 2026

Copy link
Copy Markdown

@riandradiva18 is attempting to deploy a commit to the Sim Team on Vercel.

A member of the Team first needs to authorize it.

@greptile-apps

greptile-apps Bot commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 4/5

[Medium impact] The PR adds a new, bounded web-scraping and search workflow integration.

The PR appears safe to merge, with a non-blocking fix needed for searches containing ordinary URLs.

Findings

  1. P2 Literal URL searches fail ▶

Summary

Adds MrScraper tools for page retrieval, Google search, and account usage.

  • MrScraper retrieves web pages as HTML, Markdown, or screenshots.
  • MrScraper turns Google queries into results or page HTML.
  • MrScraper reports account usage and subscription details.
  • Workflow builders can set up MrScraper from a registered block.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A[MrScraper block or agent] --> B{Operation}
  B -->|Scrape| C{Markdown requested?}
  C -->|No| D[GET fetch request]
  C -->|Yes| E[POST browser request]
  D --> F[Transform page response]
  E --> F
  F --> G[Store screenshot when present]
  B -->|Search| H[POST Google search]
  H --> I[Map results and pagination]
  B -->|Get Account| J[GET account summary]
Loading

Reviews (1) · Last reviewed commit: "fix(mrscraper): route html-only scrapes ..." · Reviewed by Greptile

Comment on lines +24 to +27

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Literal URL searches fail

This branch treats every HTTP URL as a Google search URL. Searching for https://example.com throws because it has no q parameter. A non-Google URL containing q instead searches for that parameter and drops the supplied URL. Only extract parameters from Google search URLs; pass other URLs through as query text.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant