BLOG

Behind the numbers.

Code examples, market analysis, and data quality deep-dives.

How to Give an LLM Financial Data With an MCP Server
Does Post-Earnings Announcement Drift Survive Real Filing Dates? PEAD Event Study in Python
Do Insider Buying Clusters Predict Returns? Signal Testing in Python
Does the S&P 500 Index Effect Still Exist? Event Study in Python
Are Companies Leaving the S&P 500 Faster Than They Used To? Index Survival Analysis in Python
Does Gross Profitability Predict Stock Returns? Quintile Factor Test in Python
What Growth Rate Is the Market Pricing In? Reverse DCF in Python
Does a Strong Balance Sheet Cushion Drawdowns? Leverage and Downside Risk in Python
Does Ticker Recycling Corrupt a Mean-Reversion Backtest? Entity-Resolved Z-Scores in Python
How Much of a Growth Screen's Backtested Edge Is Survivorship Bias? Point-in-Time Index Testing in Python
Why Do Leveraged ETFs Decay? Measuring Volatility Drag in Python
Are Consumer Staples Margins Shrinking Under Inflation? Gross Margin Trend Analysis in Python
Do Weak Jobs Reports Predict Market Drawdowns? NFP Surprise Event Study in Python
Is the Rotation From Tech to Industrials Backed by Earnings? Relative EPS Growth Analysis in Python
Is the Semiconductor Rally Broadening Beyond NVIDIA? Return Dispersion Analysis in Python
Which Stocks Benefit Most When Oil Prices Fall? Oil Beta Screening in Python
Do Bond Returns Predict Stock Returns? Granger Causality Test in Python
Which Stocks Actually Drive Portfolio Returns? Shapley Value Attribution in Python
Does "Sell in May" Still Work? Calendar Anomaly Backtest in Python
How to Build Complete Price History Through Ticker Changes? Entity Resolution in Python
Are KO and PEP Cointegrated? Pairs Trading Signal Construction in Python
Which Commodities Have the Strongest Momentum? Rotation Backtest in Python
Which Commodity ETFs Have the Worst Tail Risk? Expected Shortfall in Python
Are Gold Miners Leveraged Gold Bets? Rolling Beta Analysis in Python
Does the Base-Metals-to-Gold Ratio Lead Cyclical Stocks? Signal Test in Python
Can Risk Parity Tame Commodity Volatility? Portfolio Optimization in Python
Are Power Stocks Becoming an AI Infrastructure Trade? Momentum Screening in Python
Which AI Chip Stocks Have Margin Momentum? Profitability Trend Analysis in Python
Which AI Stocks Are Cheapest Relative to Growth? Growth-Adjusted Valuation in Python
Does AI Stock Leadership Persist? Momentum Backtest in Python
Which AI Stocks Have the Cleanest Balance Sheets? Net Cash Screening in Python
Can Risk Parity Reduce Mega-Cap Drawdowns? Portfolio Optimization in Python
Which Growth Stocks Are Self-Funding? Cash-Flow Quality Screening in Python
Which Sectors Struggle When the Dollar Rallies? Sector Rotation Analysis in Python
Do Cheap Stocks Hold Up When Bonds Sell Off? Valuation Rotation in Python
Does the Nasdaq 100 Have Better Growth Quality Than the Dow? Index Constituent Analysis in Python
Do Healthcare Cash-Flow Margins Predict Returns? Signal Evaluation in Python
Which Dividend Stocks Survive a Cash-Flow Stress Test? Dividend Screening in Python
Does Heavy Insider Selling Predict Weak Returns? Insider Flow Test in Python
Can Quality Screens Reduce Small-Cap Balance-Sheet Risk? Russell 2000 Test in Python
Which Retailers Have Positive Operating Leverage? Margin Screening in Python
Is MSTR a Leveraged Bitcoin Proxy? Rolling Beta Analysis in Python
Is Micron's Memory Cycle Recovering? Inventory and Margin Forecasting in Python
Which Sectors Work When Bonds Rally? Rate-Sensitive Rotation in Python
Do One-Month Price Extremes Reverse? Signal Evaluation in Python
Do Low-Volatility S&P 500 Stocks Reduce Drawdowns? Factor Test in Python
Is AI Capex Paying Back Fast Enough? Revenue Hurdle Forecasting in Python
Could Shorter AI Asset Lives Hit Earnings? Depreciation Stress Test in Python
How Much AI Capex Risk Can a Portfolio Remove? Constrained Optimization in Python
Is the AI Capex Trade Crowded? Rolling Volatility and Sector Rotation in Python
Did the AI Boom Come From Existing S&P 500 Members? Point-in-Time Momentum Test in Python
Is AI Revenue Circular? Customer-Vendor Capex Loop Analysis in Python
Is the AI Trade Connected to Private Credit? Rolling Correlation Network in Python
Is Apollo More Balance-Sheet Sensitive Than Peers? Leverage Screen in Python
Are AI Earnings Supported by Cash Flow? Accrual and Capex Screen in Python
Can Defensive Stocks Hedge AI Drawdowns? Basket Regime Test in Python
How Fast Does the Market Price In Fed Decisions? FOMC Event Study in Python
How Much Are Options Sellers Overpaid? The Variance Risk Premium in Python
Which Companies Have the Worst Earnings Quality? Sloan Accrual Screen with Geographic Revenue Data in Python
Does the Oil-to-Gold Ratio Signal Recessions? XLE/GLD Backtest in Python
Is AI Spending Crowding Out Free Cash Flow? Capex Sustainability Across the Mag 7 in Python
Does a Long Energy / Short Bonds Portfolio Capture Inflation Surprises? Factor Construction in Python
Can a Hidden Markov Model Detect Oil Market Regimes? HMM Analysis in Python
Do Grain Prices Predict Food Inflation? Granger Causality Test in Python
Does the Corporate Credit Spread Predict Stock Market Crashes? BAA-AAA Spread Analysis in Python
Do Oil Stocks Hedge Inflation? Rolling Beta Analysis in Python
Which Stocks Are Most Rate-Sensitive? Equity Duration via Bond Beta in Python
Which Companies Have the Highest Accrual Ratios? Earnings Quality Screening in Python
Is Alpha Persistent or Decaying? Rolling Sharpe Ratio Analysis in Python
Are Markets Trending or Mean-Reverting? Hurst Exponent Analysis in Python
Is Consumer Discretionary vs Staples a Leading Indicator? XLY/XLP Ratio Analysis in Python
Does Heavy Capex Predict Future Stock Returns? Capital Expenditure Analysis in Python
How to Estimate Cost of Equity Using CAPM in Python
Is Volatility Predictable? Testing for Volatility Clustering in Python
Which Industrials Are Overleveraged? Net Debt to EBITDA Screening in Python
GM Before and After Bankruptcy: Why Entity Resolution Matters for Financial Data
What Is Adjusted Beta? Merrill Lynch Beta Shrinkage in Python
How Good Is a Stock Pick? Information Ratio and Tracking Error in Python
Do Stock Returns Follow a Normal Distribution? Testing for Fat Tails in Python
Which Large Caps Have the Highest Free Cash Flow Yield? FCF Screening in Python
Which Sectors Won Over 5 Years? Sector Rotation Analysis in Python
How to Forecast Stock Volatility with GARCH Models in Python
Are Stock Prices Mean-Reverting? Augmented Dickey-Fuller Test in Python
How to Calculate CAPM Alpha and Beta with Regression in Python
How to Compare Sector Sharpe Ratios and Sortino Ratios in Python
DELL: Why Stitching Historical Price Data Together Is Wrong
How to Analyze Drawdown and Recovery for Bank Stocks in Python
How to Screen SaaS Stocks by Revenue Growth and Cash Flow in Python
How to Screen REITs by Dividend Yield and Valuation in Python
How Correlated Are the Magnificent 7? Intra-Group Correlation in Python
AAPL vs XOM: Do Individual Stocks Have Seasonal Patterns?
How to Rank Large-Cap Stocks by Momentum in Python
How to Build a Multi-Endpoint Financial Dashboard in Python
How to Compare Volatility Across Energy Stocks in Python
How to Screen Healthcare Stocks by Valuation in Python
How to Build a Sector Correlation Matrix for Portfolio Diversification in Python
How to Find Oversold and Overbought Stocks Using Z-Scores in Python
How to Measure Earnings Quality: Cash Flow vs Net Income in Python
How to Build a Multi-Factor Stock Screen in Python (Value + Momentum + Quality)
How to Build a Simple DCF Model for Any Stock in Python
How to Screen Tech Stocks by Revenue Growth in Python
How to Screen Stocks by Balance Sheet Health in Python
Is "Sell in May" Real? SPY Monthly Seasonality Over 10 Years
How to Compare Sector Performance YTD Using Python
How to Screen Dividend Stocks by Yield and Quality in Python
How to Calculate Max Drawdown and Recovery Time for Any Stock in Python
How to Compare Profitability Across Mega-Cap Tech Stocks in Python
Why Ticker Symbols Are Unreliable: The Recycling Problem Every Quant Should Know
How to Calculate and Compare Stock Volatility in Python
How to Screen Blue-Chip Stocks by P/E Ratio in Python
How to Track Companies Through Ticker Changes, Bankruptcies, and Renames in Python
S&P 500 Turnover: How Much the Index Has Changed Since 2010
How to Calculate Stock Beta and Correlation in Python
← All articles

