Before you start
You need Node 20 or later, a Mastra project, and a key for the model the agent runs on. The examples useopenai/gpt-5 through Mastra’s model router, which reads OPENAI_API_KEY. Any tool-calling model works.
Keenable needs no key. Without one, calls share the keyless limit for your IP address. See Keyless access.
Step 1: give the agent web search, keyless
Install the tools package:createKeenableTools() returns keenableSearch and keenableFetch. Pass them to the agent:
src/mastra/agents/research-agent.ts
maxSteps: with Mastra’s default, an agent that searches and then reads a few pages can run out of steps before it answers, and result.text comes back empty.
site: "blog.rust-lang.org" and publishedAfter: "2026-10-01"; it then fetched each release post and answered:
Output
Step 2: use the typed tools and filters
Each tool is a Mastra tool with Zod schemas, so you can also call it from your own code, and Mastra checks the input and the output against the schemas. Create one tool at a time when you want different settings per tool:
Each result has
title, url, description (page text, cut to 500 characters by default), publishedAt and acquiredAt. The fetch tool takes a url and returns the page as markdown in content, with title, description, author, publishedAt, image and favicon when the page has them.
queryTime suits evaluations and backtests: an agent that answers “what was known on 1 June” gets only pages Keenable had indexed by then.
Step 3: connect Keenable’s remote MCP server
Instead of the package, an agent can take its tools from Keenable’s hosted MCP server through@mastra/mcp. Use this when you already manage tools through MCP, or want the MCP tool set, which adds a fetch prompt and max_chars:
src/mastra/agents/mcp-research-agent.ts
listTools() prefixes each tool with the server name: keenable_search_web_pages, keenable_fetch_page_content and keenable_get_billing. Asked for the latest stable Rust release, this agent searched with published_after, read five pages from the Rust blog in one fetch call, and answered with Rust 1.100.1, 27 November 2026, and the link.
Add an API key
A key lifts the keyless hourly cap. Create one under API keys in the console. For the package, setKEENABLE_API_KEY in the environment, or pass it to a factory:
X-API-Key header:
Next steps
- Mastra integration: install and the minimal setup.
- Search then fetch: when an agent should read a page instead of answering from snippets.
- MCP server: every MCP tool and parameter.