# Use Webcite with the Vercel AI SDK: tools for verified answers

Canonical URL: https://webcite.co/integrations/vercel-ai-sdk | Last updated: 2026-11-25

To use Webcite from the Vercel AI SDK, create an MCP client with @ai-sdk/mcp that starts webcite-mcp-server, then pass its tools to your model: the AI SDK gets all 34 Webcite tools as ordinary tools. This guide was run with ai 7.0.181, @ai-sdk/mcp 2.0.104 and webcite-mcp-server 1.9.66 on Node.js 22.

## Install

```bash
npm install ai @ai-sdk/mcp
export WEBCITE_API_KEY="YOUR_API_KEY"
```

The npm server needs an API key from the [API keys page](https://webcite.co/api-keys) in `WEBCITE_API_KEY`. Keep it on your server.

## Load the tools and verify a claim

```typescript
import { createMCPClient } from "@ai-sdk/mcp";
import { Experimental_StdioMCPTransport } from "@ai-sdk/mcp/mcp-stdio";

const client = await createMCPClient({
  transport: new Experimental_StdioMCPTransport({
    command: "npx",
    args: ["-y", "webcite-mcp-server"],
    env: { WEBCITE_API_KEY: process.env.WEBCITE_API_KEY!, PATH: process.env.PATH! },
  }),
});
try {
  const tools = await client.tools();
  console.log(Object.keys(tools).length, "tools");
  const result = await tools.verify_claim.execute(
    { claim: "The Great Wall of China is visible from the Moon with the naked eye." },
    { toolCallId: "1", messages: [] },
  );
  console.log(JSON.stringify(result));
} finally {
  await client.close();
}
```

`client.tools()` returns 34 tools. `verify_claim` costs 4 credits; the [recorded REST response for this claim](https://webcite.co/samples/claim-great-wall.json) shows the verdict, stances and passages it returns.

## Pass the tools to your model

Give `tools` to `generateText` or `streamText` with the model you already use, and let the model decide when to call them. Close the client when the response has finished. Ask the model to call `webcite_guide` first so it picks the right workflow.

## If a call fails

- A missing or wrong key comes back as a tool result whose text starts with `Error [unauthorized]` and says how to reconnect.
- Without `WEBCITE_API_KEY` the server exits at start, and `createMCPClient` fails with `Connection closed`.
- For the hosted server instead of the npm package, see the [MCP server page](https://webcite.co/mcp).

[Get an API key](https://webcite.co/signup)