How to Give an LLM Financial Data With an MCP Server

An MCP server is the piece that lets a chat model read real market data instead of recalling something from its training run: paste a server URL into the client’s connector settings, and the model starts answering price and financial-statement questions by calling a vendor API. Alpha Vantage, Massive, and xfinlink each publish one as of 26 July 2026. For the hosted versions there is nothing to install and no code to write.

What does an MCP server actually do?

MCP, the Model Context Protocol, is an open standard for advertising tools to a language model. The server publishes a list of tools, each with a description and a JSON schema for its arguments; the model picks one, sends arguments, and receives structured JSON in return. Because the list is discoverable, the client learns what is available at connection time rather than from a system prompt somebody has to keep current.

Asking the xfinlink server what it offers returns eight tools:

# free at https://xfinlink.com/signup
curl -s -X POST "https://api.xfinlink.com/mcp?api_key=YOUR_API_KEY" \
  -H 'Content-Type: application/json' \
  -H 'Accept: application/json, text/event-stream' \
  -d '{"jsonrpc":"2.0","id":1,"method":"tools/list"}'

Output:

['get_prices', 'get_fundamentals', 'get_metrics', 'resolve_ticker',
 'search', 'get_index', 'get_index_events', 'get_insiders']

A model with no data connection, asked for Apple’s closing price last Tuesday, has two options: decline, or produce a number that looks right. Training cutoffs make the second outcome common, and the fabricated number arrives in the same confident prose as a real one. A tool call removes the guess for anything the tools cover, and it leaves an inspectable record of what was requested.

