Chart Library
The Chart Library MCP Server gives AI agents access to 25M+ historical chart pattern embeddings across 19K+ stocks (drawn from 800M+ minute bars), enabling retrieval of empirical forward-return distributions — not predictions.
Core capabilities:
Search for similar chart patterns (
search_charts): Find historically similar charts for a given ticker and date, with match scores and similarity distances.Get forward return analysis (
get_follow_through): See what actually happened 1, 3, 5, and 10 days after historical matches, including percentage returns and cumulative paths.All-in-one pattern analysis (
analyze_pattern): Combine search, forward-return statistics, outcome distributions, and an AI-generated summary in a single call.AI-written pattern summaries (
get_pattern_summary): Plain-English summaries of pattern search results, including match count and forward return statistics.Daily top picks (
get_discover_picks): Retrieve the most interesting patterns from a nightly scan, ranked by interest score with confidence scores and predicted returns.Batch search (
search_batch): Search for patterns across up to 20 symbols simultaneously, with forward return statistics for each.Refined analysis with filters: Apply market regime, sector, liquidity, or event-based filters to refine results; get anomaly detection, volume profile analysis, crowding assessment, correlation shifts, earnings reaction analysis, and pattern degradation insights.
Portfolio-level analysis: Understand aggregate conditional return distributions across holdings and identify tail risk contributors.
Situational market data: Access ticker metadata, current market regime, sector rotation insights, and point-in-time regime data.
Database status (
get_status): Check total embeddings, coverage, date range, and symbol count.Feedback reporting: Submit feedback or suggest improvements.
Legacy tools are supported for backward compatibility, mapped to the canonical toolset.
Enables GitHub Copilot to retrieve historical stock chart patterns and forward return statistics via @mcp commands, supporting tools for search, cohort analysis, and scenario testing.
Chart Library MCP Server
Works with: Claude Desktop | Claude Code | ChatGPT | GitHub Copilot | Cursor | VS Code | Any MCP client
Ask your AI agent "what did this chart do last time it looked like this?" and get a real answer — backed by a cohort of historical analogs and the calibrated distribution of what came next.
25M+ pattern embeddings. 10 years of history. 19K+ stocks. One tool call.
> "What does NVDA's chart on 2024-08-05 1h look like historically?"
NVDA · 2024-08-05 · 1h — cohort of 500 historical analogs
(485 with realized 5-day returns)
Distribution at 5 days forward:
median: −1.3%
p10 ·· p90: −11.3% ·· +6.8% (80% empirical band)
win rate: 44%
cohort_score: 0.31 (modest)
Features that separated winners from losers:
+ credit_spread_state = tight
+ macro_state = bullish
+ pct_off_52w_low (further off)
− vol_regime = low
Summary: NVDA's 1-hour pattern on 2024-08-05 has 500 historical
analogs. The cohort's 5-day distribution is bearish-leaning
(median −1.3%, win rate 44%) — the historical record does NOT
show this pattern typically resolving bullish. Conditioning on
tight credit spreads and a bullish macro state would have
separated the outperformers within the cohort.A retrieval, not a forecast. No hallucinated predictions. No cherry-picking. Just the empirical record your agent can cite.
Quick Start
pip install chartlibrary-mcpClaude Desktop (One-Click Install)
Download the chart-library-1.1.1.mcpb extension file and open it with Claude Desktop for automatic installation.
Claude Code
claude mcp add chart-library -- chartlibrary-mcpClaude Desktop (Manual)
Add to claude_desktop_config.json:
{
"mcpServers": {
"chart-library": {
"command": "chartlibrary-mcp",
"env": {
"CHART_LIBRARY_API_KEY": "cl_your_key"
}
}
}
}Cursor / VS Code
Add to .cursor/mcp.json or VS Code MCP settings:
{
"servers": {
"chart-library": {
"command": "chartlibrary-mcp",
"env": {
"CHART_LIBRARY_API_KEY": "cl_your_key"
}
}
}
}GitHub Copilot (VS Code)
Add to .vscode/mcp.json in your project (this file is already included in the chart-library repos):
{
"servers": {
"chart-library": {
"command": "chartlibrary-mcp",
"env": {
"CHART_LIBRARY_API_KEY": "cl_your_key"
}
}
}
}Copilot Chat will auto-detect the MCP server when you open the project. Use @mcp in Copilot Chat to invoke tools.
ChatGPT (Developer Mode)
ChatGPT connects to MCP servers via remote HTTP endpoints. To set up:
Enable Developer Mode: Go to ChatGPT Settings > Apps > Advanced settings > Developer mode (requires Pro, Plus, Business, Enterprise, or Education plan)
Create a connector: In Settings > Connectors, click Create and enter:
Name: Chart Library
Description: Historical chart pattern search engine — 25M+ patterns across 19K+ stocks, 10 years of data
URL:
https://chartlibrary.io/mcpAuthentication: No Authentication (or OAuth if using an API key)
Use in conversations: Select "Developer mode" from the Plus menu, choose the Chart Library app, and ask questions like "What does NVDA's chart look like historically?"
Note: The remote endpoint at
https://chartlibrary.io/mcpuses Streamable HTTP transport. If you need SSE fallback, usehttps://chartlibrary.io/mcp/sse.
Remote MCP Endpoint
For any MCP client that supports remote HTTP connections:
https://chartlibrary.io/mcpThis endpoint supports both Streamable HTTP and SSE transports, no local installation required.
Free tier: 200 calls/day, no credit card required. Get an API key at chartlibrary.io/developers or use basic search without one.
What Can Your Agent Do With This?
"Should I be worried about my TSLA position?"
> get_exit_signal("TSLA")
Signal: HOLD (confidence: 72%)
Similar patterns that exited early: 3/10 would have avoided a drawdown
Similar patterns that held: 7/10 gained an additional +2.1% over 5 days
Recommendation: Pattern suggests continuation. No exit signal triggered."What sectors are rotating in right now?"
> get_sector_rotation()
Leaders (30-day relative strength):
1. XLK Technology +4.2%
2. XLY Cons. Disc. +3.1%
3. XLC Communication +2.8%
Laggards:
9. XLU Utilities -1.4%
10. XLP Cons. Staples -2.1%
11. XLRE Real Estate -3.3%
Regime: Risk-On (growth > defensives)"What happens to AMD if SPY drops 3%?"
> run_scenario("AMD", spy_change=-3.0)
When SPY fell ~3%, AMD historically:
Median move: -5.2%
Best case: +1.1%
Worst case: -11.4%
Positive: 18% of the time
AMD shows 1.7x beta to SPY downside moves.8 Canonical Tools
Chart Library 2.0 consolidates 22 legacy tools into 8 composable primitives. Chain them via cohort_id handles for sub-second refinement without re-running kNN.
Tool | What it does |
| Entry point. Returns |
| The core primitive. Conditional distribution (p10/p25/p50/p75/p90 + calibrated bands + MAE/MFE + hit rates + survivorship) for a chart pattern, filtered by regime/sector/liquidity/event. One call replaces the legacy |
| Analytic metrics via |
| Situational data via |
| Narrative + rankings via |
| Portfolio-level conditional distribution across holdings. Weight-averages distributions, ranks tail contributors. |
| New in 2.0. Lightweight (symbol, date) metadata fetch — sector, market cap, point-in-time regime. Avoids full kNN when you just need context for a ticker. |
| Report errors or suggest improvements. |
These tools replace hallucinated "on average this pattern returns X%" with real conditional base rates. See the grounded-base-rates pattern for the full loop.
Typical agent flow
1. search("NVDA 2024-06-18") → cohort_id
2. cohort(cohort_id=..., filters={regime:{same_vix_bucket: true}})
→ conditional distribution
3. explain(cohort_id=..., style="filter_ranking") → which filter matters most
4. cohort(cohort_id=..., filters={...new filter...}) → refined distributionLegacy tools (deprecated, still callable)
For backward compatibility, these 22 legacy tool names remain in place and are marked
deprecated in their MCP annotations. They forward to the canonical tool and will be
removed in a future major release. Migrate via the mapping below:
Legacy | Replacement |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
How It Works
Chart Library indexes a large library of historical chart patterns and exposes them behind a conditional-distribution API. Every query returns sample sizes, percentiles, and calibrated forward-return bands — never a point forecast.
When your agent calls analyze_pattern("NVDA"), the server:
Builds a representation of NVDA's current chart state
Retrieves historically similar patterns
Looks up what happened over the following 1, 3, 5, and 10 days
Returns the distribution + a plain-English summary via Claude Haiku
The result: factual, citation-ready statements like "out of N similar historical patterns, the median 5-day return was X% (80% band [p10, p90])" that your agent can present without hallucinating or hedging.
API Key
Tier | Calls/day | Price |
Sandbox | 200 | Free |
Builder | 5,000 | $29/mo |
Scale | 50,000 | $99/mo |
Get your key at chartlibrary.io/developers.
export CHART_LIBRARY_API_KEY=cl_your_keyLinks
Chart Library provides historical pattern data for informational purposes. Not financial advice.
Maintenance
Latest Blog Posts
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/grahammccain/chart-library-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server