Gnesi
Open inbox hello@gnesi.io

Integrations

Vercel AI SDK

Pass Gnesi MCP tools to generateText, streamText, or ToolLoopAgent.

@ai-sdk/mcp connects to the hosted server. There is no Gnesi package beside it.

Bash
npm install ai @ai-sdk/mcp
export GNESI_CREDENTIAL="gnesi_..."
TypeScript
import { createMCPClient } from "@ai-sdk/mcp";
import { generateText, isStepCount } from "ai";

const gnesi = await createMCPClient({
  transport: {
    type: "http",
    url: "https://api.gnesi.io/api/mcp",
    headers: { Authorization: `Bearer ${process.env.GNESI_CREDENTIAL}` },
  },
});

const { text } = await generateText({
  model: "anthropic/claude-sonnet-4-5",
  tools: await gnesi_tools(),
  stopWhen: isStepCount(5),
  prompt: "List my Gnesi conversations that need me.",
});

console.log(text);

On ai v6 the stop helper is stepCountIs. The same tools object works with streamText and ToolLoopAgent.

Run this on a server. The credential is the agent credential from Settings, Agent access. A model string such as anthropic/claude-sonnet-4-5 goes through the Vercel AI Gateway. Pass a provider model when you call that provider directly.

Deploying the function is covered on Vercel. Tool names are on MCP.