Which vendors publish a financial data MCP server?

Every figure below was checked against the vendor’s own pages on 26 July 2026. Terms move, so confirm before committing.

Vendor Hosted server Auth Tool design Free tier
Alpha Vantage https://mcp.alphavantage.co/mcp, plus a local stdio option via uvx OAuth on the remote server 100+ tools across nine categories, including options, technical indicators, forex and economic series 25 API requests per day; premium plans start at $49.99/month
Massive https://mcp.massive.com/ OAuth A small composable set: search the endpoint catalogue, read parameter documentation, then execute a REST call Not stated on the AI-tools quickstart page
xfinlink https://api.xfinlink.com/mcp?api_key=YOUR_API_KEY API key in the URL Eight tools, one per endpoint: prices, fundamentals, metrics, entity resolution, search, index constituents, index events, insider filings 100 requests per day on a rolling one-year history window; Pro $29/month unlocks full history
yfinance None documented n/a Python library only: Ticker, Tickers, download() Free library, no key

Sources for each row: the Alpha Vantage MCP repository and its premium pricing page; the Massive AI tools quickstart, noting that polygon.io returns a 301 redirect to massive.com; the xfinlink docs and pricing page; the yfinance documentation, which states that the project is not affiliated with or endorsed by Yahoo and that the underlying API is intended for personal use.

Pick on coverage first. Options chains, intraday bars and technical indicators point at Alpha Vantage or Massive. Daily US equity history, SEC-filing fundamentals and index membership are what the xfinlink tools return. yfinance remains a reasonable free downloader for a hobby project, but reaching it from a chat client means writing the wrapper yourself.

How do you connect one?

Two shapes cover almost every client. Web products (claude.ai, ChatGPT with developer mode enabled, Perplexity, Grok) take a name and a server URL in a connectors settings page. Desktop and IDE products take a JSON block. Cursor reads .cursor/mcp.json:

