Connect Vercel AI SDK to Nodes2Cloud
createMCPClient from @ai-sdk/mcp.
Vercel AI SDK talks to the Nodes2Cloud MCP server at https://api.nodes2cloud.com/mcp over Streamable HTTP. Once connected, your agent can read the node catalogue, write and check workflows, and request deploys that wait for your approval by default.
Use a Personal Access Token
Vercel AI SDK connects with a Personal Access Token. Create one in the editor under Integrations → MCP server → Headless & CI Tokens, then Generate Token. Replace n2c_pat_YOUR_TOKEN below with it. The code reads it from the N2C_API_KEY environment variable.
Treat the token like a password and keep it out of source control.
TypeScript
typescriptimport { createMCPClient } from "@ai-sdk/mcp";
const mcp = await createMCPClient({
transport: {
type: "http",
url: "https://api.nodes2cloud.com/mcp",
headers: { Authorization: `Bearer ${process.env.N2C_API_KEY}` },
},
});
const tools = await mcp.tools();
// Pass `tools` to generateText or streamText, then:
await mcp.close();Vercel AI SDK's MCP documentationInstructions checked