Overview
What is Mcp Yfinance?
Mcp Yfinance is a simple wrapper around the classic yFinance library that operates as an MCP (Model Context Protocol) tool. It is designed to fetch daily stock prices for individual instruments and returns a Pandas DataFrame to the MCP host, so the host must be able to understand DataFrames. The tool is meant as a demo, starting point, or proof of concept.
How to use Mcp Yfinance?
Register Mcp Yfinance as a command-line extension in your MCP host. For example, in Goose, run goose configure and add an extension with the command uv run server.py. Then start a session with goose session -n yf and invoke the tool with a command like yf__history AAPL. Tests can be run with pytest -v.
Key features of Mcp Yfinance
- Wraps the yFinance library for financial data.
- Operates as an MCP tool with a simple interface.
- Returns historical stock data as a Pandas DataFrame.
- Supports fetching daily prices for individual instruments.
- Designed as a demo or proof of concept.
Use cases of Mcp Yfinance
- Fetching daily stock history for a single ticker symbol.
- Integrating basic financial data retrieval into an MCP‑based agent workflow.
- Demonstrating how to wrap an external Python library as an MCP tool.
FAQ from Mcp Yfinance
What does Mcp Yfinance return?
It returns a Pandas DataFrame containing historical stock data (Open, High, Low, Close, Volume, Dividends, Stock Splits) to the MCP host. The host must be able to interpret DataFrames.
Which MCP host was this tested with?
It was written using Goose as the MCP host and Claude Sonnet 3.5 as the integrated LLM.
What are the limitations of Mcp Yfinance?
When asking the LLM to perform more advanced aggregations, token limits from Anthropic can be quickly reached. The tool is intended as a demo or proof of concept, not for production use.
How do I install Mcp Yfinance?
Register it as a command-line extension in your MCP host. For Goose, you configure it with the command uv run server.py and set a timeout (e.g., 5 seconds). No additional environment variables are needed.
Does Mcp Yfinance require any special dependencies?
It depends on the yFinance library and runs via uv run server.py. Standard Python tooling (pytest, uv) is used.