Skip to main content
Glama
MCP Yahoo Finance

MCP Yahoo Finance

by leoncuhk

MCP 雅虎财经

用于与雅虎财经交互的模型上下文协议(MCP) 服务器。该服务器提供获取定价、公司信息以及生成财务可视化图表的工具。

该项目是maxscheijen/mcp-yahoo-finance的一个分支和扩展,增加了可视化功能。

特征

  • 财务数据:获取当前股票价格、历史价格、股息、损益表等

  • 可视化分析:为市场情绪、投资组合跟踪和技术分析生成精美的可视化效果

  • 轻松集成:可与 Claude Desktop、VS Code、Cursor 和其他 MCP 客户端配合使用

Related MCP server: Yahoo Finance MCP Server

设置说明

1.克隆存储库

将此存储库克隆到您的本地机器:

git clone https://github.com/leoncuhk/mcp-yahoo-finance.git
cd mcp-yahoo-finance

2.安装依赖项

使用 pip 安装所需的依赖项:

pip install -r requirements.txt

如果缺少requirements.txt文件,可以直接安装依赖项:

pip install mcp yfinance pandas matplotlib seaborn plotly kaleido numpy pillow base64io

3. 配置 MCP 客户端

克劳德桌面

将其添加到您的claude_desktop_config.json (如果不存在则创建它):

  • macOS/Linux : ~/Library/Application Support/Claude/claude_desktop_config.json

  • Windows : %APPDATA%\Claude\claude_desktop_config.json

{
    "mcpServers": {
        "yahoo-finance": {
            "command": "uvx",
            "args": ["mcp-yahoo-finance"]
        }
    }
}

您还可以使用 docker:

{
    "mcpServers": {
        "yahoo-finance": {
            "command": "docker",
            "args": ["run", "-i", "--rm", "IMAGE"]
        }
    }
}

VSCode

将其添加到您的.vscode/mcp.json :

{
    "servers": {
        "yahoo-finance": {
            "command": "uvx",
            "args": ["mcp-yahoo-finance"]
        }
    }
}

光标

将其添加到您的 Cursor MCP 配置中:

{
    "mcp-servers": {
        "yahoo-finance": {
            "command": "uvx",
            "args": ["mcp-yahoo-finance"]
        }
    }
}

4. 重启 MCP 客户端

配置完成后,重新启动 Claude Desktop 或您首选的 MCP 客户端以加载服务器。

可用工具

基本财务数据

  • get_current_stock_price :获取某个符号的当前股票价格

  • get_stock_price_by_date :获取特定日期的股票价格

  • get_stock_price_date_range :获取某个日期范围内的股票价格

  • get_historical_stock_prices :获取可自定义时间段的历史股票数据

  • get_dividends :获取股票的股息信息

  • get_income_statement :获取损益表数据

  • get_cashflow :获取现金流量表数据

  • get_earning_dates :获取收入日期信息

  • get_news :获取股票的最新消息

可视化工具

  • generate_market_dashboard :创建具有实时指数表现的市场情绪仪表板

  • generate_portfolio_report :生成投资组合绩效跟踪报告

  • generate_stock_technical_analysis :为股票创建技术分析报告

可视化示例

市场情绪仪表盘

市场情绪仪表盘

投资组合追踪

投资组合绩效跟踪

股票技术分析

股票价格技术分析

示例提示

以下是一些可以与 Claude 一起尝试的示例提示:

基本财务数据

  1. “苹果目前的股价是多少?”

  2. “苹果和谷歌的股价有什么区别?”

  3. “2025 年 1 月 1 日至 2025 年 3 月 31 日期间苹果公司的股价变化了多少?”

可视化请求

  1. “生成一个显示主要指数表现的市场情绪仪表板。”

  2. “为科技股 AAPL、MSFT、GOOGL、AMZN 和 NVDA 创建投资组合跟踪报告。”

  3. “向我展示特斯拉股票的技术分析图表,其中包含移动平均线和支撑/阻力位。”

  4. “使用标准普尔 500、道琼斯和纳斯达克生成市场情绪仪表板。”

  5. “您能为我的能源股 XOM、CVX、BP、COP 和 SLB 创建投资组合报告吗?”

  6. “我需要一份 NVDA 股票的详细技术分析,显示 RSI 和成交量模式。”

测试

测试可视化功能:

cd tests
python test_visualization.py

这将在examples目录中生成示例可视化图像。

执照

该项目根据 MIT 许可证获得许可 - 有关详细信息,请参阅 LICENSE 文件。

致谢

Available Tools

10 tools
get_cashflowC

Get cashflow for a given stock symbol.

Inputs: symbol (required), freq.

get_current_stock_priceC

Get the current stock price based on stock symbol.

Inputs: symbol (required).

get_dividendsC

Get dividends for a given stock symbol.

Inputs: symbol (required).

get_earning_datesC

Get earning dates.

Inputs: symbol (required), limit.

get_historical_stock_pricesC

Get historical stock prices for a given stock symbol.

Inputs: symbol (required), period, interval.

get_income_statementC

Get income statement for a given stock symbol.

Inputs: symbol (required), freq.

get_newsC

Get news for a given stock symbol.

Inputs: symbol (required).

get_recommendationsC

Get analyst recommendations for a given symbol.

Inputs: symbol (required).

get_stock_price_by_dateB

Get the stock price for a given stock symbol on a specific date.

Inputs: symbol (required), date (required).

get_stock_price_date_rangeC

Get the stock prices for a given date range for a given stock symbol.

Inputs: symbol (required), start_date (required), end_date (required).

Tool Schema Changelog

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

Loading tool schema changelog…

    TDQS

    B3.1/5.0

    Scored across 10 tools

    Disambiguation4/5

    Most tools are clearly distinct, focusing on specific financial data types like cashflow, dividends, or news. However, there is some overlap between get_current_stock_price, get_stock_price_by_date, and get_stock_price_date_range, which could cause confusion about which to use for price queries, though their descriptions help clarify the differences.

    Naming Consistency5/5

    All tools follow a consistent verb_noun pattern with 'get_' prefix and snake_case, such as get_cashflow and get_historical_stock_prices. This predictability makes it easy for agents to understand and navigate the tool set without naming conflicts or inconsistencies.

    Tool Count5/5

    With 10 tools, the server is well-scoped for financial data retrieval, covering key aspects like prices, financial statements, news, and recommendations. Each tool serves a distinct purpose without being overly broad or sparse, fitting typical needs in this domain.

    Completeness4/5

    The tool set provides comprehensive coverage for retrieving financial data, including core elements like prices, statements, and news. A minor gap is the lack of tools for updating or managing data (e.g., no create or delete operations), but this is reasonable for a read-only finance server focused on data access.

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      D
      maintenance
      Provides real-time financial data from Yahoo Finance to Large Language Models through the Model Context Protocol, enabling AI models to access stock prices, historical data, and company information.
      1
      MIT
    • A
      license
      A
      quality
      C
      maintenance
      Provides access to real-time stock prices, financial statements, news, and options data via the Model Context Protocol. It enables AI assistants to retrieve comprehensive market data, including historical prices and analyst recommendations, through a standardized interface.
      9
      45 PyPI
      4
      MIT
    • F
      license
      A
      quality
      D
      maintenance
      Provides financial data tools including stock prices, news, forex, fundamentals, and corporate actions via the Tiingo API through the Model Context Protocol.
      11
      5
      -