M

MCP Yahoo Finance 股票数据工具

一种模型上下文协议服务器,可通过自然语言查询与雅虎财经互动,以获取股票价格、公司信息和历史财务数据。

finance

1.0w 查看 · 2026-07-07 更新

简介

一种模型上下文协议服务器,可通过自然语言查询与雅虎财经互动,以获取股票价格、公司信息和历史财务数据。

简介

一种模型上下文协议服务器,可通过自然语言查询与雅虎财经互动,以获取股票价格、公司信息和历史财务数据。

MCP Yahoo Finance

一个用于与Yahoo Finance交互的Model Context Protocol (MCP) 服务器。该服务器提供了获取定价、公司信息等功能。

请注意,mcp-yahoo-finance 目前正处于早期开发阶段。随着我继续开发和改进服务器,其功能和可用工具可能会发生变化和扩展。

安装

如果你使用的是uv,则无需手动安装mcp-yahoo-finance。我们将使用uvx直接运行mcp-yahoo-finance

如果你只是想使用MCP服务器,我建议你采用这种方法。

使用pip

使用pip

pip install mcp-yahoo-finance

使用Git

您也可以在将仓库克隆到您的机器后安装该软件包。

git clone git@github.com:maxscheijen/mcp-yahoo-finance.git cd mcp-yahoo-finance uv sync

配置

Claude Desktop

在你的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"] } } }

示例问题

  1. "苹果公司的股价是多少?"
  2. "苹果和谷歌之间的股价差额是多少?"
  3. "从2024-01-01到2025-01-01,苹果公司的股价变化了多少?"

构建

Docker:

docker build -t [IMAGE] .

使用MCP Inspector测试

npx @modelcontextprotocol/inspector uv run mcp-yahoo-finance

工具列表

  • get_current_stock_price: Get the current stock price based on stock symbol.

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

  • get_stock_price_date_range: Get the stock prices for a given date range for a given stock symbol.

  • get_historical_stock_prices: Get historical stock prices for a given stock symbol.

  • get_dividends: Get dividends for a given stock symbol.

  • get_income_statement: Get income statement for a given stock symbol.

  • get_cashflow: Get cashflow for a given stock symbol.

  • get_earning_dates: Get earning dates.

  • get_news: Get news for a given stock symbol.

  • get_recommendations: Get analyst recommendations for a given symbol.

服务配置

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

来源