Stock data MCP server for backtesting with AI agents
Describe a strategy. Your agent finds the tickers, loads the files and runs the backtest.
Claude Code
claude mcp add --transport http stock-data-archive https://stockdataarchive.com/mcpAdd --scope user to the command to use the connection across all your projects. Claude Code setup guide (opens in a new tab)
Codex
codex mcp add stock-data-archive --url https://stockdataarchive.com/mcpThe CLI and the IDE extension share this configuration. Codex setup guide (opens in a new tab)
Cursor
{
"mcpServers": {
"stock-data-archive": {
"url": "https://stockdataarchive.com/mcp"
}
}
}Use ~/.cursor/mcp.json instead to make it available in all your projects. Cursor setup guide (opens in a new tab)
Claude
https://stockdataarchive.com/mcpAdd to Claude (opens in a new tab)A workspace owner may need to add the connector for your team. Claude setup guide (opens in a new tab)
ChatGPT
https://stockdataarchive.com/mcpOpen ChatGPT Plugins (opens in a new tab)Create it as a plugin and install it before you use it in a chat. Custom MCP access depends on your ChatGPT plan and workspace permissions. ChatGPT setup guide (opens in a new tab)
Backtest an idea with your agent
This is a real run on the free sample files.
Use the stock-data-archive MCP to backtest an opening range breakout on AAPL.
Use the stock-data-archive MCP to get the free sample files for AAPL (they are also listed at https://stockdataarchive.com/samples/index.json). Download them and backtest an opening range breakout on AAPL for November 9, 2026. Buy the first trade above the high of 9:30 to 10:00 AM and sell at 3:55 PM. Fill the buy at the ask and the sale at the bid. Then run it on the 1-minute bars and compare.- Got the AAPL sample files over MCP
- Loaded 754,422 trades and 517,808 quotes
- Wrote and ran backtest.py
AAPL broke above its 9:30 to 10:00 AM high at 10:24:57 AM. I bought at the ask and sold at the bid at 3:55 PM.
AAPLNovember 9, 2026
- Opening range high
- $350.34
- Breakout trade
- 10:24:57 AM
- Bought at the ask
- $350.35
- Sold at the bid
- $351.25
- Result on tick data
- +$0.90 a share
- Result on 1-minute bars
- +$0.965 a share
The 1-minute bars overstate this trade by 6.5 cents a share. That is the bid-ask spread, and only tick data has it.
Backtest ideas to hand your agent
Survivorship bias
Backtest 12-month momentum with and without delisted stocks.
Use Stock Data Archive daily bars to backtest 12-month momentum on every US stock since 2003. Run it once with delisted stocks and once without, and compare the returns.Gap fade
Fade opening gaps above 3% on NVDA since 2015.
Use Stock Data Archive 1-minute bars to backtest fading opening gaps above 3% on NVDA since 2015. Enter at 9:35 AM and exit at 11:00 AM.Cost of the spread
Measure what the bid-ask spread costs at the open on TSLA.
Use Stock Data Archive quotes to measure the bid-ask spread of TSLA in the first five minutes of each trading day in 2025, and what it costs a strategy that trades at the open.
What your agent looks up first
Each question takes one tool call. These answers came from the live server.
Is Lehman Brothers on file?
search_tickers({"query": "lehman", "limit": 3})
{
"query": "lehman",
"tickers": [
{
"symbol": "TBT",
"name": "ProShares Trust UltraShort Lehman 20+ Year Treasury",
"first_date": "2008-05-01",
"last_date": "2026-11-09"
},
{
"symbol": "LEH",
"name": "LEHMAN BROTHERS HOLDINGS",
"first_date": "2003-09-10",
"last_date": "2008-09-17"
},
{
"symbol": "PST",
"name": "ProShares Trust UltraShort Lehman 7-10 Year Treasury",
"first_date": "2005-04-04",
"last_date": "2026-11-09"
}
],
"note": "A symbol can be reused by a different company over the years, so check the dates. Call get_ticker for more."
}Which dates does AAPL have, and what does its tick data cost?
get_ticker({"symbol": "AAPL"})
{
"symbol": "AAPL",
"name": "Apple Inc.",
"first_date": "2003-09-10",
"last_date": "2026-11-09",
"trades_on_file": 1755725826,
"latest_day_on_file": "2026-11-09",
"has_data_on_latest_day": true,
"data": ["1-minute, 2-minute, 5-minute, 1-hour, daily bars", "trades", "quotes"],
"page_url": "https://stockdataarchive.com/stocks/aapl/",
"single_ticker_prices_usd": [
{
"product": "Tick data, single name, full history",
"price": 19,
"billing": "one-time"
}
],
"note": "Data covers only the dates the symbol traded. A symbol can be reused by a different company, so check the dates. Call list_products for every way to buy."
}Which files can I try for free?
get_sample_files()
{
"files": [
{
"file": "AAPL_2026-11-09_1min.parquet",
"url": "https://stockdataarchive.com/samples/AAPL_2026-11-09_1min.parquet",
"dataset": "1-minute bars",
"symbol": "AAPL",
"date": "2026-11-09",
"rows": 846,
"bytes": 25673,
"format": "Parquet",
"columns": ["symbol", "timestamp", "open", "high", "low", "close", "volume", "trade_count"]
},
{
"file": "AAPL_2026-11-09_trades.parquet",
"url": "https://stockdataarchive.com/samples/AAPL_2026-11-09_trades.parquet",
"dataset": "Trades (tick data)",
"symbol": "AAPL",
"date": "2026-11-09",
"rows": 754422,
"bytes": 12849823,
"format": "Parquet",
"columns": ["symbol", "ts_event", "ts_sip", "price", "size", "exchange", "sequence_number", "trade_id", "conditions", "correction", "tape", "trf_id", "ts_trf"]
},
{
"file": "AAPL_2026-11-09_quotes.parquet",
"url": "https://stockdataarchive.com/samples/AAPL_2026-11-09_quotes.parquet",
"dataset": "Quotes (tick data)",
"symbol": "AAPL",
"date": "2026-11-09",
"rows": 517808,
"bytes": 5462126,
"format": "Parquet",
"columns": ["symbol", "ts_event", "ts_sip", "bid_price", "ask_price", "bid_size", "ask_size", "bid_exchange", "ask_exchange", "sequence_number", "conditions", "indicators", "tape", "ts_trf"]
},
{
"file": "AAPL_daily.parquet",
"url": "https://stockdataarchive.com/samples/AAPL_daily.parquet",
"dataset": "Daily bars",
"symbol": "AAPL",
"date": null,
"rows": 5828,
"bytes": 235777,
"format": "Parquet",
"columns": ["symbol", "timestamp", "open", "high", "low", "close", "volume", "trade_count"]
}
],
"note": "Download a file by its url, then call get_file_format for how to load it."
}How do I load a 1-minute file with pandas?
get_file_format()
{
"formats": ["Parquet", "CSV"],
"datasets": [
{
"id": "minute",
"name": "1-minute bars",
"columns": ["symbol", "timestamp", "open", "high", "low", "close", "volume", "trade_count"]
},
{
"id": "day",
"name": "Daily bars",
"columns": ["symbol", "timestamp", "open", "high", "low", "close", "volume", "trade_count"]
},
{
"id": "trades",
"name": "Trades (tick data)",
"columns": ["symbol", "ts_event", "ts_sip", "price", "size", "exchange", "sequence_number", "trade_id", "conditions", "correction", "tape", "trf_id", "ts_trf"]
},
{
"id": "quotes",
"name": "Quotes (tick data)",
"columns": ["symbol", "ts_event", "ts_sip", "bid_price", "ask_price", "bid_size", "ask_size", "bid_exchange", "ask_exchange", "sequence_number", "conditions", "indicators", "tape", "ts_trf"]
}
],
"bar_timeframes": ["1-minute", "2-minute", "5-minute", "1-hour", "daily"],
"types": "In Parquet, timestamps are int64, prices, sizes and volume are decimal(38,12), and counts and codes are integers. Cast prices to float for charts and arithmetic.",
"timestamps": "Timestamps are integer nanoseconds since the Unix epoch, in UTC. A bar's timestamp marks the start of its interval. Tick rows carry two: ts_event from the exchange and ts_sip from the SIP.",
"trading_hours": "Bars cover pre-market, the regular session and after-hours, 4 AM to 8 PM Eastern. A minute with no trades has no bar. Convert to America/New_York so daylight saving is handled.",
"timeframes": "The 2-minute, 5-minute and 1-hour bars are built from the 1-minute bars and start on round clock times, Eastern.",
"adjustments": "Prices come unadjusted and adjusted for splits and dividends. The split and dividend files come with them.",
"load_with_pandas": "import pandas as pd\nbars = pd.read_parquet(\"AAPL_2026-11-09_1min.parquet\")\nbars[\"timestamp\"] = pd.to_datetime(bars[\"timestamp\"], unit=\"ns\", utc=True).dt.tz_convert(\"America/New_York\")\nprices = [\"open\", \"high\", \"low\", \"close\", \"volume\"]\nbars[prices] = bars[prices].astype(float)",
"docs_url": "https://stockdataarchive.com/docs/"
}What does every package cost?
list_products()
{
"currency": "USD",
"products": [
{
"id": "minute-all",
"name": "1-minute bars, full universe",
"price": 89,
"billing": "one-time",
"scope": "Every US stock and ETF since 2003, including delisted. 2-minute, 5-minute, 1-hour and daily bars included",
"on_sale": true
},
{
"id": "minute-sp500",
"name": "1-minute bars, S&P 500",
"price": 49,
"billing": "one-time",
"scope": "Full history for current S&P 500 members. 2-minute, 5-minute, 1-hour and daily bars included",
"on_sale": false
},
{
"id": "tick-ticker-full",
"name": "Tick data, single name, full history",
"price": 19,
"billing": "one-time",
"scope": "Every trade and quote for one symbol since 2003",
"on_sale": true
},
{
"id": "tick-sp500",
"name": "Tick data, S&P 500",
"price": 249,
"billing": "one-time",
"scope": "Every trade and quote for current S&P 500 members since 2003",
"on_sale": false
},
{
"id": "tick-all",
"name": "Tick data, full universe",
"price": 599,
"billing": "one-time",
"scope": "Every trade and quote for every US stock and ETF since 2003, including delisted",
"on_sale": true
},
{
"id": "t-plus-1",
"name": "Keep current: daily updates",
"price": 19,
"billing": "monthly",
"scope": "Files for each trading day, ready the next morning, for everything you bought. Bars and tick data are both covered",
"on_sale": false
}
],
"pricing_url": "https://stockdataarchive.com/pricing/"
}Download your purchases with an agent
After you buy, create an API token in your account and add it to the connection. Your agent then lists your purchases and downloads each file.
claude mcp add --transport http stock-data-archive https://stockdataarchive.com/mcp --header "Authorization: Bearer YOUR_TOKEN"Connect any MCP client
| Server URL | https://stockdataarchive.com/mcp |
|---|---|
| Transport | Streamable HTTP |
| Sign-in | None. The buyer tools take an API token in the Authorization header. |
| Protocol versions | 2026-07-28, 2025-11-25, 2025-06-18, 2025-03-26, 2024-11-05 |
MCP server questions
Is the stock data MCP server free?
Yes. Looking up tickers, dates, file formats, prices and sample files needs no account and no API token.
Does the MCP server return stock prices?
No. It tells your agent which tickers and dates are on file and how to load the files. Prices, trades and quotes are in the Parquet and CSV files you download.
Which AI agents can connect?
Claude Code, Codex, Cursor, Claude and ChatGPT, and any other MCP client that connects to a remote server over HTTP.
What is the MCP server URL?
https://stockdataarchive.com/mcp. It uses Streamable HTTP and needs no sign-in.
Can my agent download the files I bought?
Yes. Add an API token from your account to the connection, and your agent lists your purchases and downloads each file.