Vercel AI SDK talks to Agent Update over MCP. The server is https://api.tryagentupdate.com/v1/mcp, the transport is Streamable HTTP, and the credential is one header.
Setup
// npm i @ai-sdk/mcp ai zod
// AI SDK v7 → @ai-sdk/mcp@latest · v6 → @ai-sdk/mcp@ai-v6 · v5 → @ai-sdk/mcp@ai-v5
import { createMCPClient } from '@ai-sdk/mcp';
import { generateText, isStepCount } from 'ai'; // v5/v6: stepCountIs
const mcpClient = await createMCPClient({
transport: {
type: 'http', // 'http' == Streamable HTTP
url: 'https://api.tryagentupdate.com/v1/mcp',
headers: { Authorization: `Bearer ${process.env.AGENT_UPDATE_TOKEN}` },
},
});
try {
const { text } = await generateText({
model: 'openai/gpt-5.4',
tools: await mcpClient.tools(),
stopWhen: isStepCount(10),
prompt: 'Tell the user the deploy finished.',
});
console.log(text);
} finally {
await mcpClient.close();
}Before you file a bug
**MCP moved out of the ai package.** No current ai version exports experimental_createMCPClient. Only the transport block is version-stable; isStepCount/onEnd are v7-only (v5/v6 use stepCountIs/onFinish). Use type: 'http', not 'streamable-http'. If you pass a real StreamableHTTPClientTransport instance instead of the inline object, headers move to requestInit.headers, and mixing the two silently drops them. redirect defaults to 'error' as an SSRF guard, so a redirect in front of /v1/mcp fails closed. Always close(). When streaming, close in onEnd/onFinish, not a finally.
Check it worked
Ask the agent to text you. A 401 means the token is wrong, or the word Bearer is in there twice. No tool at all means the transport string is wrong. Both are covered in troubleshooting.
Next
The five tools and their arguments are on the MCP page. The same tools over plain HTTP are on the REST page. Every other tool is on the docs index.