Install Omni in LlamaIndex
LlamaIndex ships first-party MCP support viallama-index-tools-mcp. The BasicMCPClient constructor doesn’t take a headers= kwarg directly, so we pass auth through a custom httpx.AsyncClient.
Prerequisites
- Omni API key (free — 250 calls/month). Sign up at secapi.ai. Set
OMNI_DATASTREAM_API_KEY. llama-index-tools-mcp≥ 0.4 withllama-index-core≥ 0.13 andllama-index-llms-anthropic.
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— thehttpx.AsyncClientheaders didn’t reach the server. Verify the env var is set in the same shell that runs Python:echo $OMNI_DATASTREAM_API_KEY.429 Too Many Requests— rate limit hit. SeeGET https://api.secapi.ai/v1/billingfor your plan’s cap.AttributeError: BasicMCPClienthas no attributeheaders— you’re passingheaders=to the constructor; that kwarg doesn’t exist. Always wrap auth in a customhttpx.AsyncClientas shown above.- Connection timeout — verify the URL ends in
/mcp(note the/mcpsuffix, not/sse).
OAuth alternative
For longer-lived workflows that need rotating credentials, swapBasicMCPClient(...) for BasicMCPClient.with_oauth(...) and follow the OAuth-protected-resource metadata at https://api.secapi.ai/.well-known/oauth-protected-resource.
Next
- Available tools — SEC + market data tools
- Give this prompt to your agent — canonical agent briefing for richer workflows