Skip to main content
Glama
monaron

yfinance-mcp

by monaron
README.md
# yfinance-mcp

> Yahoo Finance MCP Server — 将 [ranaroussi/yfinance](https://github.com/ranaroussi/yfinance) (24.4k ⭐)
> 包装为共享 FastMCP 服务,所有 OpenClaw 用户通过 streamable-http 访问。
> 端口 8767。

## 上游

- **yfinance**: `ranaroussi/yfinance` (Apache 2.0), 通过 `requirements.txt` 锁定版本
- **MCP 层**: 自写 `server.py` (~300 行 FastMCP),不依赖第三方 MCP wrapper

## 追上游方式

```
requirements.txt: yfinance==1.5.1  ← Dependabot 每周检查 PyPI 新版本自动开 PR
CI 冒烟测试: 启动 server → 调 get_stock_info("AAPL") 不报错
```

## 提供的 MCP Tools (24 个)

| 工具 | 说明 |
|------|------|
| `get_stock_info` | 公司信息、财务指标 |
| `get_fast_info` | 快速关键指标 |
| `get_stock_history` | 历史 OHLCV 行情 |
| `download_multi` | 批量下载多标的行情 |
| `get_income_statement` | 利润表(年报/季报) |
| `get_balance_sheet` | 资产负债表 |
| `get_cash_flow` | 现金流量表 |
| `get_analyst_recommendations` | 分析师评级 |
| `get_analyst_price_targets` | 分析师目标价 |
| `get_earnings_estimates` | 盈利预测/历史/趋势 |
| `get_ownership_data` | 持仓(机构/内部人) |
| `get_dividends_and_splits` | 分红与拆股 |
| `get_option_expiration_dates` | 期权到期日列表 |
| `get_option_chain` | 期权链(calls/puts) |
| `get_stock_news` | 近期新闻 |
| `get_earnings_calendar` | 财报日历 |
| `get_fund_data` | 基金/ETF 持仓 |
| `get_sustainability` | ESG 评分 |
| `get_sec_filings` | SEC 申报文件 |
| `get_isin` | ISIN 代码 |
| `search_quotes` | Yahoo Finance 搜索 |
| `get_multiple_info` | 批量获取多标的信息 |

## 部署

CI push → `ghcr.io/monaron/yfinance-mcp:latest` + `:<sha>`
→ ArgoCD Image Updater 检测 digest 变动 → 写回 infrastructure `values.yaml`
→ ArgoCD 同步 → 滚动更新

## 架构

```
openclaw-{user} → yfinance-mcp.relay.svc:8767/mcp (streamable-http)
```