Integrates real-time financial data, stock information, historical prices, and market news into LLaMA models via Model Context Protocol, enhancing AI responses with up-to-date Yahoo Finance insights while maintaining full non-financial query functionality.
Unlock the full potential of Yahoo Finance MCP for LLaMA 32 3B through LangDB's AI Gateway. Get enterprise-grade security, analytics, and seamless integration with zero configuration.
Free tier available • No credit card required
This repository contains a Model Context Protocol (MCP) implementation that integrates Yahoo Finance API with LLaMA 3.2 3B. The MCP allows the model to retrieve real-time financial data, stock information, and market news while preserving all of LLaMA's regular capabilities.
Install Ollama from https://ollama.ai/
Pull the LLaMA 3.2 3B model using Ollama:
ollama pull llama3.2:3b
Clone this repository:
git clone cd mcp_yahoo_finance
Install the required Python dependencies:
pip install -r requirements.txt
To use the Yahoo Finance MCP with LLaMA 3.2 3B through Ollama:
python mcp_ollama_integration.py
This will start an interactive session where you can:
You can specify a different model with the --model
parameter:
python mcp_ollama_integration.py --model llama3.2:8b
This approach seamlessly enhances LLaMA's capabilities with real-time financial data while preserving all of its original functionality.
If you want to use the Yahoo Finance MCP functions directly in your code:
from yahoo_finance_mcp import YahooFinanceMCP # Initialize the MCP mcp = YahooFinanceMCP() # Get stock price price_data = mcp.execute_function("get_stock_price", {"symbol": "AAPL"}) # Get company information company_data = mcp.execute_function("get_stock_info", {"symbol": "TSLA"}) # Get historical data history_data = mcp.execute_function("get_stock_history", {"symbol": "MSFT", "period": "1mo"}) # Get market news news_data = mcp.execute_function("get_market_news", {"limit": 5})
ollama pull llama3.2:3b
to download the modelThis project uses the yfinance library for retrieving Yahoo Finance data and Ollama for running LLaMA 3.2 3B locally.
Discover shared experiences
Shared threads will appear here, showcasing real-world applications and insights from the community. Check back soon for updates!