Yahoo Finance MCP Server

Yahoo Finance MCP Server

Enables querying Yahoo Finance data including stock prices, historical data, financial statements, dividends, news, analyst recommendations, and company information through the yfinance library.

Category
Visit Server

README

Yahoo Finance MCP Server

This project provides a Model Context Protocol (MCP) server that exposes various functions from the yfinance library as individual tools. This allows an MCP client (like Claude Desktop) to query Yahoo Finance data.

Prerequisites

  • Python: Ensure you have Python installed (Python 3.8+ recommended).
  • uv: This project uses uv for environment and package management. If you don't have it, install it following the instructions here: https://github.com/astral-sh/uv

Setup

  1. Clone the repository:

    git clone git@github.com:a05031113/yahoo-fianace-mcp.git
    cd yahoo-finance # Or your repository directory name
    
  2. Create a virtual environment: It's highly recommended to use a virtual environment. Create one using uv:

    uv venv
    

    This will create a .venv directory.

  3. Activate the virtual environment:

    • On macOS/Linux:
      source .venv/bin/activate
      
    • On Windows (Git Bash/WSL):
      source .venv/Scripts/activate
      
    • On Windows (Command Prompt/PowerShell):
      .venv\Scripts\activate
      

    You should see (.venv) at the beginning of your terminal prompt.

  4. Install dependencies: Install the required Python packages using uv:

    uv pip install -r requirements.txt
    

Running the Server

This server communicates via standard input/output (stdio) as expected by MCP. To run the server, simply execute the main.py script using the Python interpreter from your activated virtual environment:

python main.py

The server will start and print log messages to standard error (stderr), waiting for JSON-RPC requests on standard input (stdin).

You would typically configure your MCP client (e.g., in its settings JSON file) to run this command:

{
  "mcpServers": {
    "yahoo_finance_engine": {
      "command": "/path/to/your/yahoo-finance/.venv/bin/python", // Adjust path accordingly
      "args": [
        "/path/to/your/yahoo-finance/main.py" // Adjust path accordingly
      ]
    }
    // ... other servers
  }
}

The MCP client will then manage starting and communicating with this server process.

Available Tools

The server exposes the public methods of the YahooFinance class (defined in src/tool.py) as individual MCP tools. These include (but are not limited to):

  • get_current_stock_price(symbol: str)
  • get_stock_price_by_date(symbol: str, date: str)
  • get_stock_price_date_range(symbol: str, start_date: str, end_date: str)
  • get_historical_stock_prices(symbol: str, period: str = "1mo", interval: str = "1d")
  • get_dividends(symbol: str)
  • get_income_statement(symbol: str, freq: str = "yearly")
  • get_cashflow(symbol: str, freq: str = "yearly")
  • get_balance_sheet(symbol: str, freq: str = "yearly")
  • get_earning_dates(symbol: str, limit: int = 12)
  • get_news(symbol: str)
  • get_company_info(symbol: str)
  • get_splits(symbol: str)
  • get_recommendations(symbol: str)
  • get_analyst_price_targets(symbol: str)
  • get_major_holders(symbol: str)
  • get_institutional_holders(symbol: str)
  • get_mutualfund_holders(symbol: str)
  • get_option_expiration_dates(symbol: str)
  • get_option_chain(symbol: str, date: str)
  • get_sustainability(symbol: str)

Refer to the docstrings within main.py or src/tool.py for details on each tool's parameters.

Certified by MCP Review. https://mcpreview.com/mcp-servers/a05031113/yahoo-fianace-mcp

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured