Alex2Yang97/yahoo-finance-mcp
This is a Model Context Protocol (MCP) server that provides comprehensive financial data from Yahoo Finance. It allows you to retrieve detailed information about stocks, including historical prices, company information, financial statements, options data, and market news.
Yahoo Finance MCP Server
一個輕量級的 Model Context Protocol (MCP) 伺服器,包裝公開的 Yahoo Finance API,並為 LLM 驅動的代理程式(例如 Claude)提供豐富的金融資料。該伺服器公開一組類型化的工具,供 LLM 呼叫以取得:
| 類別 | 工具(簡要描述) |
|---|---|
| 股票資訊 | get_historical_stock_prices – OHLCV 系列;get_stock_info – 當前價格、指標、公司細節;get_yahoo_finance_news – 最新新聞;get_stock_actions – 股息與拆股 |
| 財務報表 | get_financial_statement – 損益表、資產負債表、現金流量表(年度/季度);get_holder_info – 主要股東、機構投資人、共同基金、內部人士持股資訊 |
| 期權資料 | get_option_expiration_dates – 可用到期日;get_option_chain – 選定到期日的買權/賣權 |
| 分析師資訊 | get_recommendations – 分析師評級、升級/降級 |
為何對 AI 至關重要
該伺服器設計為可由 Claude for Desktop(或任何 MCP 相容模型)呼叫,使模型能結合即時的市場資料、新聞與持股資訊來增強推理能力。這讓純語言模型轉變為一名 金融研究助理,而無需模型自行爬取網頁資料。
實際應用提示(來自 README)
- 「顯示 NOW 股票過去 6 個月、每日間隔的歷史股價。」 →
get_historical_stock_prices - 「取得 Intuit 的季報資產負債表。」 →
get_financial_statement - 「過去 3 個月內,Intuit 的分析師評級為何?」 →
get_recommendations - 「取得 INTU、到期日為 2026-01-30 的買權期權鏈。」 →
get_option_chain
這些範例說明了 LLM 如何以自然語言提問,而 MCP 伺服器將其轉譯為具體的 API 呼叫。
開始使用
- 不需安裝直接執行 – README 推薦使用
uvx:uvx --from git+https://github.com/Alex2Yang97/yahoo-finance-mcp yahoo-finance-mcp - 本地開發 – 克隆程式碼,執行
uv sync以安裝pyproject.toml中列出的相依套件(Python ≥ 3.14.6,mcp,yfinance,pandas,pydantic,…),再以uv run server.py啟動伺服器。 - 連結至 Claude – 編輯
claude_desktop_config.json,加入指向上述命令的yfinanceMCP 項目,然後重新啟動 Claude。
授權條款
MIT – 可自由使用、修改與重新發布。
所有細節均直接取自程式庫的 README。
相關
- 專案
- 專案
- 專案
- 專案