Yahoo Finance MCP server

Provides real-time financial data from Yahoo Finance through specialized tools for retrieving stock information, market trends, and news for investment research and analysis.
Back to servers
Provider
narumi
Release date
Mar 31, 2025
Language
Python
Package
Stats
9.1K downloads
27 stars

This MCP server for Yahoo Finance integrates with the yfinance package to provide tools for fetching stock data, news, and other financial information through a Model Context Protocol interface. It offers a streamlined way to access Yahoo Finance data in your applications.

Installation Options

Using uv (Python Package Installer)

  1. First, install uv by following the instructions at the uv documentation

  2. Add this configuration to your MCP server configuration file:

{
  "mcpServers": {
    "yfmcp": {
      "command": "uvx",
      "args": ["yfmcp@latest"]
    }
  }
}

Using Docker

If you prefer Docker, add this configuration to your MCP server configuration file:

{
  "mcpServers": {
    "yfmcp": {
      "command": "docker",
      "args": ["run", "-i", "--rm", "narumi/yfinance-mcp"]
    }
  }
}

Available Tools

Getting Ticker Information

The get_ticker_info tool retrieves comprehensive stock data including company information, financials, trading metrics, and governance data.

Input:

  • symbol (string): The stock ticker symbol (e.g., "AAPL", "MSFT")

Retrieving Ticker News

The get_ticker_news tool fetches recent news articles related to a specific stock symbol, including title, content, and source details.

Input:

  • symbol (string): The stock ticker symbol

Searching Yahoo Finance

The search tool retrieves and organizes search results from Yahoo Finance.

Inputs:

  • query (string): Search query (ticker symbol or company name)
  • search_type (string): Type of search results to retrieve. Options:
    • "all" - all result types
    • "quotes" - stock quotes only
    • "news" - news articles only

Getting Top Entities

The get_top tool retrieves top entities in a specified sector.

Inputs:

  • sector (string): The sector to analyze
  • top_type (string): Type of top entities to retrieve. Options:
    • "top_etfs"
    • "top_mutual_funds"
    • "top_companies"
    • "top_growth_companies"
    • "top_performing_companies"
  • top_n (number, optional): Number of top entities to retrieve (default: 10)

Fetching Price History

The get_price_history tool fetches historical price data for a given stock symbol.

Inputs:

  • symbol (string): The stock ticker symbol
  • period (string, optional): Time period for data retrieval (e.g., '1d', '1mo', '1y'). Default: '1mo'
  • interval (string, optional): Data interval frequency (e.g., '1d', '1h', '1m'). Default: '1d'

Usage Examples

Example: Getting Apple Stock Information

# Example MCP client call to get ticker info
response = mcp_client.call("yfmcp", "get_ticker_info", {"symbol": "AAPL"})

Example: Searching for Tesla

# Example MCP client call to search for Tesla quotes and news
response = mcp_client.call("yfmcp", "search", {
    "query": "Tesla", 
    "search_type": "all"
})

Example: Getting Price History

# Example MCP client call to get 6-month price history for Amazon
response = mcp_client.call("yfmcp", "get_price_history", {
    "symbol": "AMZN",
    "period": "6mo",
    "interval": "1d"
})

How to add this MCP server to Cursor

There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json file so that it is available in all of your projects.

If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json file.

Adding an MCP server to Cursor globally

To add a global MCP server go to Cursor Settings > MCP and click "Add new global MCP server".

When you click that button the ~/.cursor/mcp.json file will be opened and you can add your server like this:

{
    "mcpServers": {
        "cursor-rules-mcp": {
            "command": "npx",
            "args": [
                "-y",
                "cursor-rules-mcp"
            ]
        }
    }
}

Adding an MCP server to a project

To add an MCP server to a project you can create a new .cursor/mcp.json file or add it to the existing one. This will look exactly the same as the global MCP server example above.

How to use the MCP server

Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.

The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.

You can also explictly ask the agent to use the tool by mentioning the tool name and describing what the function does.

Want to 10x your AI skills?

Get a free account and learn to code + market your apps using AI (with or without vibes!).

Nah, maybe later