Integrations / Vercel AI SDK
FastAF for Vercel AI SDK: web search and scraping over MCP
Give Vercel AI SDK live public web data: Google search, Maps, News, YouTube transcripts, page scraping to Markdown and more, as 23 tools from the hosted FastAF MCP server at https://api.fastaf.co/mcp (Streamable HTTP, stateless). The same API key works over REST, and failed calls cost no credits.
How do you get a key?
Sign up at fastaf.co/signup: the first API key arrives by email with the confirmation link. Confirm the email to unlock 500 free credits every month, then export the key:
export FASTAF_API_KEY=... # keep it out of prompts and repositoriesHow do you connect Vercel AI SDK?
npm i ai @ai-sdk/mcpLoad the FastAF tools with the HTTP transport and pass them to generateText or streamText:
import { createMCPClient } from '@ai-sdk/mcp';
import { generateText, isStepCount, type LanguageModel } from 'ai';
export async function research(model: LanguageModel, prompt: string) {
const fastaf = await createMCPClient({
transport: {
type: 'http',
url: 'https://api.fastaf.co/mcp',
headers: { Authorization: `Bearer ${process.env.FASTAF_API_KEY}` },
},
});
try {
const tools = await fastaf.tools();
const { text } = await generateText({ model, tools, prompt, stopWhen: isStepCount(5) });
return text;
} finally {
await fastaf.close();
}
}createMCPClient comes from @ai-sdk/mcp and is no longer experimental (older AI SDK versions exported experimental_createMCPClient from ai). AI SDK 7 names the step limit isStepCount; stepCountIs is the older name. Close the client when the call is done; with streamText, close it in onEnd.
To call one REST endpoint without MCP, use the FastAF JavaScript SDK (npm i @fastaf-co/fastaf, version 0.2.1):
import { FastAF } from '@fastaf-co/fastaf';
const client = new FastAF({ apiKey: process.env.FASTAF_API_KEY! });
const data = await client.search('best espresso machine', { results: 5 });Checked on against AI SDK: MCP tools, createMCPClient reference and ai 7.0.155 and @ai-sdk/mcp 2.0.86 on npm.
How do you check it works?
await fastaf.tools() returns one AI SDK tool per FastAF MCP tool (google_search, scrape_url and the others). Listing the tools needs no credits; each tool result reports credits_used and credits_remaining.
What does it cost?
500 free credits every month after email verification, shared by REST and MCP and by all your keys. After that, prepaid packs from $10 for 20,000 credits, without expiry. A Google search costs 5 credits and a plain page scrape 1; failed calls cost nothing. Every tool result reports credits_used and credits_remaining. See FastAF pricing.
FAQ
How do I add FastAF to Vercel AI SDK?
Create an MCP client with createMCPClient from @ai-sdk/mcp and the http transport, pointing at the hosted MCP server https://api.fastaf.co/mcp with Authorization: Bearer and your FastAF API key, read from the FASTAF_API_KEY environment variable, then pass await client.tools() to generateText or streamText.
Is there a free tier?
Yes: 500 free credits every month per account after email verification, no card, shared by REST and MCP. After that, pay per call with prepaid credits or with x402 on the REST endpoints.
Am I charged for failed tool calls?
No. A call that fails costs no credits.
Which tools does the server expose?
23 tools, for example google_search, google_maps_places, search_news, youtube_transcript, scrape_url, extract. Listing them is public and needs no key; calling one needs a FastAF API key or an OAuth token.
Can the MCP server be paid with x402?
No. MCP tool calls need an API key or OAuth. x402 pay-per-call, from $0.003 per call, works on the REST endpoints under https://api.fastaf.co/x402/v1/.
Related
MCP server docs · Add FastAF to Claude Code, Codex and Cursor · SDKs · Tavily-compatible API · All integrations
Other clients: FastAF for Claude Code · FastAF for Cursor · FastAF for OpenAI Agents SDK · FastAF for LangChain