yfinance-mcp-server について
yfinance-mcp-serverは、yfinance経由でYahoo Financeの株式データを取得する非公式MCPサーバーです。MCPクライアントで期間や間隔を指定して、過去の市場データを参照できます。
主な機能
- 01株式の過去データ取得
- 02期間と間隔の指定
- 03MCPクライアントでの利用
- 04TypeScriptによる実装
活用シーン
- 01銘柄の過去の株価を確認
- 02日次・週次・月次データの取得
MCP 対応
MCPクライアントにgetStockHistoryツールを提供し、銘柄コードに基づいて過去データを取得します。
設定
ローカルサーバーの設定はどのクライアントでも共通です。コピーしてクライアントの MCP 設定ファイルに貼り付けてください。
ツール
1掲載時のツール一覧 · 2 週間前に更新
| パラメーター | 型 | 必須 | 説明 |
|---|---|---|---|
| period | string | はい | |
| symbol | string | はい | |
| interval | enum | いいえ | 1d | 1wk | 1mo |
詳細
yfinance-mcp-server
重要な注意:これは非公式の MCP サーバーです。
Yahoo Finance のデータにアクセスするための Message Control Protocol(MCP)サーバーです。このサーバーは、yfinance を通じて株式市場データを取得するためのシンプルなインターフェースを提供します。
機能
- 期間と間隔をカスタマイズして株価の履歴データを取得
- あらゆる MCP クライアントで簡単に利用可能
- 型安全性と開発者エクスペリエンスの向上を目的に TypeScript で構築
使用方法
Cursor MCP クライアントの例です。
{
"mcpServers": {
"yfinance": {
"command": "npx",
"args": [
"@onori/yfinance-mcp-server"
]
}
}
}
getStockHistory
指定したシンボルの株価の履歴データを取得します。
パラメーター:
symbol(必須):株式シンボル(例:Apple Inc. の場合は「AAPL」)period(必須):データを取得する期間(例:「1d」、「5d」、「1mo」、「3mo」、「6mo」、「1y」、「2y」、「5y」、「10y」、「ytd」、「max」)interval(任意):データの間隔(「1d」、「1wk」、「1mo」)
MCP リクエストの例:
> (Request)
Please use the `getStockHistory` tool to fetch the daily stock data for AAPL for the past week (`period`='1w', `interval`='1d'). Then, render the results as a markdown table.
> (Response Example)
I'll help you fetch Apple's stock data and format it nicely as a markdown table.
First, I'll call the getStockHistory tool to fetch the data:
Let me format this data into a more readable markdown table:
| Date | Open | High | Low | Close | Volume |
|------|------|------|-----|-------|---------|
| Mar 31, 2025 | $217.01 | $225.62 | $216.23 | $222.13 | 65.30M |
| Apr 1, 2025 | $219.81 | $223.68 | $218.90 | $223.19 | 36.41M |
| Apr 2, 2025 | $221.32 | $225.19 | $221.02 | $223.89 | 35.91M |
| Apr 3, 2025 | $205.54 | $207.49 | $201.25 | $203.19 | 103.42M |
| Apr 4, 2025 | $193.89 | $199.88 | $187.34 | $188.38 | 125.57M |
Some notable observations from this data:
- The stock showed significant volatility over this period
- There was a sharp decline in the last two trading days
- Trading volume increased substantially during the declining days, with the highest volume (125.57M shares) on April 4th
- The stock price range was from a high of $225.62 to a low of $187.34 during this period
Would you like any specific analysis of this data or would you like to see different metrics?
開発
開発環境をセットアップするには:
- リポジトリをクローンします
- 依存関係をインストールします:
npm install
- 開発サーバーを起動します:
npm run dev
コントリビューション
コントリビューションを歓迎します!お気軽にプルリクエストを送信してください。
ライセンス
ISC ライセンス(ISC)
コメント
Markdown 対応
AI アプリケーションが外部のツールやデータソースに統一的な方法で接続するためのオープンなプロトコルです。クライアントはモデルとの対話を担い、MCP サーバーはツール・リソース・プロンプトテンプレートを提供します。標準メッセージでやり取りするため、1 つのサーバーを複数のクライアントで再利用できます。