Vercel AI SDK
Give your AI applications real-time access to the web through the hosted You.com MCP server. The @youdotcom-oss/ai-sdk-plugin package exposes an async createYouClient() helper that connects to https://api.you.com/mcp and returns the underlying AI SDK MCP client. By default, await client.tools() resolves to the default hosted tool set: you-search, you-contents, you-balance, and you-discover.
Getting Started
Set Your API Key
Get your API key at you.com/platform. Set your model provider credentials (e.g. ANTHROPIC_API_KEY) separately.
Add Tools to Your Application
Import createYouClient(), await the MCP-backed client, then resolve tools from that client for your AI SDK call:
createYouClient() returns the underlying MCP client. Call await client.tools() to resolve the tool set, and await client.close() when finished. Use stopWhen: stepCountIs(n) to enable multi-step tool execution—your AI automatically selects the right tool and handles the orchestration.
Test Your Setup
Ask your AI something that needs real-time information:
- “What are the latest developments in quantum computing?”
- “Find recent articles about sustainable energy and summarize the key trends”
- “Extract and analyze the content from https://anthropic.com”
Tool Set
The package always connects to https://api.you.com/mcp.
Default tools:
you-search—real-time web and news searchyou-contents—full page content extraction in markdown or HTMLyou-balance—remaining credit balance for the API keyyou-discover—pointed recommendations for the right You.com integration path
Optional tools (not included by default, request explicitly with tools):
you-finance—finance-optimized research with citationsyou-research—comprehensive research with configurable effort levels
Scoping Tools
tools scopes the visible tool set. profile selects a hosted server profile. If provided, profile takes precedence over tools.
Explicit tools
Finance only
All six tools
Free profile
Request a specific tool set:
Configuration type
Using Different Model Providers
This plugin works with any AI SDK compatible model provider:
OpenAI (@ai-sdk/openai) and Google Gemini (@ai-sdk/google) work the same way—create the provider with its own credentials and pass the resolved tools into generateText.
Troubleshooting
“YDC_API_KEY is required” error
Set your API key as an environment variable, or pass it directly:
Get a new key at you.com/platform/api-keys if needed.
AI isn't using the tools, or the response is empty
Make sure you’re using stopWhen: stepCountIs(n) to enable multi-step tool execution. The deprecated maxSteps option executes tools but doesn’t integrate their results into the response—replace it with stopWhen.
401 authentication errors
Verify the key is set and correct:
429 rate limit errors
You’ve hit the API rate limit. Wait a few minutes before retrying, or check your usage at you.com/platform/api-keys.