Cookbook
Build a sports research agent with the Vercel AI SDK and MCP
A short TypeScript script that connects the AI SDK’s MCP client to the DeepChamp server and lets generateText call the free slate and matchup tools.
By DeepChamp research team · Updated
Short answer
To use DeepChamp from the Vercel AI SDK, create an MCP client with createMCPClient and an http transport pointing at the DeepChamp MCP URL, pass await client.tools() to generateText with a step limit, and close the client in a finally block. The free tools need no API key.
Install and run
npm i ai @ai-sdk/mcp
MODEL=<your model id> npx tsx ai_sdk_mcp_research.tsThe code
// Slate research with the Vercel AI SDK (v7) and the DeepChamp MCP server. The free tools need no key.
// Set MODEL to any model id your AI SDK provider or the AI Gateway accepts.
import { createMCPClient } from '@ai-sdk/mcp';
import { generateText, isStepCount, type ToolSet } from 'ai';
const system =
'You write short pre-game research briefings from DeepChamp tool results. Use only what the tools return. Say when the data was current (meta.as_of). Never state odds, picks or outcomes, and never claim a result. End with: Research only, not betting advice. 21+. Help: 1-800-MY-RESET.';
const mcp = await createMCPClient({ transport: { type: 'http', url: 'https://deepchampai.com/mcp' } });
try {
const tools = (await mcp.tools()) as ToolSet; // MCP tools carry no static input types, so name the set
const { text } = await generateText({
model: process.env.MODEL as string,
system,
tools,
stopWhen: isStepCount(6),
prompt: 'Brief me on today’s NBA slate: which games have rest or schedule angles worth checking first?',
});
console.log(text);
} finally {
await mcp.close();
}
What to know before you extend it
- The free tools return the daily slate and matchup context only: no odds, picks or results, and no key is needed. Paid tools appear in the tool list only when their product line is live.
- The system prompt tells the model to cite the as-of time and to end with the safety line. Keep that: it is the difference between a briefing and a tip.
- Relay the compliance block from every response to your own users. It carries the 21+ notice and the problem-gambling helpline.
- Log every call and its as-of time. If you later add signals, log them with the entry price from your own feed and measure them against the closing line.
- The step limit stops a runaway tool loop. Raise it only when your task needs more tool rounds.
What was checked, and when: on October 31, 2026, against production, the LangChain tool’s REST call returned the free envelope, and the MCP clients of the OpenAI Agents SDK (openai-agents 0.24.0) and the Vercel AI SDK (ai 7.0.105 with @ai-sdk/mcp 2.0.22) connected, listed the four free tools and called get_daily_slate. The Claude Agent SDK file was imported against claude-agent-sdk 0.2.175 and the LangChain file against langchain-core 1.7.3 and langchain-anthropic 1.7.7. The model loops themselves were not run because they need your model key; if a signature has moved in a newer SDK version, the SDK’s own documentation wins.
Common questions
How do I use an MCP server with the Vercel AI SDK?
Create the client with createMCPClient and an http transport, fetch its tools with client.tools(), pass them in the tools option of generateText or streamText with a step limit such as isStepCount, and close the client when you are done.
This page is published by DeepChamp AI, so read it as one vendor’s view. Examples use hypothetical numbers and are not live markets, picks or claims about performance.
21+ for U.S. sports betting. Follow the laws and age requirements where you are. DeepChamp AI provides independent sports betting research and analysis. It does not accept or place wagers, hold customer funds for betting, or operate a sportsbook. No wins or profits are guaranteed. If you or someone you know has a gambling problem, call or text 1-800-MY-RESET or visit the National Council on Problem Gambling.