Yahoo Finance MCP Server
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Yahoo Finance MCP Server What's Apple's current stock price and PE ratio?"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Yahoo Finance MCP Server
An MCP (Model Context Protocol) server that provides access to Yahoo Finance data using the yfinance Python package. This server enables AI assistants to fetch real-time stock quotes, historical data, financial statements, analyst recommendations, earnings information, options chains, and news.
Built following MCP best practices with proper tool naming, response format options, character limits, and comprehensive error handling.
Features
This MCP server provides 10 comprehensive tools:
Stock Information
yfinance_get_stock_info: Get comprehensive stock information (price, market cap, PE ratio, sector, etc.)
yfinance_get_stock_history: Retrieve historical price data with customizable periods and intervals
yfinance_get_multiple_quotes: Get current quotes for multiple stocks simultaneously
yfinance_search_stocks: Search and validate stock tickers
Financial Analysis
yfinance_get_stock_financials: Access financial statements (income statement, balance sheet, cash flow)
yfinance_get_earnings_dates: Get earnings calendar with historical and upcoming dates, EPS estimates
yfinance_get_options_chain: Retrieve options data (calls/puts) with choice of expiration dates
Market Intelligence
yfinance_get_stock_recommendations: Get analyst recommendations and rating changes
yfinance_get_stock_news: Fetch recent news articles related to stocks
Key Features
✅ Dual response formats: JSON (structured) and Markdown (human-readable)
✅ Character limits: Automatic truncation at 25,000 characters with clear guidance
✅ Tool annotations: All tools properly annotated with
readOnlyHintandopenWorldHint✅ Comprehensive error handling: Actionable error messages that guide next steps
✅ MCP naming conventions: All tools prefixed with
yfinance_to prevent conflicts
Related MCP server: StockQuotes MCP
Installation
Prerequisites
Python 3.10 or higher
uv (Python package manager)
Setup
Clone or navigate to this directory:
cd yfinance-mcpInstall dependencies with uv:
uv syncConfiguration
To use this MCP server with Claude Desktop or other MCP clients, add it to your MCP settings configuration file.
Claude Code
First, install Claude Code:
npm install -g @anthropic-ai/claude-codeUse the following command to add the yfinance MCP server to your local environment.
This assumes uvx is in your $PATH; if not, provide the full path to uvx.
claude mcp add yfinance -- uvx --from git+https://github.com/mobatmedia/yfinance-mcp yfinance-mcpThis command will install the MCP server in your current project.
If you want to install it globally, run the command with -s user flag.
To start Claude Code, run claude in your terminal.
You can also run claude mcp add-from-claude-desktop if the MCP server is installed already for Claude Desktop.
Claude Desktop
Follow the Claude Desktop MCP installation instructions to complete the initial installation and find your configuration file.
Use the following example as reference to add the yfinance MCP server.
Find your path to
uvxby runningwhich uvxin your terminal.Replace
<your_home_directory>with your home directory path.
Configuration file locations:
Windows:
%APPDATA%\Claude\claude_desktop_config.jsonmacOS:
~/Library/Application Support/Claude/claude_desktop_config.jsonLinux:
~/.config/Claude/claude_desktop_config.json
{
"mcpServers": {
"yfinance": {
"command": "<path_to_your_uvx_install>/uvx",
"args": [
"--from",
"git+https://github.com/mobatmedia/yfinance-mcp",
"yfinance-mcp"
],
"env": {
"HOME": "<your_home_directory>"
}
}
}
}Transport Configuration
By default, STDIO transport is used.
To configure SSE or Streamable HTTP, set the MCP_TRANSPORT environment variable.
Example:
MCP_TRANSPORT=streamable-http uv run entrypoint.pyUsage
Running the Server Standalone
You can test the server by running it directly:
uv run yfinance-mcpExample Queries (via Claude Desktop)
Once configured with Claude Desktop, you can ask questions like:
Stock Information:
"What's the current stock price of Apple?"
"Show me comprehensive info for TSLA in JSON format"
"Compare quotes for AAPL, MSFT, and GOOGL"
"What sector and industry is Microsoft in?" (uses fields parameter)
"Just show me the price and PE ratio for NVDA" (uses fields parameter)
"Get just the basic valuation metrics for AAPL" (uses fields parameter)
Historical Data:
"Show me Tesla's price history over the past 6 months"
"Get AAPL historical data for the past year with weekly intervals"
"Show me just the last week of trading data for GOOGL"
"What were the last 30 days of price data for MSFT?" (uses limit parameter)
"Give me a summary of AAPL's price performance over the last year" (uses summary parameter)
"What's the high, low, and average price for TSLA this year?" (uses summary parameter)
Financial Statements:
"Get Microsoft's income statement"
"Show me Apple's balance sheet in JSON format"
"What's Google's cash flow statement?"
"What's Tesla's total revenue for the most recent quarter?" (quarterly by default, uses fields and limit parameters)
"Show me just the revenue and net income for AAPL over the last 2 quarters" (uses fields and limit parameters)
"Get the key profitability metrics from MSFT's latest income statement" (uses fields and limit parameters)
"Show me AAPL's annual revenue for the past 3 years" (uses period='annual' parameter)
Earnings & Options:
"When is Apple's next earnings call?"
"Show me the earnings history for MSFT"
"What expiration dates does SPY have for options?" (uses fields=["expiration_dates"])
"What are the 3 closest option expiration dates around December 15 for AAPL?" (uses target_date="2024-12-15", limit=3, fields=["expiration_dates"])
"Show me options expiring around 30 days from now for SPY" (uses dte=30)
"Get 3 monthly expiration dates near 30 days out for TSLA" (uses dte=30, limit=3, fields=["expiration_dates"])
"Get the options chain for TSLA"
"Show me the SPY options chain for weekly expiration" (uses dte=7, shows actual option contracts)
"Get AAPL call options expiring in about 30 days" (uses dte=30, option_type="calls")
"Show me options for the 2 closest expirations around January 15" (uses target_date="2025-01-15", limit=2)
"Get highly liquid call options for SPY expiring next week" (uses dte=7, min_volume, min_open_interest)
"Show me protective put options for AAPL with monthly expiration" (uses dte=30, option_type="puts", in_the_money=True)
"What are the next 3 upcoming earnings dates for GOOGL?" (uses future_only and limit parameters)
"Show me just the last 4 earnings reports for NVDA" (uses limit parameter)
"When are the next earnings calls for TSLA?" (uses future_only parameter)
Market Intelligence:
"What are the latest analyst recommendations for Google?"
"Show me recent news about Amazon stock"
"Get the top 5 news articles for NVDA"
"What are the 5 most recent analyst ratings for AAPL?" (uses limit parameter)
"Show me the last 10 analyst recommendations for MSFT" (uses limit parameter)
Available Tools
1. yfinance_get_stock_info
Get comprehensive information about a stock.
Parameters:
ticker(string): Stock ticker symbol (e.g., 'AAPL', 'MSFT', 'GOOGL')fields(list of strings, optional): Specific fields to return. Available fields: name, price, currency, market_cap, pe_ratio, forward_pe, dividend_yield, 52_week_high, 52_week_low, avg_volume, sector, industry, description. Uses case-insensitive partial matching (default: None, returns all fields)response_format(string, optional): 'json' or 'markdown' (default: 'markdown')
Returns:
Stock name, current price, market cap, PE ratios, dividend yield, 52-week high/low, sector, industry, description (all fields or filtered subset)
Example:
yfinance_get_stock_info("AAPL", "json")
yfinance_get_stock_info("TSLA", fields=["price", "market_cap", "pe_ratio"])
yfinance_get_stock_info("MSFT", fields=["sector", "industry"])2. yfinance_get_stock_history
Get historical price data for a stock.
Parameters:
ticker(string): Stock ticker symbolperiod(string, optional): Time period - 1d, 5d, 1mo, 3mo, 6mo, 1y, 2y, 5y, 10y, ytd, max (default: '1mo')interval(string, optional): Data interval - 1m, 2m, 5m, 15m, 30m, 60m, 90m, 1h, 1d, 5d, 1wk, 1mo, 3mo (default: '1d')limit(int, optional): Maximum number of most recent data points to return (default: None, returns all)summary(bool, optional): If True, return summary statistics instead of all data points - includes high, low, avg close, total volume, start/end dates (default: False)response_format(string, optional): 'json' or 'markdown' (default: 'markdown')
Returns:
Historical data with dates, open, high, low, close, and volume (or summary statistics if summary=True)
Example:
yfinance_get_stock_history("AAPL", "1y", "1d", "json")
yfinance_get_stock_history("AAPL", "1y", "1d", limit=30) # Last 30 days only
yfinance_get_stock_history("AAPL", "1y", "1d", summary=True) # Just summary3. yfinance_get_stock_financials
Get financial statements for a stock.
Parameters:
ticker(string): Stock ticker symbolstatement_type(string, optional): 'income', 'balance', or 'cashflow' (default: 'income')period(string, optional): 'quarterly' for quarterly reports, 'annual' for yearly reports (default: 'quarterly')limit(int, optional): Maximum number of most recent periods to return (default: 4)fields(list of strings, optional): Specific financial fields to return. Uses case-insensitive partial matching. Example fields: 'revenue', 'net income', 'total assets', 'cash', etc. (default: None, returns all fields)response_format(string, optional): 'json' or 'markdown' (default: 'markdown')
Returns:
Financial statement data organized by date (quarterly or annual, all fields or filtered subset)
Note: Returns quarterly data by default. Most recent 4 quarters unless limit is changed.
Example:
yfinance_get_stock_financials("AAPL", "income", "json")
yfinance_get_stock_financials("AAPL", "income", period="quarterly", limit=2) # Last 2 quarters
yfinance_get_stock_financials("AAPL", "income", period="annual", limit=3) # Last 3 years
yfinance_get_stock_financials("AAPL", "income", fields=["revenue", "net income"])4. yfinance_get_stock_recommendations
Get analyst recommendations for a stock.
Parameters:
ticker(string): Stock ticker symbollimit(int, optional): Maximum number of most recent recommendations to return (default: 20)response_format(string, optional): 'json' or 'markdown' (default: 'markdown')
Returns:
Analyst recommendations history with firm names, grades, and actions
Example:
yfinance_get_stock_recommendations("AAPL", "json")
yfinance_get_stock_recommendations("AAPL", limit=10) # Last 10 recommendations only5. yfinance_get_stock_news
Get recent news articles related to a stock.
Parameters:
ticker(string): Stock ticker symbollimit(int, optional): Maximum number of news items (default: 10, max: 50)response_format(string, optional): 'json' or 'markdown' (default: 'markdown')
Returns:
Recent news articles with title, publisher, link, and publication date
Example:
yfinance_get_stock_news("TSLA", 5, "markdown")6. yfinance_get_multiple_quotes
Get current quotes for multiple stocks at once.
Parameters:
tickers(list of strings): List of stock ticker symbols (max 20)response_format(string, optional): 'json' or 'markdown' (default: 'markdown')
Returns:
Current quotes for all requested tickers including price, change, and volume
Example:
yfinance_get_multiple_quotes(["AAPL", "MSFT", "GOOGL"], "json")7. yfinance_search_stocks
Search for stocks by company name or ticker symbol.
Parameters:
query(string): Search query (company name or ticker)response_format(string, optional): 'json' or 'markdown' (default: 'markdown')
Returns:
Stock information if found, including ticker, name, exchange, and type
Example:
yfinance_search_stocks("AAPL", "json")8. yfinance_get_earnings_dates
Get earnings calendar information with historical and upcoming dates.
Parameters:
ticker(string): Stock ticker symbollimit(int, optional): Maximum number of earnings dates to return (default: 12)future_only(bool, optional): If True, return only future/upcoming earnings dates (default: False)response_format(string, optional): 'json' or 'markdown' (default: 'markdown')
Returns:
Next earnings date
Historical earnings with EPS estimates, reported EPS, and surprise percentages (or future only if future_only=True)
Example:
yfinance_get_earnings_dates("AAPL", "json")
yfinance_get_earnings_dates("AAPL", limit=4) # Last 4 earnings dates only
yfinance_get_earnings_dates("AAPL", future_only=True) # Only upcoming earnings9. yfinance_get_options_chain
Get options chain data (calls and/or puts) with advanced filtering capabilities.
Parameters:
ticker(string): Stock ticker symbolexpiration_date(string, optional): Expiration date in 'YYYY-MM-DD' format. If None, uses nearest expiration (default: None)dte(int, optional): Days to expiration - finds expiration closest to N days out. Mutually exclusive with target_date (default: None)target_date(string, optional): Target date in 'YYYY-MM-DD' format to find closest expiration(s) to. Mutually exclusive with dte (default: None)limit(int, optional): Number of closest expirations to return (works with dte or target_date). 1=single closest, 2=two closest, 3+=N closest (default: 1)option_type(string, optional): Type of options - 'calls', 'puts', or 'both' (default: 'calls')strikes_near_price(int, optional): Number of strikes to show above and below current price. None = all strikes (default: 10)in_the_money(boolean, optional): Filter by ITM status - True for ITM only, False for OTM only, None for all (default: None)min_volume(int, optional): Minimum trading volume filter (default: None)min_open_interest(int, optional): Minimum open interest filter (default: None)strike_min(float, optional): Minimum strike price filter (default: None)strike_max(float, optional): Maximum strike price filter (default: None)fields(list of strings, optional): Which fields/data to return. Special values:["expiration_dates"]or["expirations"]returns only dates without contract data (default: None, returns full contract data)summary(boolean, optional): If True, return aggregate statistics instead of individual contracts. Includes total volume/OI, strike ranges, avg IV, most active strikes, put/call ratios. Use for market analysis and activity overview (default: False)response_format(string, optional): 'json' or 'markdown' (default: 'markdown')
Returns:
If
fields=["expiration_dates"]: List of selected expiration dates (filtered by dte/target_date/limit if specified)If
summary=True: Aggregate statistics including total volume, open interest, strike ranges, average implied volatility, most active strikes, and put/call ratiosIf
limit=1: Single expiration with contract data (backward compatible format)If
limit>1: Array of expirations, each with contract dataOtherwise: Current stock price, filters applied, and for each option: contract symbol, strike, last price, bid, ask, change, percent change, volume, open interest, implied volatility, in the money status, last trade date, contract size, currency
Examples:
Getting Expiration Dates Only:
# Fast query: just get available expiration dates without contract data
yfinance_get_options_chain("SPY", fields=["expiration_dates"])
# Get 3 closest expirations to 30 days from now (dates only)
yfinance_get_options_chain("SPY", dte=30, limit=3, fields=["expiration_dates"])
# Get 2 closest expirations around December 15 (dates only)
yfinance_get_options_chain("AAPL", target_date="2024-12-15", limit=2, fields=["expiration_dates"])Getting Aggregate Statistics (Summary):
# Get aggregate statistics for weekly options on SPY
yfinance_get_options_chain("SPY", dte=7, summary=True, option_type="both")
# Returns: total volume/OI for calls and puts, strike ranges, avg IV,
# most active strikes, put/call ratios (volume and OI)
# Check options activity for monthly AAPL options (calls only)
yfinance_get_options_chain("AAPL", dte=30, summary=True, option_type="calls")
# Analyze market sentiment for TSLA using put/call ratios
yfinance_get_options_chain("TSLA", dte=7, summary=True, option_type="both")
# Look at put/call ratios: >1 suggests bearish sentiment, <1 suggests bullish
# Compare activity across multiple expirations
yfinance_get_options_chain("SPY", dte=30, limit=3, summary=True, option_type="both")Basic Usage:
# Quick check: calls near current price for nearest expiration
yfinance_get_options_chain("TSLA")
# Get nearest expiration, but show more strikes (20 above and below current price)
yfinance_get_options_chain("TSLA", strikes_near_price=20)
# See all available strikes for nearest expiration
yfinance_get_options_chain("AAPL", strikes_near_price=None)Using DTE (Days to Expiration):
# Weekly options (~7 days out)
yfinance_get_options_chain("SPY", dte=7)
# Monthly options (~30 days out)
yfinance_get_options_chain("AAPL", dte=30)
# Quarterly options (~90 days out)
yfinance_get_options_chain("MSFT", dte=90)
# LEAPS (~365 days out, longer-term options)
yfinance_get_options_chain("GOOGL", dte=365)Using Target Date and Multiple Expirations:
# Get options for expiration closest to December 15, 2024
yfinance_get_options_chain("AAPL", target_date="2024-12-15")
# Get 3 closest expirations around December 15 (full contract data for all 3)
yfinance_get_options_chain("AAPL", target_date="2024-12-15", limit=3)
# Get 3 monthly expirations around 30 days out
yfinance_get_options_chain("SPY", dte=30, limit=3)
# Get 2 closest expirations to 60 days out, calls and puts
yfinance_get_options_chain("TSLA", dte=60, limit=2, option_type="both")Common Trading Scenarios:
# Near-the-money calls and puts (5 strikes each side) for 30-day expiration
yfinance_get_options_chain("NVDA", dte=30, option_type="both", strikes_near_price=5)
# Out-of-the-money calls only (above current price) for weekly expiration
yfinance_get_options_chain("TSLA", dte=7, in_the_money=False, strikes_near_price=10)
# In-the-money puts (protective puts) for monthly expiration
yfinance_get_options_chain("AAPL", dte=30, option_type="puts", in_the_money=True, strikes_near_price=10)
# Near-the-money calls with tight spread (very liquid only)
yfinance_get_options_chain("SPY", dte=7, strikes_near_price=5, min_volume=1000, min_open_interest=5000)Filtering by Liquidity:
# Only show highly liquid calls (high volume and open interest)
yfinance_get_options_chain("SPY", min_volume=500, min_open_interest=1000)
# Active calls for weekly expiration
yfinance_get_options_chain("QQQ", dte=7, min_volume=100)
# Liquid monthly puts
yfinance_get_options_chain("AAPL", dte=30, option_type="puts", min_volume=50, min_open_interest=500)Specific Date and Strike Range:
# Specific expiration date with strike range
yfinance_get_options_chain("AAPL", expiration_date="2024-12-20", strike_min=150, strike_max=200)
# Puts in specific range for earnings play
yfinance_get_options_chain("TSLA", expiration_date="2024-01-19", option_type="puts", strike_min=200, strike_max=250)
# Both calls and puts for specific date, near the money
yfinance_get_options_chain("MSFT", expiration_date="2024-12-20", option_type="both", strikes_near_price=8)Filtering Tips:
Default changed to 'calls' to reduce response size and match common usage
Use
strikes_near_price=10(default) to get ~20 contracts centered around current priceUse
strikes_near_price=Noneto see all available strikes (may hit character limit for large chains)Use
dtefor more intuitive expiration selection (e.g., dte=30 for monthly options)strikes_near_priceandin_the_moneywork together:strikes_near_price=10, in_the_money=False→ 10 nearest OTM strikesstrikes_near_price=10, in_the_money=True→ 10 nearest ITM strikesstrikes_near_price=5→ Very near-the-money options (5 ITM + 5 OTM)
Use
min_volumeandmin_open_interestto filter for liquid optionsUse
strike_minandstrike_maxfor custom price ranges (overrides strikes_near_price)
Query Interpretation Guidelines:
"Show me [ticker] options chain" → Use default parameters (calls, 10 strikes, nearest expiration)
"Show me weekly/monthly options" → Add
dte=7ordte=30to specify expiration timeframe"What options are available?" → Exploratory query; use
option_type="both"to show calls and puts"Get highly liquid options" → Add
min_volumeandmin_open_interestfiltersDon't add unsolicited filters unless the query specifically mentions liquidity, volume, or specific strikes
Response Formats
All tools support two response formats:
JSON Format (response_format="json")
Machine-readable structured data
Includes all available fields and metadata
Suitable for programmatic processing
Use when LLMs need to process data further
Markdown Format (response_format="markdown")
Human-readable formatted text
Uses headers, lists, and formatting for clarity
Converts timestamps to readable format
Default format for most queries
Data Limits and Truncation
Character limit: 25,000 characters per response
Automatic truncation: Responses exceeding the limit are truncated with a clear warning
Guidance provided: Truncation messages suggest using filters or pagination
Tool-specific limits:
News: Max 50 items
Multiple quotes: Max 20 tickers
Data Source
This server uses the yfinance Python library, which fetches data from Yahoo Finance. Please note:
Data is provided for informational purposes only
Real-time quotes may be delayed
Historical data availability varies by ticker and exchange
Yahoo Finance terms of service apply
Troubleshooting
Common Issues
No data returned: Some tickers may not be available or may be delisted. Verify the ticker symbol is correct.
Rate limiting: Yahoo Finance may rate-limit requests. If you encounter errors, try reducing the frequency of requests.
Connection errors: Ensure you have an active internet connection and that Yahoo Finance is accessible.
Truncated responses: If responses are truncated:
Use shorter time periods for historical data
Reduce
limitfor news queriesUse larger intervals for historical data (e.g., '1wk' instead of '1d')
Options data not available: Not all stocks have options. Verify the ticker supports options trading.
Development
Running Locally
# Sync dependencies
uv sync
# Run the server
uv run yfinance-mcp{
"mcpServers": {
"yfinance": {
"command": "/your/path/.cargo/bin/uv",
"args": [
"run",
"--with",
"/your/path/yfinance-mcp",
"yfinance-mcp"
],
"env": {
"HOME": "/Users/yourusername"
}
}
}
}Debugging
For debugging and testing, we recommend using the MCP Inspector:
npx @modelcontextprotocol/inspector uv --directory /path/to/yfinance-mcp run yfinance-mcpThis will launch a browser interface where you can interact with your MCP server directly and see input/output for each tool.
Code Formatting
This project uses Black for code formatting:
uv run black src/Project Structure
yfinance-mcp/
├── src/
│ └── yfinance_mcp/
│ ├── __init__.py
│ └── server.py # Main server implementation
├── entrypoint.py # Entry point for transport config
├── .python-version # Python version specification
├── .gitignore
├── pyproject.toml # Project configuration
└── README.md # This fileMCP Best Practices Implemented
This server follows official MCP best practices:
✅ Tool naming: All tools prefixed with
yfinance_to prevent conflicts✅ Response formats: Dual format support (JSON and Markdown)
✅ Character limits: 25,000 character limit with truncation
✅ Tool annotations: All tools annotated with behavior hints
✅ Error handling: Actionable error messages with guidance
✅ Comprehensive documentation: Detailed docstrings and examples
✅ Type safety: Full type hints throughout
License
This project is licensed under the MIT License - see the LICENSE file for details.
Contributing
Contributions are welcome! Please see CONTRIBUTING.md for guidelines.
Project Status
This project is considered feature-complete at version 0.1.0. There is no active roadmap for additional features. Bug fixes and compatibility updates may be accepted, but no major new functionality is planned.
Disclaimer
This software is for informational purposes only. It is not financial advice. The authors and contributors are not responsible for any financial decisions made based on data provided by this tool.
Available Tools
9 toolsyfinance_get_earnings_datesARead-only
Get earnings calendar information including historical and upcoming earnings dates with estimates.
Args: ticker: Stock ticker symbol (e.g., 'AAPL', 'MSFT', 'GOOGL') limit: Maximum number of earnings dates to return (default: 12) future_only: If True, return only upcoming earnings dates (default: False) response_format: Output format - 'json' or 'markdown' (default: 'markdown')
Returns: Formatted string containing earnings information including: - Earnings dates (historical and/or upcoming) - EPS estimates - Reported EPS (for historical dates) - Surprise percentage (actual vs estimate)
Example: yfinance_get_earnings_dates("AAPL", "json") yfinance_get_earnings_dates("AAPL", limit=4) # Last 4 quarters yfinance_get_earnings_dates("AAPL", future_only=True) # Only upcoming
Inputs: ticker (required), limit, future_only, response_format. Returns: result
yfinance_get_multiple_quotesARead-only
Get current quotes for multiple stocks at once in a single request.
Args: tickers: List of stock ticker symbols (e.g., ['AAPL', 'MSFT', 'GOOGL']) response_format: Output format - 'json' or 'markdown' (default: 'markdown')
Returns: Formatted string containing current quotes for all requested tickers including: - Company name - Current price - Currency - Price change and percent change - Trading volume
Example: yfinance_get_multiple_quotes(["AAPL", "MSFT", "GOOGL"], "json")
Inputs: tickers (required), response_format. Returns: result
yfinance_get_options_chainARead-only
Get options chain data for a stock. Returns call options near current price for the nearest expiration by default.
Args: ticker: Stock ticker symbol (e.g., 'AAPL', 'MSFT', 'GOOGL') expiration_date: Optional expiration date in 'YYYY-MM-DD' format (default: nearest) dte: Optional days to expiration - USE THIS for time-based queries: - 7 for "weekly options" - 30 for "monthly options" - 90 for "quarterly options" - 365 for "LEAPS" or "long-term options" MUTUALLY EXCLUSIVE with target_date - cannot use both (default: None, uses nearest expiration) target_date: Optional target date in 'YYYY-MM-DD' format to find closest expiration(s). USE THIS when query mentions a specific date like "around Dec 15" or "near January" MUTUALLY EXCLUSIVE with dte - cannot use both (default: None) limit: Number of closest expirations to return (works with dte or target_date). - 1 = single closest expiration (default) - 2 = two closest (one before, one after if possible) - 3+ = N closest expirations around the target EFFICIENCY: Always use limit parameter to get multiple expirations in ONE call, rather than making multiple separate calls with different dte values. (default: 1) option_type: 'calls', 'puts', or 'both' - Use 'both' when query mentions "what's available" or exploratory requests - Default: 'calls' strikes_near_price: Number of strikes above/below current price, or None for all (default: 10) in_the_money: True for ITM, False for OTM, None for both (default: None) min_volume: Minimum volume filter - ONLY use if query mentions "liquid" or "active" (default: None) min_open_interest: Minimum open interest filter - ONLY use if query mentions "liquid" or "active" (default: None) strike_min: Minimum strike price (default: None) strike_max: Maximum strike price (default: None) fields: Which fields/data to return. Special values: - ["expiration_dates"] or ["expirations"] = return only dates without contract data - None (default) = return full contract data Use for queries like "what expiration dates does [ticker] have?" summary: If True, return aggregate statistics instead of individual contracts. Returns: total volume, open interest, strike ranges, avg IV, most active strikes, put/call ratios. Use this for queries asking for "summary", "activity", "overview", or "sentiment" - NOT for queries asking for specific contracts/strikes. Works seamlessly with limit parameter to analyze multiple expirations. (default: False) response_format: 'json' or 'markdown' (default: 'markdown')
Query interpretation: - "weekly options" → dte=7 - "monthly options" → dte=30 - "around Dec 15" or "near December 20" → target_date="2024-12-15", target_date="2024-12-20" - "3 expirations around..." → limit=3 with dte or target_date - For multiple time periods (weekly, monthly, quarterly): Use dte with limit, NOT separate calls Example: "compare weekly, monthly, quarterly" → dte=30, limit=3 (gets ~weekly, ~monthly, ~next monthly in ONE call) - "what options are available" → option_type="both" - "what expiration dates" or "what dates are available" → fields=["expiration_dates"] - "activity summary", "options activity", "market sentiment", or any query with "summary" → summary=True - "liquid/active options" (without "summary") → add min_volume and min_open_interest (NOT summary=True) - Don't add filters unless specifically requested
Returns: Options chain data with contract details, prices, volume, open interest, and implied volatility. If fields=["expiration_dates"], returns only the list of expiration dates. If summary=True, returns aggregate statistics for market analysis. If limit > 1, returns data for multiple expirations.
Examples: yfinance_get_options_chain("SPY", fields=["expiration_dates"]) # Just get available expiration dates yfinance_get_options_chain("SPY", dte=7) # Weekly options (closest to 7 days) yfinance_get_options_chain("SPY", dte=7, summary=True) # Weekly options activity summary yfinance_get_options_chain("SPY", dte=30, limit=3) # Get 3 expirations around 30 days (detailed contracts) yfinance_get_options_chain("TSLA", dte=30, limit=3, summary=True, option_type="both") # Compare activity across 3 expirations yfinance_get_options_chain("AAPL", dte=30, limit=3, fields=["expiration_dates"]) # Get 3 expiration dates around 30 days yfinance_get_options_chain("AAPL", target_date="2024-12-15", limit=2) # 2 closest expirations to Dec 15 (detailed) yfinance_get_options_chain("TSLA", dte=7, min_volume=1000) # Liquid weekly options
Inputs: ticker (required), dte, limit, fields, +11 more. Returns: result
yfinance_get_stock_financialsARead-only
Get financial statements for a stock (income statement, balance sheet, or cash flow statement).
Args: ticker: Stock ticker symbol (e.g., 'AAPL', 'MSFT', 'GOOGL') statement_type: Type of financial statement - 'income', 'balance', or 'cashflow' (default: 'income') period: Period type - 'quarterly' for quarterly reports, 'annual' for yearly reports (default: 'quarterly') limit: Maximum number of periods to return (default: 4) fields: List of specific line items to include. If None, returns all fields (default: None) response_format: Output format - 'json' or 'markdown' (default: 'markdown')
Returns: Formatted string containing the requested financial statement organized by date. Returns quarterly data by default (most recent 4 quarters). Use period='annual' to get annual/yearly financial statements instead. When fields is specified, only those line items are included.
Example: yfinance_get_stock_financials("AAPL", "income", "json") yfinance_get_stock_financials("AAPL", "income", period="annual", limit=3) # Last 3 years yfinance_get_stock_financials("AAPL", "income", limit=2, fields=["Total Revenue", "Net Income"])
Inputs: ticker (required), limit, fields, period, +2 more. Returns: result
yfinance_get_stock_historyARead-only
Get historical price data for a stock with customizable time period and interval.
Args: ticker: Stock ticker symbol (e.g., 'AAPL', 'MSFT', 'GOOGL') period: Time period - valid values: 1d, 5d, 1mo, 3mo, 6mo, 1y, 2y, 5y, 10y, ytd, max (default: '1mo') interval: Data interval - valid values: 1m, 2m, 5m, 15m, 30m, 60m, 90m, 1h, 1d, 5d, 1wk, 1mo, 3mo (default: '1d') limit: Maximum number of most recent data points to return (default: None, returns all) summary: If True, return summary statistics instead of all data points (default: False) response_format: Output format - 'json' or 'markdown' (default: 'markdown')
Returns: Formatted string with historical price data or summary statistics. When summary=True, returns: high, low, avg close, total volume, start/end dates. When limit is set, returns only the N most recent data points.
Example: yfinance_get_stock_history("AAPL", "1y", "1d", "json") yfinance_get_stock_history("AAPL", "1y", "1d", limit=30) # Last 30 days yfinance_get_stock_history("AAPL", "1y", "1d", summary=True) # Just summary
Inputs: ticker (required), limit, period, summary, +2 more. Returns: result
yfinance_get_stock_infoARead-only
Get comprehensive information about a stock including price, market cap, ratios, and company details.
Args: ticker: Stock ticker symbol (e.g., 'AAPL', 'MSFT', 'GOOGL') fields: Optional list of field names to include (case-insensitive partial matching). Available fields: name, price, currency, market_cap, pe_ratio, forward_pe, dividend_yield, 52_week_high, 52_week_low, avg_volume, sector, industry, description (default: None, returns all fields) response_format: Output format - 'json' for structured data, 'markdown' for human-readable (default: 'markdown')
Returns: Formatted string containing stock information including: - Current price and currency - Market capitalization - PE ratios (trailing and forward) - Dividend yield - 52-week high/low - Average volume - Sector and industry - Company description
Example: yfinance_get_stock_info("AAPL", "json") yfinance_get_stock_info("TSLA", ["price", "market_cap", "pe_ratio"], "markdown") yfinance_get_stock_info("MSFT", fields=["sector", "industry"])
Inputs: ticker (required), fields, response_format. Returns: result
yfinance_get_stock_newsARead-only
Get recent news articles related to a stock.
Args: ticker: Stock ticker symbol (e.g., 'AAPL', 'MSFT', 'GOOGL') limit: Maximum number of news items to return (default: 10, max: 50) response_format: Output format - 'json' or 'markdown' (default: 'markdown')
Returns: Formatted string containing recent news articles with: - Article title - Article description/summary - Publisher name - Publication date and time - Article link - Content type - Thumbnail image URL
Example: yfinance_get_stock_news("TSLA", 5, "markdown")
Inputs: ticker (required), limit, response_format. Returns: result
yfinance_get_stock_recommendationsARead-only
Get analyst recommendations and rating changes for a stock.
Args: ticker: Stock ticker symbol (e.g., 'AAPL', 'MSFT', 'GOOGL') limit: Maximum number of most recent recommendations to return (default: 20) response_format: Output format - 'json' or 'markdown' (default: 'markdown')
Returns: Formatted string containing analyst recommendations history including: - Date of recommendation - Firm name - Rating change (to grade, from grade) - Action taken
Example: yfinance_get_stock_recommendations("AAPL", "json") yfinance_get_stock_recommendations("AAPL", limit=10) # Only 10 most recent
Inputs: ticker (required), limit, response_format. Returns: result
yfinance_search_stocksARead-only
Search for stocks by company name or ticker symbol to verify ticker validity.
Args: query: Search query (company name or ticker symbol) response_format: Output format - 'json' or 'markdown' (default: 'markdown')
Returns: Formatted string containing search results with: - Whether stock was found - Ticker symbol - Company name - Exchange - Security type
Example: yfinance_search_stocks("AAPL", "json") yfinance_search_stocks("Apple", "markdown")
Note: yfinance has limited search capabilities. This tool validates if a ticker exists.
Inputs: query (required), response_format. Returns: result
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 9 tools
Each tool maps to a distinct data product (quotes, profile, history, financials, recommendations, news, search, earnings, options), so misselection is unlikely. The only mild overlap is current price data appearing in both yfinance_get_multiple_quotes and yfinance_get_stock_info, but the multi-ticker vs single-ticker comprehensive profile distinction is clear enough.
All nine tools follow a uniform `yfinance_verb_noun` snake_case pattern (get_stock_info, get_stock_history, search_stocks, etc.). The shared prefix and consistent verb choice make the set highly predictable.
Nine tools is well within the sweet spot and each one covers a genuinely different facet of equity research. No tool feels redundant or like a thin wrapper that could be folded into another.
Coverage is broad for the stated domain: quotes, fundamentals, statements, analyst ratings, news, search, earnings calendar, and options. Minor gaps exist for dividends/splits, institutional holders, and market-wide movers/trending, but core agent workflows are fully supported.
Maintenance
Related MCP Connectors
Yahoo Finance for AI agents: quotes, price history, options with Greeks, financials, news, movers.
Yahoo Finance stock quotes and multi-ticker comparison as agent tools.
Real-time Yahoo Finance stock/crypto quotes & options, Google Trends, News & Reddit/HN sentiment.
Stock, ETF, index and crypto quotes, fundamentals and price history from Yahoo Finance.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceProvides comprehensive financial data from Yahoo Finance, enabling retrieval of stock prices, company information, financial statements, options data, analyst recommendations, and market news through natural language queries.MIT
- AlicenseNot gradedqualityCmaintenanceProvides real-time stock quotes, historical data, and stock search via Yahoo Finance, enabling AI assistants to access and analyze financial market data.24 npm19MIT
- AlicenseNot gradedqualityDmaintenanceEnables AI assistants to access real-time stock, crypto, and market index data from Yahoo Finance, supporting queries for prices, history, company info, and comparisons.MIT
- FlicenseNot gradedqualityDmaintenanceEnables AI assistants to perform live stock and portfolio research using Yahoo Finance data, including quotes, fundamentals, price history, news, portfolio analysis, and ticker comparisons.-