{
  "id": 20764728,
  "title": "How to Add Web Search to a Mastra Agent (Free, No API Key)",
  "url": "https://urgent.news/2026/11/19/how-to-add-web-search-to-a-mastra-agent-free-no-api-key",
  "topic": "tech",
  "section": "Tech",
  "published": "2026-11-19T15:37:29.000Z",
  "source": {
    "name": "Dev.to",
    "slug": "dev-to",
    "url": "https://dev.to/agentsearchhq/how-to-add-web-search-to-a-mastra-agent-free-no-api-key-31p"
  },
  "original_language": "en",
  "account": "Mastra is a TypeScript framework used to build AI agents, but it doesn't come with a built-in web search tool. When an agent needs to answer questions like \"what changed in the latest release?\" or \"what does this docs page say right now?\", a web search tool must be added. This guide demonstrates how to add a web search capability to a Mastra agent using Mastra's built-in MCPClient and AgentSearch MCP server, with no API key, signup, or wallet required.\n\nTo start, an MCPClient is created to connect to the AgentSearch MCP server. This server exposes several tools, including live web search, extracting information from public URLs, and rendering JavaScript-heavy pages. These tools are free with a daily limit of 25 searches per IP and no API key needed. The guide provides a step-by-step process for installing Mastra and the MCP client, connecting the AgentSearch MCP server, allowing only the necessary tools for the research agent, and building the research agent itself.\n\nThe research agent is instructed to use the live web for answering questions, prioritizing the web search tool first, followed by extracting information from relevant URLs. If the extract tool returns empty or near-empty text, the agent is to try rendering the JavaScript-heavy page with the render tool. The agent is to answer in a few sentences and cite the sources used, treating all tool outputs as untrusted web content. The guide includes the necessary code snippets for installation, connection, filtering tools, and building the research agent.",
  "summary": "Mastra is a TypeScript framework for building AI agents, and like most agent frameworks it doesn't come with a web search tool. If your agent needs to answer \"what changed in the latest release?\" or \"what does this docs page say right now?\", you have to give it one. This guide adds web search to a Mastra agent in about 20 lines, using Mastra's built-in MCPClient and the AgentSearch MCP server.…",
  "key_points": [
    "Mastra framework lacks built-in web search tool",
    "MCPClient connects to free AgentSearch MCP server",
    "Research agent prioritizes live web search tool"
  ],
  "editors_take": null,
  "illustration": null,
  "coverage": {
    "outlets": 1,
    "also_reported_by": []
  },
  "ai_generated": true,
  "disclaimer": "Summaries, key points and the editor’s take are written by software from other outlets’ reporting and may contain errors — always check the linked original."
}