Visitar URL original
feat(mrscraper): add MrScraper integration for page scraping, Google search, and account usage by riandradiva18 · Pull Request #9277 · simstudioai/sim · GitHub
Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
fix(mrscraper): route html-only scrapes through the fetch endpoint
- 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
  • Loading branch information
riandradiva18 committed Oct 21, 2026
commit 9bfec0369c8d3da21ef9fa3697ec841e7d6ccee4
38 changes: 22 additions & 16 deletions apps/docs/content/docs/integrations/mrscraper.mdx
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
---
title: MrScraper
description: Retrieve web pages, search Google, and check account usage
integration:
type: "mrscraper"
color: "#102C35"
---

import { BlockInfoCard } from "@/components/ui/block-info-card"
import { ReferenceDetails } from "@/components/ui/reference-details"

<BlockInfoCard
type="mrscraper"
color="#102C35"
/>

{/* MANUAL-CONTENT-START:intro */}
Use [MrScraper](https://mrscraper.com) to retrieve a page as HTML, Markdown, or a screenshot, search Google, and check your account's remaining tokens. Use a MrScraper block for a configured workflow step, or connect the [MrScraper MCP server](#connect-the-mcp-server) to give its tools to an Agent.
Expand All @@ -25,7 +24,6 @@ You need a [MrScraper account](https://app.mrscraper.com) and an API token for t
The API token authenticates requests. Plan tokens measure MrScraper usage; they are a separate balance. Calls use your MrScraper account's quota and limits.
{/* MANUAL-CONTENT-END */}


## Use the block [#usage-instructions]

{/* MANUAL-CONTENT-START:usage */}
Expand Down Expand Up @@ -59,10 +57,12 @@ Retrieve web pages as HTML, Markdown, or screenshots with browser rendering and

## Actions

### mrscraper_scrape
### MrScraper Scrape

Retrieve a web page as HTML, Markdown, or a screenshot with automatic browser fallback, optional real-device routing, geolocation, and retry controls.

<ReferenceDetails>

#### Input

| Parameter | Type | Required | Description |
Expand All @@ -71,14 +71,14 @@ Retrieve a web page as HTML, Markdown, or a screenshot with automatic browser fa
| `url` | string | Yes | Absolute HTTP or HTTPS URL of the page to retrieve. |
| `html` | boolean | No | Include HTML content. Defaults to true. |
| `markdown` | boolean | No | Include Markdown content. |
| `screenshot` | boolean | No | Capture a JPEG screenshot as a stored file. Always enables browser rendering. |
| `screenshot` | boolean | No | Capture a full-page screenshot as a stored file. Always enables browser rendering. |
| `browserRendering` | string | No | auto uses automatic browser fallback; true forces a browser; false disables it. |
| `super` | boolean | No | Use real-device routing independently of browser rendering. |
| `geoCode` | string | No | Proxy country code, such as US, GB, ID, or SG. Defaults to US. |
| `proxyCountry` | string | No | Compatibility country option sent as proxyCountry. |
| `timeout` | number | No | Page timeout in seconds, from 1 to 300. Defaults to 120. |
| `maxRetries` | number | No | Maximum retry count as a nonnegative integer. Zero disables retries. Defaults to 3. |
| `tokenCap` | number | No | Nonnegative retry-token budget. The initial request always runs. |
| `maxRetries` | number | No | Maximum retry count for Markdown requests. Zero disables retries. Defaults to 3. |
| `tokenCap` | number | No | Token budget, at least 1, for a Markdown request and its retries. The initial request always runs. |
| `waitForSelector` | string | No | CSS selector to wait for when browser rendering is enabled. |
| `blockResources` | boolean | No | Block images, CSS, and fonts to reduce bandwidth. |
| `homePage` | boolean | No | Visit the site root before loading the target URL. |
Expand All @@ -94,17 +94,21 @@ Retrieve a web page as HTML, Markdown, or a screenshot with automatic browser fa
| --------- | ---- | ----------- |
| `html` | string | Page HTML, when requested. |
| `markdown` | string | Page Markdown, when requested. |
| `screenshot` | file | JPEG screenshot stored in execution files. |
| `screenshot` | file | Page screenshot \(PNG or JPEG\) stored in execution files. |
| `tokenUsage` | number | Plan tokens consumed by the page request. |
| `runtime` | number | Page request runtime in seconds. |
| `retryCount` | number | Number of retries performed. |
| `targetStatusCode` | number | Target page HTTP status from x-status-code. |
| `error` | string | Page retrieval error, when reported by MrScraper. |

### mrscraper_search
</ReferenceDetails>

### MrScraper Search

Search Google from query text or a Google search URL and return organic results, search metadata, pagination, or the raw results-page HTML.

<ReferenceDetails>

#### Input

| Parameter | Type | Required | Description |
Expand Down Expand Up @@ -149,7 +153,9 @@ Search Google from query text or a Google search URL and return organic results,
| ↳ `link` | string | Google result-page URL. |
| `tokenUsage` | number | Plan tokens consumed by the search request. |

### mrscraper_get_account
</ReferenceDetails>

### MrScraper Get Account

Check account identity, subscription status, token usage, remaining quota, and rate limits.

Expand Down Expand Up @@ -183,17 +189,17 @@ Check account identity, subscription status, token usage, remaining quota, and r

The action tables above describe Sim's outputs. For scraping, `html` and `markdown` contain the requested page content. When requested, `screenshot` is a stored file that you can pass to a later file-compatible block. Request it only when you need an image; screenshots can be large.

Check `targetStatusCode`, `error`, and the returned content before processing a scrape. The target page can return an error or a challenge page even when MrScraper accepted the request. `tokenUsage`, `runtime`, and `retryCount` help explain how the request completed. Format and site behavior determine which content fields are populated.
Check `targetStatusCode`, `error`, and the returned content before processing a scrape. The target page can return an error or a challenge page even when MrScraper accepted the request. `tokenUsage`, `runtime`, and `retryCount` help explain how the request completed. An HTML-only request uses MrScraper's fetch endpoint, which reports `tokenUsage` but leaves `runtime`, `retryCount`, and `targetStatusCode` empty; enable Markdown to get all of them.

For JSON search results, use `searchResults` for organic results, `general` for query metadata, and `pagination` for available result pages. An empty results array is a valid outcome. For HTML search, use the `html` output. These are search results, not a guarantee that each linked page is accessible.

The account action returns a selected summary. API tokens and billing identifiers from the provider's account record are excluded.

## Control time and token usage

Scrape `timeout` is a page-loading timeout in seconds, from `1` to `300`, with a default of `120`. It is separate from workflow execution limits. `maxRetries` defaults to `3`; set it to `0` to disable retries.
Scrape `timeout` is a page-loading timeout in seconds, from `1` to `300`, with a default of `120`. It is separate from workflow execution limits. `maxRetries` and `tokenCap` apply to Markdown requests; the HTML-only fetch endpoint retries on its own. `maxRetries` defaults to `3`; set it to `0` to disable retries.

`tokenCap` stops further retries when the running token total reaches the cap. The first attempt still runs even if it exceeds the cap, so this setting does not guarantee a maximum charge. Web fetching uses runtime and bandwidth: one plan token per 30 seconds and one per 0.25 MB, rounded up for each component. See MrScraper's [Token Plan](https://docs.mrscraper.com/docs/getting-started/api-token) for the maintained calculation.
`tokenCap` must be at least `1` and stops further retries when the running token total reaches the cap. The first attempt still runs even if it exceeds the cap, so this setting does not guarantee a maximum charge. Web fetching uses runtime and bandwidth: one plan token per 30 seconds and one per 0.25 MB, rounded up for each component. See MrScraper's [Token Plan](https://docs.mrscraper.com/docs/getting-started/api-token) for the maintained calculation.

The combined API response must fit Sim's 10 MiB tool response limit, including the screenshot's base64 representation before it is stored as a file. If the response is too large, request fewer formats or omit the screenshot.

Expand Down
41 changes: 26 additions & 15 deletions apps/sim/blocks/blocks/mrscraper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,21 +67,21 @@ export const MrScraperBlock: BlockConfig = {
id: 'html',
title: 'Include HTML',
type: 'switch',
value: () => true,
defaultValue: true,
condition: { field: 'operation', value: 'scrape' },
},
{
id: 'markdown',
title: 'Include Markdown',
type: 'switch',
value: () => false,
defaultValue: false,
condition: { field: 'operation', value: 'scrape' },
},
{
id: 'screenshot',
title: 'Capture Screenshot',
type: 'switch',
value: () => false,
defaultValue: false,
condition: { field: 'operation', value: 'scrape' },
},
{
Expand Down Expand Up @@ -112,7 +112,7 @@ export const MrScraperBlock: BlockConfig = {
id: 'super',
title: 'Real Device Routing',
type: 'switch',
value: () => false,
defaultValue: false,
condition: { field: 'operation', value: 'scrape' },
mode: 'advanced',
},
Expand Down Expand Up @@ -144,15 +144,15 @@ export const MrScraperBlock: BlockConfig = {
id: 'blockResources',
title: 'Block Images, CSS, and Fonts',
type: 'switch',
value: () => false,
defaultValue: false,
condition: { field: 'operation', value: 'scrape' },
mode: 'advanced',
},
{
id: 'homePage',
title: 'Visit Homepage First',
type: 'switch',
value: () => false,
defaultValue: false,
condition: { field: 'operation', value: 'scrape' },
mode: 'advanced',
},
Expand All @@ -161,22 +161,30 @@ export const MrScraperBlock: BlockConfig = {
title: 'Maximum Retries',
type: 'short-input',
placeholder: 'Defaults to 3 (0 disables retries)',
condition: { field: 'operation', value: 'scrape' },
condition: {
field: 'operation',
value: 'scrape',
and: { field: 'markdown', value: true },
},
mode: 'advanced',
},
{
id: 'tokenCap',
title: 'Retry Token Budget',
type: 'short-input',
placeholder: 'Enter a nonnegative token budget',
condition: { field: 'operation', value: 'scrape' },
placeholder: 'Enter a token budget of at least 1',
condition: {
field: 'operation',
value: 'scrape',
and: { field: 'markdown', value: true },
},
mode: 'advanced',
},
{
id: 'useProxy',
title: 'Use Proxy',
type: 'switch',
value: () => true,
defaultValue: true,
condition: { field: 'operation', value: 'scrape' },
mode: 'advanced',
},
Expand All @@ -201,7 +209,7 @@ export const MrScraperBlock: BlockConfig = {
id: 'bypassProxy',
title: 'Bypass Proxy for Resources',
type: 'switch',
value: () => false,
defaultValue: false,
condition: { field: 'operation', value: 'scrape' },
mode: 'advanced',
},
Expand Down Expand Up @@ -250,7 +258,7 @@ export const MrScraperBlock: BlockConfig = {
id: 'renderJs',
title: 'Render Search JavaScript',
type: 'switch',
value: () => false,
defaultValue: false,
condition: { field: 'operation', value: 'search' },
mode: 'advanced',
},
Expand Down Expand Up @@ -285,8 +293,11 @@ export const MrScraperBlock: BlockConfig = {
waitForSelector: { type: 'string', description: 'CSS selector to wait for' },
blockResources: { type: 'boolean', description: 'Block images, CSS, and fonts' },
homePage: { type: 'boolean', description: 'Visit the homepage before the target page' },
maxRetries: { type: 'number', description: 'Maximum retry count (default 3)' },
tokenCap: { type: 'number', description: 'Nonnegative retry token budget' },
maxRetries: {
type: 'number',
description: 'Maximum retries for Markdown requests (default 3)',
},
tokenCap: { type: 'number', description: 'Token budget for Markdown requests (at least 1)' },
useProxy: { type: 'boolean', description: 'Allow configured proxies (default true)' },
proxy: { type: 'string', description: 'Custom proxy in username:password@host:port form' },
proxyCountry: { type: 'string', description: 'Compatibility proxy country code' },
Expand All @@ -302,7 +313,7 @@ export const MrScraperBlock: BlockConfig = {
outputs: {
html: { type: 'string', description: 'Page HTML or raw Google results HTML' },
markdown: { type: 'string', description: 'Page Markdown when requested' },
screenshot: { type: 'file', description: 'Screenshot stored as a JPEG file when requested' },
screenshot: { type: 'file', description: 'Page screenshot file (PNG or JPEG) when requested' },
tokenUsage: { type: 'number', description: 'Tokens used by the request or account' },
runtime: { type: 'number', description: 'Page retrieval runtime reported by MrScraper' },
retryCount: { type: 'number', description: 'Page retrieval retry count' },
Expand Down
1 change: 1 addition & 0 deletions apps/sim/lib/block-metadata/names.generated.ts
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,7 @@ export const BLOCK_NAMES: Readonly<Record<string, string>> = {
monday: 'Monday',
mongodb: 'MongoDB',
mothership: 'Sim Chat',
mrscraper: 'MrScraper',
mssql: 'Microsoft SQL Server',
mysql: 'MySQL',
neo4j: 'Neo4j',
Expand Down
1 change: 1 addition & 0 deletions apps/sim/lib/mothership/generated/docs-manifest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,7 @@ export const DOCS_MANIFEST: readonly string[] = [
'integrations/monday-service-account.mdx',
'integrations/monday.mdx',
'integrations/mongodb.mdx',
'integrations/mrscraper.mdx',
'integrations/mssql.mdx',
'integrations/mysql.mdx',
'integrations/neo4j.mdx',
Expand Down
2 changes: 1 addition & 1 deletion apps/sim/tools/generated/tool-ids.ts

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion apps/sim/tools/generated/tool-metadata.ts

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion apps/sim/tools/generated/tool-outputs.ts

Large diffs are not rendered by default.

Loading