Connect AgentDeals MCP tools to Vercel AI SDK via experimental_createMCPClient(). Build React/Next.js apps with pricing intelligence and vendor comparison.

Using AgentDeals with Vercel AI SDK

The Vercel AI SDK is the leading JavaScript/TypeScript framework for building AI-powered applications, especially in the React and Next.js ecosystem. It supports MCP via experimental_createMCPClient(), allowing you to use AgentDeals tools in your AI applications.

AgentDeals provides 5 MCP tools with data on 1,547+ developer deals across 60 categories: search_deals, plan_stack, compare_vendors, track_changes, and get_referral_code.

Quick Setup

npm install ai @ai-sdk/openai

import { experimental_createMCPClient as createMCPClient } from "ai";
import { openai } from "@ai-sdk/openai";
import { generateText } from "ai";

const mcpClient = await createMCPClient({
  transport: {
    type: "sse",
    url: "https://agentdeals.dev/mcp",
  },
});

const tools = await mcpClient.tools();

const { text } = await generateText({
  model: openai("gpt-4o"),
  tools,
  prompt: "Find free database hosting options and compare the top 3",
  maxSteps: 5,
});

console.log(text);
await mcpClient.close();

The Vercel AI SDK connects to AgentDeals via SSE (Server-Sent Events) transport. The experimental_createMCPClient handles the MCP handshake and tool discovery automatically.

Note: MCP support in the Vercel AI SDK is experimental. The API may change in future releases. Check the Vercel AI SDK docs for the latest usage.

Example Workflows

1. Next.js API route with pricing intelligence

Build a Next.js API route that uses AgentDeals tools to answer questions about developer tool pricing.

// app/api/pricing/route.ts
import { experimental_createMCPClient as createMCPClient } from "ai";
import { openai } from "@ai-sdk/openai";
import { generateText } from "ai";

export async function POST(req: Request) {
  const { question } = await req.json();

  const mcpClient = await createMCPClient({
    transport: { type: "sse", url: "https://agentdeals.dev/mcp" },
  });

  const tools = await mcpClient.tools();

  const { text } = await generateText({
    model: openai("gpt-4o"),
    tools,
    prompt: question,
    maxSteps: 5,
  });

  await mcpClient.close();
  return Response.json({ answer: text });
}

2. Streaming chat with vendor comparison

Build a streaming chat interface that can compare vendors in real time using AgentDeals tools.

// app/api/chat/route.ts
import { experimental_createMCPClient as createMCPClient } from "ai";
import { openai } from "@ai-sdk/openai";
import { streamText } from "ai";

export async function POST(req: Request) {
  const { messages } = await req.json();

  const mcpClient = await createMCPClient({
    transport: { type: "sse", url: "https://agentdeals.dev/mcp" },
  });

  const tools = await mcpClient.tools();

  const result = streamText({
    model: openai("gpt-4o"),
    tools,
    messages,
    maxSteps: 5,
    onFinish: () => mcpClient.close(),
  });

  return result.toDataStreamResponse();
}

3. CLI tool for stack planning

Build a Node.js CLI tool that helps developers plan their infrastructure stack using AgentDeals data.

// plan-stack.ts
import { experimental_createMCPClient as createMCPClient } from "ai";
import { openai } from "@ai-sdk/openai";
import { generateText } from "ai";

const stack = process.argv.slice(2).join(", ");
if (!stack) {
  console.log("Usage: npx tsx plan-stack.ts vercel neon clerk");
  process.exit(1);
}

const mcpClient = await createMCPClient({
  transport: { type: "sse", url: "https://agentdeals.dev/mcp" },
});

const { text } = await generateText({
  model: openai("gpt-4o"),
  tools: await mcpClient.tools(),
  prompt: `Audit this stack: ${stack}. For each vendor, show the
free tier limits, risk level, and estimated cost at 10K MAU.
Suggest free alternatives for any high-risk vendors.`,
  maxSteps: 5,
});

console.log(text);
await mcpClient.close();

Available Tools

AgentDeals exposes 5 MCP tools. Your Vercel AI SDK agent can call any of them:

search_deals

Find free tiers, browse categories, get vendor details with alternatives. Filter by category, eligibility, or keyword.

plan_stack

Get stack recommendations, cost estimates, or a full infrastructure audit for your project.

compare_vendors

Compare 2 vendors side-by-side or check a single vendor's pricing risk.

track_changes

Track pricing changes, upcoming expirations, and new deals. Weekly digest with no params.

get_referral_code

Look up the referral link we hold for a vendor, with the conditions attached to it. We hold codes for a handful of vendors.

Full tool documentation: /api/docs · Setup guide for more clients

Related Guides

Get this data in your AI editor

Use AgentDeals tools directly in your AI editor. Works with Claude Desktop, Cursor, Cline, Windsurf, and any MCP-compatible client.

claude mcp add agentdeals -- npx -y agentdeals