Skip to main content
Glama
Yahoo Finance MCP Server

Yahoo Finance MCP Server

by everdeep

Yahoo Finance MCP Server

A comprehensive Model Context Protocol (MCP) server that provides access to Yahoo Finance data including stock prices, financial statements, market analysis, options data, and more.

Features

This MCP server provides 30 tools organized into 7 categories:

Related MCP server: finance-mcp

Installation

Prerequisites

  • Python 3.10 or higher

  • uv package manager

Install with uv

# Clone the repository
git clone <repository-url>
cd yahoo-finance-mcp

# Install dependencies
uv sync

Usage

With Claude Desktop

Add this configuration to your Claude Desktop config file:

macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
Windows: %APPDATA%\Claude\claude_desktop_config.json

{
  "mcpServers": {
    "yahoo-finance": {
      "command": "uv",
      "args": [
        "--directory",
        "/path/to/yahoo-finance-mcp",
        "run",
        "yahoo-finance-mcp"
      ]
    }
  }
}

With Claude Code

claude mcp add yahoo-finance --scope local -- uv --directory /path/to/yahoo-finance-mcp run yahoo-finance-mcp

Development Mode

Test the server using the MCP inspector:

# Run in development mode
uv run mcp dev src/yahoo_finance_mcp/server.py

This opens a web interface where you can test all the tools interactively.

As a Standalone Server

# Run the server
uv run yahoo-finance-mcp --http --port 8080

Tool Examples

Get Stock Information

# Get comprehensive stock info
get_stock_info(ticker="AAPL")

# Get current price
get_current_price(ticker="MSFT")

# Get valuation metrics
get_market_cap(ticker="GOOGL")

Historical Data

# Get 1 year of daily data
get_historical_data(ticker="TSLA", period="1y", interval="1d")

# Get 5 days of hourly data
get_historical_data(ticker="NVDA", period="5d", interval="1h")

# Get dividend history
get_dividends(ticker="JNJ")

Financial Statements

# Get quarterly income statement
get_income_statement(ticker="AAPL", frequency="quarterly")

# Get annual balance sheet
get_balance_sheet(ticker="MSFT", frequency="annual")

# Get all financials at once
get_financials(ticker="GOOGL", frequency="quarterly")

Market Analysis

# Get analyst recommendations
get_analyst_recommendations(ticker="TSLA")

# Get price targets
get_analyst_price_targets(ticker="NVDA")

# Get earnings data
get_earnings(ticker="AAPL")

Options Data

# Get available expiration dates
get_options_dates(ticker="AAPL")

# Get full options chain for nearest expiration
get_options_chain(ticker="AAPL")

# Get options for specific date
get_options_chain(ticker="AAPL", expiration_date="2024-12-20")

# Get only calls
get_calls(ticker="AAPL", expiration_date="2024-12-20")

News & Insights

# Get latest 10 news articles
get_news(ticker="TSLA", limit=10)

# Get analyst upgrades/downgrades
get_upgrades_downgrades(ticker="NVDA")

Bulk Operations

# Compare multiple stocks
compare_stocks(tickers=["AAPL", "MSFT", "GOOGL"])

# Download historical data for multiple stocks
download_multiple(
    tickers=["AAPL", "MSFT", "GOOGL"],
    period="1mo",
    interval="1d"
)

Project Structure

yahoo-finance-mcp/
├── src/
│   └── yahoo_finance_mcp/
│       ├── __init__.py           # Package initialization
│       ├── server.py             # Main MCP server with tool registration
│       ├── models.py             # Pydantic models for validation
│       ├── utils.py              # Helper functions and utilities
│       └── tools/
│           ├── __init__.py
│           ├── stock_info.py    # Stock information tools
│           ├── historical.py    # Historical data tools
│           ├── financials.py    # Financial statement tools
│           ├── analysis.py      # Market analysis tools
│           ├── options.py       # Options data tools
│           ├── news.py          # News and insights tools
│           └── bulk.py          # Bulk operations tools
├── tests/
│   └── test_tools.py
├── pyproject.toml
├── README.md
└── .gitignore

Technical Details

Data Source

This server uses the yfinance library to fetch data from Yahoo Finance. Please note:

  • This is an unofficial API and is intended for research and educational purposes

  • Data availability and accuracy depend on Yahoo Finance

  • Some data may not be available for all tickers

  • Rate limiting may apply for excessive requests

Error Handling

All tools include comprehensive error handling and will return structured error responses when:

  • Invalid ticker symbols are provided

  • Data is not available for the requested ticker

  • Network issues occur

  • Invalid parameters are passed

Error responses follow this format:

{
  "error": true,
  "message": "Description of the error",
  "ticker": "SYMBOL"
}

