Yahoo Finance MCP Server
A Model Context Protocol (MCP) server that provides Yahoo Finance data through FastMCP v2 with HTTP streaming support. This server enables AI assistants to access real-time financial data, historical prices, company information, and market analysis tools. The server is primarily built for ThinkingSand AI agents, but can be deployed locally as well.
Features
Real-time Stock Data: Current prices, historical data, and company information
Financial Statements: Income statements, balance sheets, and cash flow data
Options Trading: Option chains, expiration dates, and pricing data
Market News: Latest financial news and analysis
Institutional Data: Holder information and insider transactions
Analyst Coverage: Recommendations and upgrades/downgrades
HTTP Streaming: Fast, efficient data delivery with FastMCP v2
Related MCP server: Yahoo Finance MCP Server
Available Tools
Tool | Description | Parameters |
| Historical stock price data |
,
,
|
| Comprehensive company and stock information |
|
| Latest news articles for a stock |
|
| Dividend and stock split history |
|
| Financial statements (income, balance, cashflow) |
,
|
| Institutional and insider holder data |
,
|
| Available options expiration dates |
|
| Option chain data for calls and puts |
,
,
|
| Analyst recommendations and upgrades |
,
,
|
Installation & Setup
Prerequisites
Python 3.11 or higher
uv package manager
Using uv (Recommended)
Configuration
Environment Variables
Create a .env file (copy from .env.example):
Starting the Server
The server will start on http://127.0.0.1:8000 by default and display:
Tool Documentation
1. Historical Stock Prices
ticker: Stock symbol (e.g., "AAPL", "TSLA", "GOOGL")
period:
1d,5d,1mo,3mo,6mo,1y,2y,5y,10y,ytd,maxinterval:
1m,2m,5m,15m,30m,60m,90m,1h,1d,5d,1wk,1mo,3mo
2. Stock Information
Returns comprehensive company data including current price, market cap, financial metrics, and company details.
3. Financial Statements
financial_type:
income_stmt,quarterly_income_stmt,balance_sheet,quarterly_balance_sheet,cashflow,quarterly_cashflow
4. Holder Information
holder_type:
major_holders,institutional_holders,mutualfund_holders,insider_transactions,insider_purchases,insider_roster_holders
5. Options Data
option_type:
callsorputs
6. Recommendations
recommendation_type:
recommendations,upgrades_downgradesmonths_back: Number of months for historical upgrades/downgrades
MCP Client Integration
Claude Desktop
Add to your Claude Desktop MCP settings (~/.claude/claude_desktop_config.json):
HTTP Client Integration
Connect directly to the HTTP endpoint:
Python Client Example
Project Structure
Error Handling
The server includes robust error handling:
Invalid tickers: Returns clear error messages for non-existent symbols
Missing data: Graceful handling when specific data isn't available
Network issues: Proper error reporting for Yahoo Finance API issues
Parameter validation: Clear error messages for invalid parameters
Example error response:
Data Sources
All financial data is sourced from Yahoo Finance through the yfinance Python library:
Stock prices: Real-time and historical market data
Company information: Fundamentals, metrics, and company details
Financial statements: Official SEC filings and quarterly reports
Options data: Real-time options chains and pricing
News: Latest financial news and analyst coverage
Institutional data: Holdings and insider transaction data
Production Deployment
Docker (Optional)
Environment Variables for Production
Contributing
Fork the repository
Create a feature branch
Add new tools or improve existing ones
Update tests and documentation
Submit a pull request
License
This project is open source. Yahoo Finance data is subject to Yahoo's terms of service.
Troubleshooting
Common Issues
Server won't start: Check if port 8000 is available
Tool failures: Verify internet connection for Yahoo Finance API
Import errors: Ensure all dependencies are installed with
uv sync
Debug Mode
Set LOG_LEVEL=DEBUG in your .env file for detailed logging.
Support
FastMCP Issues: FastMCP Documentation
Server Issues: Open an issue in this repository
Built with FastMCP v2 and yfinance