YFinance

v1.0.0Finance & Fintechstable

Real-time stock API with Python, MCP server example, yfinance stock analysis dashboard

fastapimcp-serverpythonyfinance
Share:
53
Stars
0
Downloads
0
Weekly
0/5

What is YFinance?

YFinance is a Model Context Protocol (MCP) server that allows AI assistants like Claude, Cursor, and VS Code to real-time stock api with python, mcp server example, yfinance stock analysis dashboard

Real-time stock API with Python, MCP server example, yfinance stock analysis dashboard

This server falls under the Finance & Fintech category on MCPgee, the world's largest MCP server directory with 33,000+ servers.

Features

  • Real-time stock API with Python, MCP server example, yfinanc

Use Cases

Access real-time stock data via yfinance. Analyze stock market trends with an MCP server example.
Adity-star

Maintainer

LicenseMIT
Languagepython
Versionv1.0.0
UpdatedMay 21, 2026
Statushealthy
Maintenanceactive

Works with

ClaudeOpenAIwindowsmacoslinux

Installation

Manual Installation

npx mcp-yfinance

Configuration

Configuration Details

Config File

claude_desktop_config.json

Performance

Response Metrics

Response Time< 200ms
ThroughputMedium

Resource Usage

Memory UsageLow
CPU UsageLow

How to Set Up and Use YFinance

MCP YFinance Server is a Python-based MCP server that gives AI agents real-time and historical stock market data through the yfinance library, exposing 18 financial analysis tools including price retrieval, technical indicators, volatility metrics, and watchlist management. It connects Claude and other MCP clients to Yahoo Finance data without requiring a paid API subscription, making it practical for individual investors, analysts, and developers building financial dashboards. Users can ask for RSI calculations, MACD signals, moving averages, and trend patterns directly in conversation.

Prerequisites

  • Python 3.10 or later installed
  • uv package manager installed (curl -LsSf https://astral.sh/uv/install.sh | sh)
  • An MCP-compatible client such as Claude Desktop
  • Internet access for Yahoo Finance data retrieval (no API key required)
1

Clone the repository

Clone the mcp-yfinance-server repository to your local machine.

git clone https://github.com/Adity-star/mcp-yfinance-server.git
cd mcp-yfinance-server
2

Create a virtual environment and install dependencies

Use uv to create a virtual environment and install the project dependencies defined in pyproject.toml.

uv venv
source .venv/bin/activate  # Windows: .venv\Scripts\activate
uv pip install -e .
3

Test the server with the MCP dev inspector

Verify the server starts correctly and all 18 tools are registered before connecting it to Claude Desktop.

mcp dev source/yf_server.py
4

Add the server to Claude Desktop configuration

Edit claude_desktop_config.json to register the yfinance server. Use the absolute path to your cloned repository.

5

Restart Claude Desktop and test a stock query

After restarting, ask Claude for a stock price or technical indicator to confirm the connection is working.

YFinance Examples

Client configuration

Add this to claude_desktop_config.json, replacing the directory path with the absolute path to your cloned repository.

{
  "mcpServers": {
    "yfinance-price-tracker": {
      "command": "uv",
      "args": [
        "--directory",
        "/absolute/path/to/mcp-yfinance-server",
        "run",
        "source/yf_server.py"
      ]
    }
  }
}

Prompts to try

Once connected, use these prompts to analyze stocks via Yahoo Finance data.

- "Compare the stock prices of Tesla and Apple over the last 30 days"
- "Calculate the RSI for NVDA and tell me if it's overbought or oversold"
- "Add AAPL, TSLA, and MSFT to my watchlist then show their current prices"
- "Show me the MACD signal for Amazon stock and interpret the trend"
- "What is the average true range (ATR) for SPY over the past 14 days?"

Troubleshooting YFinance

yfinance returns stale or missing data

Yahoo Finance occasionally rate-limits requests or changes their API. Ensure yfinance is up to date with `uv pip install --upgrade yfinance`. Outside US market hours, real-time prices will reflect the last closing price.

ModuleNotFoundError when starting the server

Ensure you activated the virtual environment before running, or use `uv run` as specified in the config. Run `uv pip install -e .` again if dependencies are missing.

Claude Desktop does not show the yfinance tools

Verify the directory path in the config is an absolute path (not relative), that the virtual environment exists at that location, and that you restarted Claude Desktop after editing the config.

Frequently Asked Questions about YFinance

What is YFinance?

YFinance is a Model Context Protocol (MCP) server that real-time stock api with python, mcp server example, yfinance stock analysis dashboard It connects AI assistants to external tools and data sources through a standardized interface.

How do I install YFinance?

Follow the installation instructions on the YFinance GitHub repository. Clone the repo, install dependencies, and add the server config to your AI client.

Which AI clients work with YFinance?

YFinance works with all major MCP-compatible AI clients including Claude Desktop, Claude Code, Cursor, VS Code (GitHub Copilot), Windsurf, and Cline.

Is YFinance free to use?

Yes, YFinance is open source and available under the MIT license. You can use it freely in both personal and commercial projects.

Browse More Finance & Fintech MCP Servers

Explore all finance & fintech servers available in the MCPgee directory. Each server includes setup guides for Claude, Cursor, and VS Code.

Quick Config Preview

{ "mcpServers": { "mcp-yfinance": { "command": "npx", "args": ["-y", "mcp-yfinance"] } } }

Add this to your claude_desktop_config.json or .cursor/mcp.json

Read the full setup guide →

Ready to use YFinance?

Browse our complete directory of 33,000+ MCP servers, read setup guides for your editor, and start building with the Model Context Protocol.

33,000+ ServersFree & Open SourceStep-by-Step Guides