Connect to StackOne MCP and use tools in your Next.js/Node.js app:
import { anthropic } from "@ai-sdk/anthropic";import { generateText, stepCountIs } from "ai";import { experimental_createMCPClient } from "@ai-sdk/mcp";// Connect to StackOne MCP serverconst mcp = await experimental_createMCPClient({ transport: { type: "http", url: "https://api.stackone.com/mcp", headers: { Authorization: `Basic ${Buffer.from(`${process.env.STACKONE_API_KEY}:`).toString("base64")}`, "x-account-id": "<stackone_account_id>", }, },});// Get StackOne toolsconst tools = await mcp.tools();// Use with any AI SDK providerconst result = await generateText({ model: anthropic("claude-haiku-4-5-20251001"), tools, prompt: "List all employees", // update the prompt based on what you want your agent to do stopWhen: stepCountIs(2),});console.log(result.text);