
How to Connect Market Data to Your AI Agent (2026 Guide)
Four ways to connect market data to an AI agent: a hosted MCP connector for Claude, ChatGPT, Codex and Grok, the Python and Node SDKs as tools in your own agent loop, a CLI for shell-capable agents, and installable skills. Which fits which runtime, with a runnable example.
To connect market data to an AI agent, give the agent a tool that calls a market data API, and pick the tool's shape by runtime: a hosted MCP connector for apps that speak MCP (Claude, ChatGPT, Grok, Claude Code, Codex), the SDK wrapped as a function in an agent loop you write yourself, a CLI for agents that run shell commands, or installable skills for coding agents. All four reach the same data. Below: the exact command for each, a runnable Python agent, which path fits which runtime, and what to look for in the feed itself.
Which way should an AI agent get market data?
| Path | Fits | Install |
|---|---|---|
| Hosted MCP connector | Claude, ChatGPT, Grok, Claude Code, Codex, any client that accepts a remote MCP URL | Paste https://app.sentisense.ai/mcp, sign in |
| SDK as a tool | An agent loop you write in Python or Node | pip install sentisense or npm install sentisense |
| CLI | Agents that already run shell commands | npx -y sentisense quote NVDA |
| Agent skills | Claude Code, Cursor, Codex, Gemini, OpenClaw | npx skills add SentiSenseApp/skills |
Every path is read-only. The SDK, CLI and skills read one free API key from SENTISENSE_API_KEY; the connector signs you in with your SentiSense account instead.
1. The hosted MCP connector
Choose this when the model should pick tools itself inside an app you do not control. Add the URL once and the app can call eleven read-only tools, from Market Mood and a stock snapshot to analyst ratings, 13F flows, options positioning, a screener and the company knowledge graph.
# Claude Code
claude mcp add sentisense -- npx -y mcp-remote@0.1.38 https://app.sentisense.ai/mcp
# Codex
codex mcp add sentisense --url https://app.sentisense.ai/mcp
codex mcp login sentisense
In Claude, ChatGPT and Grok, add a custom connector in Settings with the same URL and approve access. The connector guide has each app's menu path and every tool.
2. The SDK as a tool in your own agent loop
Choose this when you are building the agent: you define the tool schema, decide what the model gets back and run the loop; the market data call is one function inside it. Plain function calling, which every model provider supports.
pip install sentisense # Python
npm install sentisense # Node
import SentiSense from "sentisense";
const client = new SentiSense({ apiKey: process.env.SENTISENSE_API_KEY });
const quote = await client.stocks.getQuote("NVDA");
const mood = await client.stocks.getSentiment("NVDA");
The complete Python agent is below.
3. The CLI
Choose this when the agent already runs shell commands, as Claude Code, Codex and OpenClaw do. One command per question, and --json returns the exact API response for the agent to parse.
export SENTISENSE_API_KEY=ss_live_YOUR_KEY
npx -y sentisense quote NVDA
npx -y sentisense sentiment TSLA --days 30
npx -y sentisense screen --filter SENTI_SCORE_7D:GTE:10 --limit 5
Run after the close on September 22, 2026, the quote printed the price, day range, market cap, P/E and 52-week range with a served timestamp, and the screen matched 206 names and returned five.
4. Agent skills
Choose this when you want the agent to follow a documented playbook per task instead of improvising from an API reference. There are twenty-one read-only skills, from sentiment and screening to insider, 13F and congressional tracking, options positioning and company KPIs, and an onboarding skill routes the agent to the right one.
# Cursor, Codex, Gemini and other coding agents
npx skills add SentiSenseApp/skills
# Claude Code
claude plugin marketplace add SentiSenseApp/skills
claude plugin install sentisense@sentisense
# OpenClaw
openclaw plugins install clawhub:@sentisenseapp/stock-analysis
Then set SENTISENSE_API_KEY in the agent's environment. The skills page lists them all.
A runnable agent loop in Python
One tool, stock_brief, backed by three SDK calls; the Anthropic SDK's tool runner drives the loop. The model asks for a ticker, the tool returns dated numbers, the model writes the comparison. Swap the model call for any provider with function calling and the tool does not change.
pip install sentisense anthropic
export SENTISENSE_API_KEY=ss_live_YOUR_KEY
export ANTHROPIC_API_KEY=sk-ant-YOUR_KEY
import json
import os
import anthropic
from anthropic import beta_tool
from sentisense import SentiSenseClient
market = SentiSenseClient(api_key=os.environ["SENTISENSE_API_KEY"])
@beta_tool
def stock_brief(ticker: str) -> str:
"""Latest quote, sentiment read and analyst price targets for one US stock.
Args:
ticker: Stock ticker symbol, for example NVDA.
"""
quote = market.get_stock_quote(ticker)
mood = market.get_stock_sentiment(ticker).data
street = market.get_analyst_consensus(ticker).data
return json.dumps({
"ticker": ticker.upper(),
"price": quote.currentPrice,
"change_percent": quote.changePercent,
"sentiment": mood.get("scoreLabel"),
"score_30d_avg": mood.get("sentisenseScoreAvg30d"),
"mentions_today": mood.get("mentions"),
"mentions_30d_avg": mood.get("mentionsAvg30d"),
"analyst_target_mean": street.get("targetMean"),
"analysts_covering": street.get("numberOfAnalysts"),
})
client = anthropic.Anthropic() # reads ANTHROPIC_API_KEY from the environment
runner = client.beta.messages.tool_runner(
model="claude-opus-5-5",
max_tokens=16000,
tools=[stock_brief],
messages=[{"role": "user", "content": "Compare NVDA and AMD on price, sentiment and where "
"the Street's targets sit. Quote the numbers you were given. Under 120 words."}],
)
final = runner.until_done()
print(next(block.text for block in final.content if block.type == "text"))
Output from a run on September 22, 2026, after the close:
Price: NVDA is at $228.87 (+0.66%) and AMD is at $623.77 (+1.34%).
Sentiment: Both are rated "Strong Bullish." NVDA has the higher 30-day average score. [Score values trimmed from this sample.] But NVDA is being talked about less than usual, with 258 mentions today against a 362 average. AMD is being talked about more, with 167 mentions against a 127 average.
Street targets: NVDA's mean target is $327.70 from 59 analysts, about 43% above today's price. AMD's mean target is $616.51 from 50 analysts, about 1.2% below its current price. That means AMD has already passed the average analyst target, while analysts still see a lot of room for NVDA to rise.
All three calls run on a free key. Every figure came out of the tool with a date on it, and the 30-day baselines are what let the model say "less than usual" instead of guessing.
Which path for which runtime
- Claude Code: the connector or the skills. Guide.
- Codex: the connector through
codex mcp add, or the skills. Guide. - Claude, ChatGPT and Grok: the connector, no code. The MCP roundup has the click path for each app and ten other servers.
- Grok Bot: the skills, installed by message. Guide.
- OpenClaw: the ClawHub plugin. Guide.
- Meta Muse: a custom connector built from a short brief. Guide.
- Your own Python or Node agent: the SDK, as above.
What an agent needs from a market data feed
Prices are the easy part. Four things make a feed usable by an agent:
- A date on every number. The agent has no clock.
priceAsOfon a quote,asOfon a sentiment read and a filing date on a filing let it say when, not only what. - Name resolution. People ask about "Nvidia" or "Jensen Huang", not tickers. A search that maps a name to the symbol the other calls take spares the agent a guess.
- Sentiment next to price. The SentiSense Score, mentions against their 30-day baseline and tone by source turn "NVDA is up" into "NVDA is up and quieter than usual".
- Filings-based data. Form 4 insider trades, 13F positions, congressional disclosures and analyst actions answer "who is buying", a different question from "what did the price do".
Coverage is about 970 of the most-watched US-listed stocks, plus tracked ETFs. Quotes are 15-minute delayed; sentiment, news and Market Mood refresh on a schedule; filings land as published.
Other providers
SentiSense is not the right feed for every job. For tick-level quotes or long price history, Massive (formerly Polygon.io) and Twelve Data are the straightforward feeds; Financial Datasets reads SEC filings section by section; EODHD and Financial Modeling Prep carry the widest catalogs; Unusual Whales is the options-flow specialist; Alpaca adds order placement, a different job from research. Most ship an MCP server or a REST API, so the four paths above apply to them too. The MCP roundup compares eleven on data, freshness and free plans.
Questions people ask
Is the market data real-time? Quotes are 15-minute delayed. Sentiment, news and Market Mood are recomputed on a schedule rather than tick by tick, and filings-based data (insider, 13F, congressional) lands as the filings are published. That is the right shape for a research agent; a trading rule that needs every tick belongs on a tick feed.
Do I need MCP to connect market data to an AI agent? No. MCP is the no-code path for apps that support it, such as Claude, ChatGPT, Grok, Claude Code and Codex. An agent you write yourself calls the API through the Python or Node SDK as an ordinary tool, a shell-capable agent runs the CLI, and coding agents install the skills as files. All four reach the same data.
What does it cost to try? Nothing. A free API key covers 1,000 requests a month at up to 30 a minute, and MCP tool calls share that quota. Some lists come back as a preview of the top rows on the free plan. PRO is $15 a month at list price: unlimited monthly requests at up to 300 a minute.
Which stocks are covered? About 970 of the most-watched US-listed stocks, plus tracked ETFs, not every ticker. An uncovered symbol returns a 404 with a message saying so, which an agent can read and relay.
Can the agent place trades with this? No. Every endpoint is read-only: there is no order, trade or transfer call. The data is for research and education, not investment advice. Execution belongs to a brokerage integration with its own permissions.
A free key runs every command on this page. Get a free API key →