Ask any LLM "is NVDA bullish here?" and it will answer with total confidence — a cup-and-handle here, a win rate there, an "expect a 4% move." The problem: most of it is invented. Language models are fluent in the vocabulary of technical analysis but have no grounded source for the numbers. They'll give you a win rate they made up.
If you're building an agent that touches markets, that's a real liability. The fix isn't a better prompt — it's a grounded tool the agent can call instead of guessing.
The idea: a base-rate engine, exposed over MCP
Chart Library is an MCP server that answers one question with real history: "given a setup that looks like this, what did statistically similar setups do next?" It returns the cohort of ~40–50 historical analogs across 10 years and 19K+ symbols, plus the forward-return distribution (median, win rate, percentile bands) — every number a verified historical fact, not a generation.
Because it speaks the Model Context Protocol, any MCP-aware client — Claude Desktop, Cursor, Cline, LangChain, the OpenAI Agents SDK — can use it in a couple of lines.
30 seconds to grounded answers
pip install chartlibrary-mcp
LangChain / LangGraph:
from langchain_mcp_adapters.client import MultiServerMCPClient
from langgraph.prebuilt import create_react_agent
from langchain_anthropic import ChatAnthropic
import os, asyncio
async def main():
client = MultiServerMCPClient({
"chartlibrary": {
"command": "chartlibrary-mcp",
"transport": "stdio",
"env": {"CHART_LIBRARY_API_KEY": os.environ["CHART_LIBRARY_API_KEY"]},
}
})
agent = create_react_agent(ChatAnthropic(model="claude-sonnet-4-6"),
await client.get_tools())
out = await agent.ainvoke({"messages": [{"role": "user",
"content": "What did setups like NVDA on 2024-08-05 do next? Cite the 5-day distribution."}]})
print(out["messages"][-1].content)
asyncio.run(main())
The agent calls the cohort tool, gets the real distribution, and answers from it. No hallucinated stats.
The honest part (which is the whole point)
Here's something most "AI alpha" tools won't tell you, validated on 300K+ historical observations: chart shape predicts the size of the next move far better than the direction. Conditioning on a "bullish-looking" cohort earns a real magnitude edge (bigger average moves) but no win-rate edge — direction stays a coin flip. Our backtest shows it cleanly: a "cohort bullish" rule prints +0.77% avg vs +0.34% baseline, but 52% wins vs 54% baseline.
That's not a bug — it's the truth, and it's why grounding matters. A tool that returns calibrated base rates (and tells you when it doesn't know) is more useful to an agent than one that confidently predicts a direction it can't.
What the agent gets
Eight read-only tools (all annotated readOnlyHint): search, cohort (the distribution primitive), discover, analyze, context, narrative, explain, portfolio. Free Sandbox tier (200 calls/day, no auth) covers search + context + explain; the full cohort depth is a paid tier.
Try it
- Install:
pip install chartlibrary-mcp - Docs + setup for every client: https://chartlibrary.io/guides/mcp-server-for-finance
- It's in the official MCP Registry (
io.github.grahammccain/chart-library)
If you're building anything that reasons about markets, give your agent a source of truth instead of a confident guess.
























