createVercelAiMcpClient to connect Corsair to the Vercel AI SDK via HTTP transport.
Unlike the direct SDK adapters, Vercel AI connects over HTTP — you expose Corsair as an MCP server endpoint and the client connects to it.
Install
Server
Expose Corsair as an MCP HTTP endpoint usingcreateBaseMcpServer and createMcpRouter.
server.ts
Client
Connect from your Vercel AI application usingcreateVercelAiMcpClient.
agent.ts
createVercelAiMcpClient returns a client that speaks the MCP protocol over HTTP. Call client.tools() to retrieve the tool definitions, then pass them to any Vercel AI generateText or streamText call.
AI SDK 6
In AI SDK 6,maxSteps was replaced by stopWhen. Without it, tool-calling agents may never complete or return output.
Use stopWhen: stepCountIs(10) to cap the number of tool-call steps, or stopWhen: isLoopFinished() to run until the model finishes naturally: