mcpField
M
Mcp Yfinance

Mcp Yfinance

ローカル
github.com/nicholasf金融データ083 週間前に更新

Mcp Yfinance について

Mcp Yfinanceは、yFinanceのticker履歴取得をMCPツールとして提供するデモです。個別銘柄の過去価格を取得したいMCPホストのユーザーを対象とし、結果はPandas DataFrameで返します。複雑な集計ではトークン制限に達する場合があるとREADMEに記載されています。

主な機能

  1. 01yFinanceの履歴取得をラップ
  2. 02Pandas DataFrameを返却
  3. 03MCPホストの拡張として登録

活用シーン

  1. 01銘柄の日次価格を取得
  2. 02MCPホストから履歴ツールを呼び出し

MCP 対応

yFinanceの履歴取得をMCPホスト向けのツールとして公開します。出力はPandas DataFrameで、ホスト側でこの形式を扱える必要があります。

設定

ローカルサーバーの設定はどのクライアントでも共通です。コピーしてクライアントの MCP 設定ファイルに貼り付けてください。

インストール方法は未掲載です

このサーバーのパッケージやリモートエンドポイントはまだ取得できていません。プロジェクトの README の手順に従ってください。

リポジトリ

ツール

ツール一覧はまだ取得されていません

ローカルサーバーのツールはマシン上で起動して初めて取得できます。メンテナーはまだツール一覧を提供していません。

詳細

MCP ツールとして動作する、クラシックなyFinanceのシンプルなラッパーです。

注意 — このツールは Pandas Dataframe を MCP ホストに返すため、ホストがそれを理解できることを前提としています。MCP ホストとしてGooseを使用し、統合 LLM としてClaude Sonnet 3.5 を使用して作成しました。

これまでのところ、個々の金融商品の日次株価の取得に使用しています。LLM により高度な集計を依頼すると、Anthropic のトークン上限にすぐ達してしまいました。

このツールはデモ、出発点、または概念実証を目的としています。

インストール

MCP ホストで拡張機能として登録してください。

gooseの場合:


☁  mcp-yfinance [main] ⚡  goose configure    

This will update your existing config file
  if you prefer, you can edit it directly at /home/nicholasf/.config/goose/config.yaml

┌   goose-configure 
│
◇  What would you like to configure?
│  Add Extension 
│
◇  What type of extension would you like to add?
│  Command-line Extension 
│
◇  What would you like to call this extension?
│  yf
│
◇  What command should be run?
│  uv run server.py
│
◇  Please set the timeout for this tool (in secs):
│  5
│
◇  Would you like to add environment variables?
│  No 
│
└  Added yf extension

続いて、次のように呼び出します:

☁  mcp-yfinance [main] ⚡  goose session -n yf
starting session | provider: anthropic model: claude-3-5-sonnet-latest
    logging to /home/nicholasf/.local/share/goose/sessions/yf.jsonl
    working directory: /home/nicholasf/code/github/nicholasf/mcp-yfinance

Goose is running! Enter your instructions, or try asking what goose can do.

( O)> yf__history AAPL
I'll try getting Apple's stock history now.
─── history | yf ──────────────────────────
symbol: AAPL



Great! The command is now working correctly. The data shows Apple's stock performance over the last month (from February 19, 2025 to March 18, 2025). Here are some key observations:

1. The stock has shown a general downward trend over this period
2. Starting price (Feb 19): Around $244.66
3. Latest price (March 18): Around $214.16
4. Highest point: Around $250.00 (Feb 25)
5. Notable decline: A sharp drop occurred around March 11, falling from ~$235 to ~$223

The data includes Open, High, Low, Close prices, Volume, Dividends, and Stock Splits (though no dividends or splits occurred during this period).

Would you like to:
1. See the data for a different time period?
2. Look at a different stock symbol?
3. Get more detailed analysis of specific aspects of this data?

Just let me know what information would be most helpful!


テストの実行

pytest -v

コメント

MCP は初めてですか?

プロトコルの概要から最初のサーバーの導入まで、よくある疑問にまとめて答えます。

AI アプリケーションが外部のツールやデータソースに統一的な方法で接続するためのオープンなプロトコルです。クライアントはモデルとの対話を担い、MCP サーバーはツール・リソース・プロンプトテンプレートを提供します。標準メッセージでやり取りするため、1 つのサーバーを複数のクライアントで再利用できます。