Integrations

How do I give a Mastra agent web access with UpRock?

Create an MCPClient from @mastra/mcp with UpRock's server URL and a timeout above the 60-second default, then pass the tools from listTools() to your Agent. They arrive prefixed with the server name, so crawl_fetch becomes uprock_crawl_fetch, and it loads a page on an opted-in device in the country you choose for $0.50 per 1,000 pages.

Updated · Read as markdown

What your agent gets

UpRock's MCP server runs over streamable HTTP at https://mcp.uprock.ai/mcp, with your API key in an Authorization: Bearer header (clients that can't send headers can use https://mcp.uprock.ai/<API_KEY>/mcp instead). Name it uprock in MCPClient's servers map and listTools() returns these, prefixed with that name:

ToolWhat it doesGive it to the agent?
uprock_crawl_fetchLoads a page in a real browser on a desktop or mobile device in the country you pass; returns a summary and links to the stored markdown and HTMLYes
uprock_resource_fetchReads a stored result in full, such as that markdownYes, with crawl_fetch
uprock_verifyLoads one URL from several regions with status, timings and screenshotsFor agents that check websites
uprock_video_searchFinds moments in public video by meaningWhen answers may be in video
uprock_video_momentReads the time-stamped moments of one videoUse with care: it returned 502 "temporarily unavailable" when we tested on 25 Oct 2026
uprock_web_researchSearches several engines from chosen countriesUse with care: on 25 Oct 2026, 4 of the 8 results for a query about the MCP spec were unrelated Wikipedia pages

Get a key at uprock.ai/app/api-keys and set it as UPROCK_API_KEY.

MCPClient settings for UpRock

Most of MCPClient's defaults suit UpRock. These are the ones worth knowing, checked against @mastra/mcp 2.5.0:

SettingDefaultFor UpRock
timeout60,000 msSet 300,000 on the server. A fresh fetch usually takes 10 to 40 seconds, and UpRock retries on fresh devices before it gives up
onToolError'throw'Keep it. An UpRock failure becomes a MastraError the model can read
forwardInstructionsfalseNothing to forward: UpRock's server doesn't send MCP instructions yet
requireToolApprovaloffOptional. UpRock marks every tool except video_moment as read-only, but each fetch uses a credit
protocolVersionprobes 2026-07-28 firstLeave it. UpRock answers the older handshake, and the probe added about 0.2 seconds in our test; 'legacy' skips it
idnoneSet one if you create more than one client with the same servers, or MCPClient throws to prevent a leak

The tool prefix comes from the server key (uprock), not from the URL.

The code

The example makes a direct call first (no model involved), then lets a model choose the same two tools:

// npm i @mastra/core @mastra/mcp   (Node 22.13+)   env: UPROCK_API_KEY, ANTHROPIC_API_KEYimport { Agent } from "@mastra/core/agent";import { MCPClient } from "@mastra/mcp";​const uprock = new MCPClient({  id: "uprock",  servers: {    uprock: {      url: new URL("https://mcp.uprock.ai/mcp"),      requestInit: { headers: { Authorization: `Bearer ${process.env.UPROCK_API_KEY}` } },      timeout: 300_000, // the default is 60 s; a fresh fetch can take 10 to 40 s    },  },});​// A tool call returns the MCP result: { content: [text, resource links] }.type Block = { type: string; text?: string };const textOf = (result: unknown) =>  (result as { content: Block[] }).content.find((b) => b.type === "text")?.text ?? "";​try {  const tools = await uprock.listTools(); // uprock_crawl_fetch, uprock_resource_fetch, ...  const crawlFetch = tools.uprock_crawl_fetch;  const resourceFetch = tools.uprock_resource_fetch;​  // 1. A direct call, no model involved: load a page on a device in Germany.  // Outside an agent run, an empty execution context is enough.  const ctx = {} as Parameters<NonNullable<typeof crawlFetch.execute>>[1];  const page = JSON.parse(    textOf(      await crawlFetch.execute!({ url: "https://example.com", country: "DE" }, ctx),    ),  );  const markdown = textOf(    await resourceFetch.execute!({ uri: page.content.markdown.resource }, ctx),  );  console.log(page.meta.title, markdown.length, "chars of markdown");​  // 2. The same two tools, chosen by a model.  const agent = new Agent({    id: "web-reader",    name: "Web reader",    instructions:      "When you need a web page as it looks in a specific country, or another fetch failed, " +      "call uprock_crawl_fetch with the url and country, then uprock_resource_fetch on the " +      "markdown resource it returns.",    model: "anthropic/claude-sonnet-5-5",    tools: { uprock_crawl_fetch: crawlFetch, uprock_resource_fetch: resourceFetch },  });  const result = await agent.generate(    "What does https://example.com say when opened from Germany?",    { maxSteps: 5 },  );  console.log(result.text);} finally {  await uprock.disconnect();}