{
  "mcpServers": {
    "xfinlink": {
      "url": "https://api.xfinlink.com/mcp?api_key=YOUR_API_KEY"
    }
  }
}

Claude Desktop expects the same server behind mcp-remote in claude_desktop_config.json, and needs a restart afterwards. Step-by-step instructions for each client are in the xfinlink docs.

What comes back from a tool call?

Here is the raw result of get_prices for Apple over five sessions, truncated to two rows and reformatted for width. This is what the model reads before it writes a sentence:

{"data":[
 {"entity_id":1,"ticker":"AAPL","entity_name":"Apple Inc","gics_sector":"Information Technology",
  "date":"2026-07-23","open":321.73,"high":323.3,"low":319.35,"close":321.66,"adj_close":321.66,
  "volume":40795222,"return_daily":-0.0129798398232531,"shares_outstanding":15115823000,
  "split_ratio":null,"dividend":null},
 {"entity_id":1,"ticker":"AAPL","entity_name":"Apple Inc","gics_sector":"Information Technology",
  "date":"2026-07-24","open":322.04,"high":334.37,"low":321.62,"close":333.02,"adj_close":333.02,
  "volume":47402209,"return_daily":0.0353167941304482,"shares_outstanding":15115823000,
  "split_ratio":null,"dividend":null}],
 "meta":{"tickers_resolved":{"AAPL":1},"interval":"1d","data_through":"2026-07-24",
  "count":5,"has_more":false}}

Three details in that payload change how an answer should be read. close is the raw traded price and steps across split dates; adj_close carries the split adjustment; return_daily is the total return including dividends. The tool descriptions state those conventions, so a model that reads them will usually pick the right column, and meta.data_through tells it how fresh the series is instead of leaving it to assume today.

Why does the model need to know which company held a ticker?

Ask about GM in 2008 and the honest answer is a question back: which General Motors? The pre-bankruptcy corporation and the company that listed in 2010 are separate legal entities that share three letters. resolve_ticker returns both:

{"data":{"GM":{"entities":[
  {"entity_id":4,"name":"General Motors Corporation (pre-2009 bankruptcy)",
   "entity_type":"corporation","country":"US","cik":"0000040730"},
  {"entity_id":5,"name":"General Motors Company",
   "entity_type":"corporation","country":"US","cik":"0001467858"}]}}}

Each carries its own SEC Central Index Key and its own permanent entity ID, and the price and fundamentals tools key on that ID rather than on the ticker string. The same mechanism keeps a series intact through a rename: Facebook to Meta, or the several symbols Travelers has traded under. An agent that stitches history by ticker alone will silently glue two companies together, which is what ticker recycling does to a backtest, and the GM case shows the shape of the damage.

What to check before wiring a server into an agent

Read the tool descriptions first. They are the only documentation the model gets, and a server whose descriptions omit adjustment conventions will produce answers that are wrong in ways the transcript does not reveal.

Then the boring operational things. Check where the key lives: a key in a URL is convenient and ends up in client config files, whereas OAuth keeps it out of them. Check the row cap per call, because a tool that silently returns the first hundred rows of a five-year request will make a model narrate a truncated series as if it were complete. Check the daily request budget against how chatty your agent is; a single research question can fire a dozen tool calls.

FAQ

Does an MCP server stop a model inventing numbers?
It removes the reason to invent them for anything the tools cover. The model can still misread a column or aggregate badly, so for anything that matters, ask it to show the tool output alongside its answer.

Do I need to be able to code to use one?
No. The hosted servers need a URL pasted into a settings page, and the model writes the queries. Code becomes worthwhile when the same analysis runs on a schedule, at which point the underlying REST API or Python client is the better target.

Can an MCP server run a screen across hundreds of tickers?
Within limits. Per-call ticker caps and row caps apply the same way they do over REST, so wide screens work better as a batched script than as a chat request.

Is there an official yfinance MCP server?
Not in its documentation, which covers Ticker, Tickers and download() and makes no mention of MCP as of 26 July 2026. Community wrappers exist, and they inherit yfinance’s own terms.

Built with xfinlink — free financial data API for Python. pip install xfinlink

Built with xfinlink — free financial data API for Python. pip install xfinlink
← All articles