An MCP tool wrapping a common yFinance Ticker history call.
Details
Author
nicholasf
Downloads
149
Categories
Other
Jump to
- 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.
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.
A simple wrapper around the classic [yFinance](https://github.com/ranaroussi/yfinance) that operates as an MCP tool.
Note - this tool passes back a Pandas Dataframe to the MCP host, so it expects that to be understood by the host. It was written using [Goose](https://github.com/block/goose) as the MCP Host and [Claude Sonnet](https://www.anthropic.com/claude/sonnet) 3.5 as the integrated LLM.
I've so far used it to fetch daily stock prices for individual instruments. When I've asked the LLM to perform some more advanced aggregations I've quickly hit token limits from Anthropic.
This tool is meant as a demo, starting point or a proof of concept.
## Install
Register it as an extension in your MCP host.
On [goose](https://github.com/block/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
```
Then invoke it:
```
☁ 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!
```
## Running tests
```
pytest -v
```
No reviews yet — be the first
Sign in to leave a review
Use Google, GitHub, or an email account so ratings stay tied to real people.
Social sign-in isn’t configured yet. You can still create an account with email below, or ask an admin to add Google/GitHub/Discord OAuth credentials.
Sequential Thinking is an MCP server that provides a tool for dynamic and reflective problem-solving through a structured, step-by-step thinking process. It is…
Filesystem is a Node.js server that implements the Model Context Protocol (MCP) for filesystem operations. It enables AI assistants to read, write, and manage…
A one-of-a-kind resume builder that keeps your privacy in mind. Completely secure, customizable, portable, open-source and free forever. Try it out today!
A collection of reference implementations for the Model Context Protocol (MCP), demonstrating secure and controlled access to tools and data sources for Large…