home / mcp / yahoo finance mcp server

Yahoo Finance MCP Server

Provides a Yahoo Finance MCP server with tools to fetch stock data, news, and price history via yfinance.

Installation
Add the following to your MCP client configuration file.

Configuration

View docs
{
  "mcpServers": {
    "narumiruna-yfinance-mcp": {
      "command": "uvx",
      "args": [
        "yfmcp@latest"
      ],
      "env": {
        "DEFAULT_MODEL": "gpt-4.1",
        "OPENAI_API_KEY": "your_openai_api_key",
        "LITELLM_API_KEY": "your_litellm_api_key",
        "LITELLM_BASE_URL": "https://litellm.example.com"
      }
    }
  }
}

You can run a Yahoo Finance MCP Server that exposes practical tools to fetch stock data, news, and historical price information using yfinance. This server is useful for building chat interfaces, dashboards, or automation that needs current financial data and related articles.

How to use

You interact with the Yahoo Finance MCP Server through an MCP client. Use the provided tools to retrieve stock details, fetch recent news articles, search Yahoo Finance results, obtain top entities within a sector, or pull historical price history in various chart formats. The server returns structured data and, for price history charts, optionally visual charts that you can embed in your applications.

How to install

Choose an installation method that fits your environment: via uv (Python package installer), via Docker, or for local development. Each method provides an MCP configuration you add to your MCP setup.

{
  "mcpServers": {
    "yfmcp": {
      "command": "uvx",
      "args": ["yfmcp@latest"]
    }
  }
}
{
  "mcpServers": {
    "yfmcp": {
      "command": "docker",
      "args": ["run", "-i", "--rm", "narumi/yfinance-mcp"]
    }
  }
}
{
  "mcpServers": {
    "yfmcp": {
      "command": "uv",
      "args": [
        "run",
        "--directory",
        "/path/to/yfinance-mcp",
        "yfmcp"
      ]
    }
  }
}

Notes on prerequisites and environments

Ensure you have a compatible runtime for MCP configuration management. If you use uv, Docker, or local development, follow the setup steps that correspond to your choice and replace placeholders with your actual paths or keys where applicable.

Additional notes

You can mix and match installation methods depending on your environment. After starting the MCP server, you can begin querying stock data, company news, and historical price histories using the available tools.

Security and environment considerations

Keep any API keys and access tokens secure. Do not expose your OPENAI_API_KEY or LiteLLM credentials in client-side code or public repositories. Use environment variables to inject secrets in your deployment environment.

Examples of common actions

- Retrieve stock information for AAPL - Get recent news about TSLA - Search for MSFT to return quotes and related articles - Fetch NVDA price history and display a candlestick chart with volume

Available tools

yfinance_get_ticker_info

Retrieve stock data including company info, financials, trading metrics and governance data. Inputs: symbol (string)

yfinance_get_ticker_news

Fetches recent news articles related to a stock symbol with title, content, and source details. Inputs: symbol (string)

yfinance_search

Fetches and organizes search results from Yahoo Finance, including stock quotes and news articles. Inputs: query (string), search_type (string)

yfinance_get_top

Get top entities in a sector. Inputs: sector (string), top_type (string), top_n (number, optional)

yfinance_get_price_history

Fetch historical price data for a given stock symbol over a period and interval. Can return a markdown table or generate charts (price_volume, vwap, volume_profile) with optional base64 WebP output