|
| 1 | +--- |
| 2 | +title: MrScraper |
| 3 | +description: Retrieve web pages, search Google, and check account usage |
| 4 | +--- |
| 5 | + |
| 6 | +import { BlockInfoCard } from "@/components/ui/block-info-card" |
| 7 | + |
| 8 | +<BlockInfoCard |
| 9 | + type="mrscraper" |
| 10 | + color="#102C35" |
| 11 | +/> |
| 12 | + |
| 13 | +{/* MANUAL-CONTENT-START:intro */} |
| 14 | +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. |
| 15 | + |
| 16 | +## Connect your account |
| 17 | + |
| 18 | +You need a [MrScraper account](https://app.mrscraper.com) and an API token for the native block. |
| 19 | + |
| 20 | +1. Create or copy a token from [MrScraper's API tokens page](https://app.mrscraper.com/api-tokens). |
| 21 | +2. In Sim, open **Settings → Secrets** and save the token as `MRSCRAPER_API_KEY` in a namespace available to the workflow's execution actor. See [Secrets](/platform/credentials) for access and runtime resolution. |
| 22 | +3. Add a **MrScraper** block to your workflow. Set **API Key** to `{{MRSCRAPER_API_KEY}}`. |
| 23 | +4. Select **Get Account** and run the block. Confirm that the account summary shows the expected identity and token balance before running a larger collection. |
| 24 | + |
| 25 | +The API token authenticates requests. Plan tokens measure MrScraper usage; they are a separate balance. Calls use your MrScraper account's quota and limits. |
| 26 | +{/* MANUAL-CONTENT-END */} |
| 27 | + |
| 28 | + |
| 29 | +## Use the block [#usage-instructions] |
| 30 | + |
| 31 | +{/* MANUAL-CONTENT-START:usage */} |
| 32 | +### Retrieve a page |
| 33 | + |
| 34 | +Select **Scrape Page** and enter `https://example.com` as the target URL. The default requests HTML. For text to pass into an Agent, enable Markdown and disable HTML if you do not need the markup. Connect the block's `markdown` output to the Agent's prompt or message. |
| 35 | + |
| 36 | +Keep browser rendering set to automatic for the first request. Automatic mode tries without a browser and falls back to browser rendering when needed. Enable browser rendering to force JavaScript execution, or disable it when the non-browser loader returns the content you need. A screenshot forces browser rendering. Real-device routing (`super`) is independent of this choice. |
| 37 | + |
| 38 | +For delayed content, enable browser rendering and supply a CSS selector such as `article` in `waitForSelector`. This waits for an element; it does not click buttons, fill forms, or run a browsing session. Use `homePage` when the site needs its root page visited before the target. |
| 39 | + |
| 40 | +### Find pages with Google search |
| 41 | + |
| 42 | +Select **Google Search** and enter a text query such as `site:example.com documentation`. The default `format` is `json`; use `searchResults` to pass the returned links into later scrape steps. Search results are discovery results, so retrieve the selected pages when you need their full content. |
| 43 | + |
| 44 | +You can also enter a Google search URL: |
| 45 | + |
| 46 | +```text |
| 47 | +https://www.google.com/search?q=web+scraping&gl=us&hl=en&start=20 |
| 48 | +``` |
| 49 | + |
| 50 | +This supplies the query `web scraping`, region `us`, language `en`, and page `3`. Explicit `region`, `language`, and `page` inputs override values from the URL. `page` is one based. Select `html` for the Google results page itself, and enable `renderJs` when you need JavaScript-dependent result features. |
| 51 | + |
| 52 | +### Monitor account usage |
| 53 | + |
| 54 | +**Get Account** returns subscription, token usage, remaining quota, rate limits, and account identity. It reads the account associated with the configured API key. It does not report the progress of a scrape or search request. |
| 55 | +{/* MANUAL-CONTENT-END */} |
| 56 | + |
| 57 | + |
| 58 | +Retrieve web pages as HTML, Markdown, or screenshots with browser rendering and geographic routing. Search Google for research and SEO workflows, and check your MrScraper token balance. |
| 59 | + |
| 60 | +## Actions |
| 61 | + |
| 62 | +### mrscraper_scrape |
| 63 | + |
| 64 | +Retrieve a web page as HTML, Markdown, or a screenshot with automatic browser fallback, optional real-device routing, geolocation, and retry controls. |
| 65 | + |
| 66 | +#### Input |
| 67 | + |
| 68 | +| Parameter | Type | Required | Description | |
| 69 | +| --------- | ---- | -------- | ----------- | |
| 70 | +| `apiKey` | string | Yes | MrScraper API key from https://app.mrscraper.com. | |
| 71 | +| `url` | string | Yes | Absolute HTTP or HTTPS URL of the page to retrieve. | |
| 72 | +| `html` | boolean | No | Include HTML content. Defaults to true. | |
| 73 | +| `markdown` | boolean | No | Include Markdown content. | |
| 74 | +| `screenshot` | boolean | No | Capture a JPEG screenshot as a stored file. Always enables browser rendering. | |
| 75 | +| `browserRendering` | string | No | auto uses automatic browser fallback; true forces a browser; false disables it. | |
| 76 | +| `super` | boolean | No | Use real-device routing independently of browser rendering. | |
| 77 | +| `geoCode` | string | No | Proxy country code, such as US, GB, ID, or SG. Defaults to US. | |
| 78 | +| `proxyCountry` | string | No | Compatibility country option sent as proxyCountry. | |
| 79 | +| `timeout` | number | No | Page timeout in seconds, from 1 to 300. Defaults to 120. | |
| 80 | +| `maxRetries` | number | No | Maximum retry count as a nonnegative integer. Zero disables retries. Defaults to 3. | |
| 81 | +| `tokenCap` | number | No | Nonnegative retry-token budget. The initial request always runs. | |
| 82 | +| `waitForSelector` | string | No | CSS selector to wait for when browser rendering is enabled. | |
| 83 | +| `blockResources` | boolean | No | Block images, CSS, and fonts to reduce bandwidth. | |
| 84 | +| `homePage` | boolean | No | Visit the site root before loading the target URL. | |
| 85 | +| `useProxy` | boolean | No | Allow the service to use a configured proxy. Defaults to true. | |
| 86 | +| `proxy` | string | No | Custom proxy in username:password@host:port form. | |
| 87 | +| `bypassProxy` | boolean | No | Enable the API proxy-bypass behavior. | |
| 88 | +| `cookieJar` | string | No | Cookie configuration, such as domain=example.com&country=us&max_used=100&max_age=50m. | |
| 89 | +| `headers` | json | No | Target page request headers as a JSON object with string values. | |
| 90 | + |
| 91 | +#### Output |
| 92 | + |
| 93 | +| Parameter | Type | Description | |
| 94 | +| --------- | ---- | ----------- | |
| 95 | +| `html` | string | Page HTML, when requested. | |
| 96 | +| `markdown` | string | Page Markdown, when requested. | |
| 97 | +| `screenshot` | file | JPEG screenshot stored in execution files. | |
| 98 | +| `tokenUsage` | number | Plan tokens consumed by the page request. | |
| 99 | +| `runtime` | number | Page request runtime in seconds. | |
| 100 | +| `retryCount` | number | Number of retries performed. | |
| 101 | +| `targetStatusCode` | number | Target page HTTP status from x-status-code. | |
| 102 | +| `error` | string | Page retrieval error, when reported by MrScraper. | |
| 103 | + |
| 104 | +### mrscraper_search |
| 105 | + |
| 106 | +Search Google from query text or a Google search URL and return organic results, search metadata, pagination, or the raw results-page HTML. |
| 107 | + |
| 108 | +#### Input |
| 109 | + |
| 110 | +| Parameter | Type | Required | Description | |
| 111 | +| --------- | ---- | -------- | ----------- | |
| 112 | +| `apiKey` | string | Yes | MrScraper API key from https://app.mrscraper.com. | |
| 113 | +| `query` | string | Yes | Search query or Google search URL with q, gl, hl, and start parameters. | |
| 114 | +| `format` | string | No | json returns parsed results; html returns results-page HTML. Defaults to json. | |
| 115 | +| `region` | string | No | Country code such as us, gb, or id. Overrides gl from a Google URL. | |
| 116 | +| `language` | string | No | Language code such as en, es, or id. Overrides hl from a Google URL. | |
| 117 | +| `page` | number | No | One-based result page. Overrides the page derived from a Google URL start parameter. | |
| 118 | +| `renderJs` | boolean | No | Wait for JavaScript-dependent search features such as AI Overview to load. | |
| 119 | + |
| 120 | +#### Output |
| 121 | + |
| 122 | +| Parameter | Type | Description | |
| 123 | +| --------- | ---- | ----------- | |
| 124 | +| `searchResults` | array | Organic Google results in ranking order. Empty for HTML format. | |
| 125 | +| ↳ `title` | string | Result title. | |
| 126 | +| ↳ `link` | string | Destination URL. | |
| 127 | +| ↳ `description` | string | Result description or snippet. | |
| 128 | +| ↳ `source` | string | Source name. | |
| 129 | +| ↳ `displayLink` | string | Displayed URL or breadcrumb. | |
| 130 | +| ↳ `rank` | number | Position among organic results. | |
| 131 | +| ↳ `globalRank` | number | Position among all search result features. | |
| 132 | +| `html` | string | Raw results-page HTML when format is html. | |
| 133 | +| `general` | object | Search metadata for parsed JSON results. | |
| 134 | +| ↳ `query` | string | Search query. | |
| 135 | +| ↳ `resultsCount` | number | Number of results reported by the parser. | |
| 136 | +| ↳ `searchTime` | number | Search time reported by Google in seconds. | |
| 137 | +| ↳ `language` | string | Search language. | |
| 138 | +| ↳ `location` | string | Search country. | |
| 139 | +| ↳ `pageTitle` | string | Results-page title. | |
| 140 | +| ↳ `timestamp` | string | Search response timestamp. | |
| 141 | +| `pagination` | object | Current page and links for continuing a parsed search. | |
| 142 | +| ↳ `currentPage` | number | Current result page. | |
| 143 | +| ↳ `nextPage` | number | Next result page. | |
| 144 | +| ↳ `nextPageStart` | number | Google start offset of the next page. | |
| 145 | +| ↳ `nextPageLink` | string | Google URL for the next page. | |
| 146 | +| ↳ `pages` | array | Available result pages. | |
| 147 | +| ↳ `page` | number | One-based page number. | |
| 148 | +| ↳ `start` | number | Google start offset. | |
| 149 | +| ↳ `link` | string | Google result-page URL. | |
| 150 | +| `tokenUsage` | number | Plan tokens consumed by the search request. | |
| 151 | + |
| 152 | +### mrscraper_get_account |
| 153 | + |
| 154 | +Check account identity, subscription status, token usage, remaining quota, and rate limits. |
| 155 | + |
| 156 | +#### Input |
| 157 | + |
| 158 | +| Parameter | Type | Required | Description | |
| 159 | +| --------- | ---- | -------- | ----------- | |
| 160 | +| `apiKey` | string | Yes | MrScraper API key from https://app.mrscraper.com. | |
| 161 | + |
| 162 | +#### Output |
| 163 | + |
| 164 | +| Parameter | Type | Description | |
| 165 | +| --------- | ---- | ----------- | |
| 166 | +| `subscriptionStatus` | string | Current subscription status. | |
| 167 | +| `enterprise` | boolean | Whether the account has an enterprise plan. | |
| 168 | +| `tokenUsage` | number | Plan tokens already consumed. | |
| 169 | +| `tokenLimit` | number | Plan token allowance. | |
| 170 | +| `tokenRemaining` | number | Remaining plan tokens, clamped to zero. | |
| 171 | +| `usagePercent` | number | Percentage of the token allowance consumed. | |
| 172 | +| `rateLimit` | number | Account request rate limit. | |
| 173 | +| `rateTtl` | number | Rate-limit window reported by the service. | |
| 174 | +| `autoRenew` | boolean | Whether the subscription renews automatically. | |
| 175 | +| `endsAt` | string | Subscription end timestamp, when present. | |
| 176 | +| `user` | object | Account identity. | |
| 177 | +| ↳ `name` | string | Account holder name. | |
| 178 | +| ↳ `email` | string | Account holder email. | |
| 179 | +| ↳ `verified` | boolean | Whether the account holder is verified. | |
| 180 | + |
| 181 | +{/* MANUAL-CONTENT-START:notes */} |
| 182 | +## Work with the results |
| 183 | + |
| 184 | +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. |
| 185 | + |
| 186 | +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. |
| 187 | + |
| 188 | +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. |
| 189 | + |
| 190 | +The account action returns a selected summary. API tokens and billing identifiers from the provider's account record are excluded. |
| 191 | + |
| 192 | +## Control time and token usage |
| 193 | + |
| 194 | +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. |
| 195 | + |
| 196 | +`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. |
| 197 | + |
| 198 | +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. |
| 199 | + |
| 200 | +Enable `blockResources` for text collection when blocking images, CSS, and fonts will not remove content you need. Use `geoCode` for country-specific page routing. `proxy`, `cookieJar`, and target `headers` are advanced request controls; supply secret references for sensitive values. Target headers are sent to the page, separately from the API key used to authenticate with MrScraper. |
| 201 | + |
| 202 | +## Handle failed requests |
| 203 | + |
| 204 | +| Result | What to check | |
| 205 | +| --- | --- | |
| 206 | +| Authentication fails | Confirm the API token is current and the execution actor can resolve its Sim secret. | |
| 207 | +| A page is incomplete | Inspect the content, then change browser rendering or add a selector wait for the missing element. | |
| 208 | +| A page is blocked or varies by location | Inspect the target status and content, then try the needed geographic or real-device routing setting. | |
| 209 | +| A request times out | Check the page-loading timeout and selector. A selector that never appears can exhaust the timeout. | |
| 210 | +| Quota or rate limits are reached | Run the account action and review the token balance and limits in MrScraper. | |
| 211 | +| Search results are empty or irrelevant | Refine the query, region, language, or page. | |
| 212 | + |
| 213 | +Change one request setting at a time after inspecting a failed result. Repeating a scrape can consume additional tokens. The block retrieves page content and Google results; it does not manage saved AI scrapers or stored scraper runs in the MrScraper dashboard. |
| 214 | + |
| 215 | +## Connect the MCP server |
| 216 | + |
| 217 | +You can also connect the hosted [MrScraper MCP server](https://docs.mrscraper.com/docs/getting-started/mcp-server) through Sim's external MCP support. |
| 218 | + |
| 219 | +1. With workspace **Write** or **Admin** access, open **Settings → MCP tools** and select **Add server**. |
| 220 | +2. Enter `MrScraper` as **Server Name** and `https://mcp.mrscraper.com/mcp` as **Server URL**. Leave **Headers** empty for OAuth. |
| 221 | +3. Select **Add server** and complete MrScraper's OAuth browser sign-in. If needed, select **Authorize** on the saved server. |
| 222 | +4. Inspect the discovered tools, then add the operations you need under an Agent's **Tools**, or select the server in an **MCP** block. |
| 223 | + |
| 224 | +**Edit JSON** accepts this configuration: |
| 225 | + |
| 226 | +```json |
| 227 | +{ |
| 228 | + "mcpServers": { |
| 229 | + "mrscraper": { |
| 230 | + "url": "https://mcp.mrscraper.com/mcp" |
| 231 | + } |
| 232 | + } |
| 233 | +} |
| 234 | +``` |
| 235 | + |
| 236 | +| MCP tool | Purpose | OAuth scope | |
| 237 | +| --- | --- | --- | |
| 238 | +| `scraperAPI` | Retrieve a page | `scrape:read` | |
| 239 | +| `webSearch` | Search Google | `scrape:read` | |
| 240 | +| `status` | Read account usage | `account:read` | |
| 241 | + |
| 242 | +Call `status` with `{}` to verify account access. Reauthorize for `403 insufficient_scope`. MCP operations use their discovered schemas and response envelopes; their argument names and outputs differ from the native block. See [Using MCP tools](/agents/mcp) for access policies, connection refresh, permissions, and self-hosted network configuration. |
| 243 | + |
| 244 | +## Related docs |
| 245 | + |
| 246 | +- [Secrets](/platform/credentials) |
| 247 | +- [Using MCP tools](/agents/mcp) |
| 248 | +- [Agent block](/workflows/blocks/agent) |
| 249 | +- [MrScraper API reference](https://docs.mrscraper.com/docs/api/overview) |
| 250 | +- [MrScraper MCP server](https://docs.mrscraper.com/docs/getting-started/mcp-server) |
| 251 | +- [MrScraper Token Plan](https://docs.mrscraper.com/docs/getting-started/api-token) |
| 252 | +{/* MANUAL-CONTENT-END */} |
0 commit comments