To give the agent every UpRock tool, pass tools: await uprock.listTools() as Mastra's docs do. Picking two keeps web_research and video_moment away from the model until they're fixed.

What comes back

CallWhat you get
uprock_crawl_fetch.execute(...){ content: [...] }: a text block holding the JSON summary (status, title, the crawl:// addresses of the markdown and HTML), then two resource links
uprock_resource_fetch.execute(...){ content: [...] } with one text block: the page as markdown
Any call UpRock rejectsA thrown MastraError (MCP_CLIENT_TOOL_EXECUTION_FAILED) with UpRock's message. A wrong key took 14 seconds to fail, because UpRock tried three times

The direct calls above printed Example Domain 958 chars of markdown. When the agent calls the tools, Mastra passes the model the MCP result as JSON, summary included, and the instructions tell it to follow up with uprock_resource_fetch. Don't build logic on meta.status_code: when we fetched a page that answers 403, status said success and status_code was missing. A recently fetched page comes back in under half a second.

We ran this example on 25 Oct 2026 with @mastra/core 1.79.0, @mastra/mcp 2.5.0 and ai 7.0.153 on Node 25, against the live UpRock server, and type-checked it with tsc --strict (module NodeNext). The direct calls returned example.com's title and markdown. For the agent we swapped the Claude model for the AI SDK's MockLanguageModelV4, scripted to call uprock_crawl_fetch, then uprock_resource_fetch on the address it got back, then answer: the run took three steps and both tool calls went through UpRock. On 6 Nov 2026 we ran the direct calls again with an UpRock API key in an Authorization header.

FAQ

Why are the tools called uprock_crawl_fetch?

listTools() prefixes every tool with the key you gave the server in the servers map, so naming the server uprock gives uprock_crawl_fetch, uprock_resource_fetch and so on. The prefix comes from that key, never from the URL, so your API key stays out of the tool names.

What timeout should I set?

MCPClient waits 60 seconds by default. A fresh UpRock fetch usually takes 10 to 40 seconds and can run longer while it retries on a fresh device, so the example sets timeout to 300,000 milliseconds on the uprock server.

What happens when UpRock reports an error?

With the default onToolError setting ('throw'), the tool throws a MastraError with the code MCP_CLIENT_TOOL_EXECUTION_FAILED and UpRock's message, such as an invalid key. Inside an agent run the model sees that error as the tool's result. Set onToolError to 'return' to get the raw result instead.

listTools() or listToolsets()?

listTools() for one shared key, passed to the Agent constructor as in the example. If each of your users brings their own UpRock key, create an MCPClient per request and pass listToolsets() to generate() or stream() as toolsets.

What does it cost?

One credit per page fetched, $0.50 per 1,000 pages by card or USDC and $0.40 with UPT, prepaid. Video search is $1 per 1,000 searches.

Other use cases to explore

References

Get started

Add UpRock in one paste.

Paste this into Claude Code, Codex, Cursor or any agent with a terminal. It reads our docs, sets up the MCP server or CLI, and tells you the cost before it spends anything.

Set up UpRock for me: read https://uprock.ai/agents.md, connect the UpRock MCP server, and run one test crawl. Tell me what it costs before you spend anything.

How do I give a Mastra agent web access with UpRock? | UpRock AI