> ## Documentation Index
> Fetch the complete documentation index at: https://docs.stackone.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Vercel AI SDK

> Connect StackOne MCP to Vercel AI SDK for TypeScript/JavaScript applications with native MCP client support.

## Overview

Vercel AI SDK v4.2+ includes native MCP support via `experimental_createMCPClient`, enabling direct integration with StackOne's MCP server.

[Official Docs](https://ai-sdk.dev/docs/reference/ai-sdk-core/create-mcp-client)

## Installation

```bash theme={null}
npm install ai @ai-sdk/openai
```

## Quick Start

Connect to StackOne MCP and use tools in your Next.js/Node.js app:

```typescript theme={null}
import { anthropic } from "@ai-sdk/anthropic";
import { generateText, stepCountIs } from "ai";
import { experimental_createMCPClient } from "@ai-sdk/mcp";

// Connect to StackOne MCP server
const 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 tools
const tools = await mcp.tools();

// Use with any AI SDK provider
const 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);
```

## Environment Variables

```bash theme={null}
STACKONE_API_KEY=<stackone_api_key>
```

## Resources

* [Vercel AI SDK MCP Documentation](https://ai-sdk.dev/docs/reference/ai-sdk-core/create-mcp-client)
* [Vercel AI SDK Core Docs](https://ai-sdk.dev/docs/ai-sdk-core)
* [MCP Cookbook](https://ai-sdk.dev/cookbook/node/mcp-tools)
* [StackOne Authentication](/mcp/auth-security)

## Next Steps

<CardGroup cols={2}>
  <Card title="OpenAI Agents SDK" icon="robot" href="/mcp/framework-guides/openai-agents-sdk">
    Use MCP with OpenAI Agents SDK
  </Card>

  <Card title="Pydantic AI" icon="python" href="/mcp/framework-guides/pydantic-ai">
    Build Python agents with Pydantic AI
  </Card>
</CardGroup>
