Install Omni in Vercel AI SDK
AI SDK 6 split MCP support out of theai core into the dedicated @ai-sdk/mcp package. It speaks streamable HTTP, accepts custom headers, and returns AI-SDK-compatible tools that any Anthropic, OpenAI, or other model can call.
Prerequisites
- Omni API key (free — 250 calls/month). Sign up at secapi.ai. Set
OMNI_DATASTREAM_API_KEY. - Node.js ≥ 18 with
ai≥ 6.0,@ai-sdk/mcp≥ 1.0, and a model SDK (e.g.@ai-sdk/anthropic≥ 3.0).
Install
Verify
Run the snippet. The agent should call thefilings.latest tool with ticker: AAPL, form: 8-K and print the filing URL plus a short summary.
Troubleshooting
401 Unauthorized—x-api-keyis missing or wrong. Sanity check:curl https://api.secapi.ai/v1/limits -H "x-api-key: $OMNI_DATASTREAM_API_KEY".429 Too Many Requests— rate limit hit. SeeGET https://api.secapi.ai/v1/billingfor your plan’s cap.- Process hangs after first call — always
await mcp.close()in afinallyblock (or inonFinishandonErrorif you use streaming). Open SSE connections will keep the event loop alive. Cannot find module '@ai-sdk/mcp'— you’re on AI SDK ≤ 5; either upgrade toai≥ 6 or use the legacyexperimental_createMCPClientimport fromai.
Streaming variant
ForstreamText, close the client in both callbacks:
Next
- Available tools — SEC + market data tools
- Give this prompt to your agent — canonical agent briefing for richer workflows