Data Formatting

  • All dates are returned in ISO 8601 format (YYYY-MM-DD or full datetime)

  • Pandas DataFrames are converted to lists of dictionaries for easy consumption

  • NaN/None values are handled gracefully

  • Large datasets are formatted efficiently

Development

Running Tests

# Run all tests
uv run pytest

# Run with coverage
uv run pytest --cov=yahoo_finance_mcp

Adding New Tools

  1. Create a new function in the appropriate tool module (or create a new module)

  2. Import the function in server.py

  3. Register it with the @mcp.tool() decorator

  4. Add documentation to this README

Code Style

The project follows standard Python conventions:

  • Type hints for all function parameters and returns

  • Comprehensive docstrings

  • Error handling for all external API calls

  • Modular organization by functionality

Limitations

  • Not for Production Trading: This server is for informational and research purposes only

  • Data Accuracy: Relies on Yahoo Finance data accuracy and availability

  • Rate Limiting: Heavy usage may encounter rate limits

  • No Real-time Guarantees: Data may have delays depending on source

  • Terms of Service: Users must comply with Yahoo Finance's Terms of Service

Contributing

Contributions are welcome! Please:

  1. Fork the repository

  2. Create a feature branch

  3. Make your changes with tests

  4. Submit a pull request

Acknowledgments

Support

For issues, questions, or contributions, please open an issue on GitHub.


Disclaimer: This project is not affiliated with, endorsed by, or connected to Yahoo Finance or Yahoo Inc. Use at your own risk and ensure compliance with Yahoo Finance's Terms of Service.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    Related MCP Connectors

    • Real SEC, 13F, insider, congress & macro data your AI agent can cite. Hosted MCP, 24 tools.

      https://mcp.ko.io/mcp
    • Your agent needs markets — prices and fundamentals for listed companies, the filings behind them, crypto, and what the prediction markets put the odds at. **What you can ask for** • "Pull this company's income statement, cash flow and balance sheet for the last 8 quarters." • "What did insiders buy or sell, and when?" • "Snapshot prices for these 50 tickers, then the OHLC history for the three that moved." • "What are the current odds on this event across Kalshi and Polymarket?" • "Screen for companies matching these financial criteria." **How to use it** Point any MCP client at https://mcp.aisa.one/finance/mcp and sign in with OAuth — there is no key to create or paste. 49 tools: prices and snapshots, income statements, balance sheets and cash flows, metrics and ratios, earnings and analyst estimates, filings and line-item search, insider trades, macro interest rates, news, a screener; CoinGecko spot prices, market tables, OHLC, per-venue tickers and trending; Kalshi and Polymarket markets and trades; plus EDINET filings for Japan. **Why this rather than the source** Equities, crypto and event markets behind one account, so a cross-asset question is one conversation. **It is also a door to the rest** The same login reaches 26 sources and 580+ operations. Read the number here, then ask the same agent what X is saying about the ticker today — without adding a second server. **What it costs** Finding and inspecting an operation is free. Running one is billed per call at API prices, with no seat and no monthly minimum, and every call takes max_price_usd so an agent cannot overspend by accident. **Where else it reaches** https://mcp.aisa.one/marketpulse/mcp · /crypto-market-data/mcp · /prediction-market-data/mcp · /stock-pulse/mcp for one slice each.

    • 75 MCP tools: SEC financials, FRED economics, IRS 990, FDA, FX, UK Companies House.

      https://slacking.biz/mcp
    • Financial data MCP server for Claude, ChatGPT, Cursor and Codex. Real-time stock quotes, financial statements, options flow, SEC filings, insider trades, 13F holdings, macro data and market news from gloom.sh, the open-source Bloomberg Terminal alternative.

      https://api.gloom.sh/mcp

    Related MCP Servers

    • A
      license
      Not graded
      quality
      D
      maintenance
      Provides 10 financial data tools (market data, economic indicators, news, insider trades, and calendars) via a single MCP layer, enabling any MCP-compatible LLM to access diverse financial data through a unified interface.
      1
      MIT
    • A
      license
      A
      quality
      C
      maintenance
      Provides live financial data for any LLM agent, including stock quotes, crypto prices, SEC filings, XBRL financials, FX rates, and macro indicators, through ten MCP tools.
      11
      1
      MIT
    • A
      license
      Not graded
      quality
      C
      maintenance
      Enables MCP clients to retrieve US stock market OHLCV data, company fundamentals and financial statements, FRED macroeconomic indicators, market news, Reddit/StockTwits sentiment, and Polymarket prediction market probabilities via simple tools.
      MIT
    • A
      license
      Not graded
      quality
      A
      maintenance
      Enables AI assistants to access and analyze financial data, stock information, company fundamentals, and market insights through a standardized MCP interface. It provides 250+ tools across categories such as financial statements, quotes, technical indicators, ETFs, crypto, forex, commodities, economics, and SEC filings.
      360 npm
      Apache 2.0