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
  • Alpha Vantage Stock Analysis MCP Server
  • Ragie Model Context Protocol Server
  • mcpdemo
  • SQLite MCP Server
  • mcp-server-strava
Back to MCP Servers
Yahoo Finance MCP for LLaMA 32 3B

Yahoo Finance MCP for LLaMA 32 3B

Public
Shak2000/StockMCP

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.

python
0 tools
May 30, 2025
Updated Jun 4, 2025

Supercharge Your AI with Yahoo Finance MCP for LLaMA 32 3B

MCP Server

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.

Unified API Access
Complete Tracing
Instant Setup
Get Started Now

Free tier available • No credit card required

Instant Setup
99.9% Uptime
10,000+Monthly Requests

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
  • Alpha Vantage Stock Analysis MCP Server
    Alpha Vantage Stock Analysis MCP Server

    Provides real-time and historical stock market data, customizable intraday and daily intervals, and ...

    3 tools
    Added May 30, 2025
  • Ragie Model Context Protocol Server
    Ragie Model Context Protocol Server

    Enables AI models to retrieve relevant information from a Ragie knowledge base using the Model Conte...

    1 tools
    Added May 30, 2025
  • mcpdemo
    mcpdemo

    Provides IP query capabilities using the Model Context Protocol (MCP) to enable efficient and accura...

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

    A Model Context Protocol server enabling AI models to execute SQL queries, manage SQLite database sc...

    Added May 30, 2025
  • mcp-server-strava
    mcp-server-strava

    Integrates Strava API with Model Context Protocol to analyze workouts, provide training recommendati...

    Added May 30, 2025