Related MCP Server Resources

Explore more AI models, providers, and integration options:

  • Explore AI Models
  • Explore AI Providers
  • Explore MCP Servers
  • LangDB Pricing
  • Documentation
  • AI Industry Blog
  • Amazon VPC Lattice MCP Server
  • Gemini MCP Image Generation Server
  • XTBApiServer
  • MCP Apple Reminders
  • Spotify MCP Server
Back to MCP Servers
Yahoo Finance MCP for LLaMA 32 3B

Yahoo Finance MCP for LLaMA 32 3B

Public
Shak2000/StockMCP

Integrates Yahoo Finance API with LLaMA 3.2 3B, allowing users to retrieve real-time stock prices, company information, historical data, and market news while maintaining the model's original capabilities.

Verified
python
0 tools
May 30, 2025
Updated May 30, 2025

Yahoo Finance Model Context Protocol (MCP) for LLaMA 3.2 3B

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.

Features

  • Get real-time stock prices directly within LLaMA 3.2 3B
  • Retrieve detailed company information (sector, industry, market cap, etc.)
  • Fetch historical stock data with customizable time periods and intervals
  • Get latest market news headlines
  • Seamlessly enhances LLaMA's capabilities without interfering with non-financial queries

Requirements

  • Python 3.8+
  • Ollama - For running LLaMA 3.2 3B locally
  • LLaMA 3.2 3B model pulled in Ollama
  • Python packages:
    • ollama
    • yfinance
    • requests
    • pandas

Installation

  1. Install Ollama from https://ollama.ai/

  2. Pull the LLaMA 3.2 3B model using Ollama:

    ollama pull llama3.2:3b
  3. Clone this repository:

    git clone cd mcp_yahoo_finance
  4. Install the required Python dependencies:

    pip install -r requirements.txt

Usage

Running the MCP with Ollama Integration

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:

  • Ask financial questions that will be enriched with Yahoo Finance data
  • Ask any other questions which will be handled normally by LLaMA 3.2 3B

Example Queries

Financial Queries (Enhanced with Yahoo Finance data)

  • "What is the current price of Apple stock?"
  • "Tell me about Tesla as a company"
  • "How has Microsoft's stock performed over the past month?"
  • "What are the latest market news headlines?"
  • "What is the 52-week high for Amazon?"
  • "What sector does Nvidia operate in?"
  • "How has the S&P 500 performed this year?"

Non-Financial Queries (Handled normally by LLaMA)

  • "What is the capital of France?"
  • "Explain quantum computing"
  • "Write a poem about autumn"
  • "What is the Pythagorean theorem?"

Using a Different LLaMA Model

You can specify a different model with the --model parameter:

python mcp_ollama_integration.py --model llama3.2:8b

How It Works

  1. The MCP analyzes each user query to determine if it's finance-related
  2. For financial queries, it:
    • Identifies the relevant financial function to call (price, info, history, news)
    • Calls the Yahoo Finance API through the MCP
    • Formats the real-time data and feeds it to LLaMA 3.2 3B as context
    • LLaMA 3.2 3B provides a natural response incorporating the financial data
  3. For non-financial queries, it passes them directly to LLaMA 3.2 3B without modification

This approach seamlessly enhances LLaMA's capabilities with real-time financial data while preserving all of its original functionality.

Advanced Usage

Direct API Functions

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})

Troubleshooting

  • "Error connecting to Ollama": Make sure Ollama is installed and running
  • Company not found: Try using the official ticker symbol instead of the company name
  • LLaMA 3.2 3B model not found: Run ollama pull llama3.2:3b to download the model

Acknowledgements

This project uses the yfinance library for retrieving Yahoo Finance data and Ollama for running LLaMA 3.2 3B locally.

Publicly Shared Threads0

Discover shared experiences

Shared threads will appear here, showcasing real-world applications and insights from the community. Check back soon for updates!

Share your threads to help others
Related MCPs5
  • Amazon VPC Lattice MCP Server
    Amazon VPC Lattice MCP Server

    A Model Context Protocol server that provides tools for accessing and managing AWS VPC Lattice infor...

    2 tools
    Added May 30, 2025
  • Gemini MCP Image Generation Server
    Gemini MCP Image Generation Server

    A Model Context Protocol server that provides image generation capabilities using Google's Gemini 2 ...

    1 tools
    Added May 30, 2025
  • XTBApiServer
    XTBApiServer

    An MCP server that exposes the XTB trading API, allowing users to interact with their XTB trading ac...

    Added May 30, 2025
  • MCP Apple Reminders
    MCP Apple Reminders

    A Model Context Protocol server that enables AI assistants to interact with Apple Reminders on macOS...

    Added May 30, 2025
  • Spotify MCP Server
    Spotify MCP Server

    Integrates with Spotify Web API through the Model Context Protocol, allowing users to search tracks,...

    Added May 30, 2025