Get the FREE Ultimate OpenClaw Setup Guide →

mcp-yfinance

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

Installation
Run this command in your terminal to add the MCP server to Claude Code.
Run in terminal:
Command
claude mcp add --transport stdio adity-star-mcp-yfinance-server uv --directory /ABSOLUTE/PATH/TO/YOUR/mcp-yfinance-server run main.py

How to use

The MCP YFinance Stock Server exposes a set of tools to fetch real-time stock data, manage watchlists, and perform technical analysis using Yahoo Finance data. Once running, clients can query tools like get_stock_price to retrieve current prices, add_to_watchlist to curate a personal list, and analyze_stock or get_technical_summary for deeper insights into trends, indicators, and signals. The server is designed to integrate with MCP-enabled interfaces, enabling AI agents or dashboards to orchestrate stock data workflows, run simulations, or generate visualizations based on the tools exposed by the server.

How to install

Prerequisites:

  • Python 3.10+ installed
  • uv (Python package manager) installed or installable via provided setup steps

Step-by-step installation:

  1. Install uv and set up a project directory
# Install uv
curl -LsSf https://astral.sh/uv/install.sh | sh

# Create and navigate to your project directory
mkdir mcp-yfinance-server
cd mcp-yfinance-server
  1. Initialize the project with uv and set up a virtual environment
uv init
uv venv
source .venv/bin/activate  # On Windows: .venv\Scripts\activate
  1. Install the project in editable mode (from the repository you cloned or downloaded)
uv pip install -e .
  1. Ensure dependencies declared in pyproject.toml are installed as part of the install step, and place main.py (or your entry script) in the repository root as referenced by your MCP server configuration.

Note: The exact file names and paths may vary; update the mcp.config.json accordingly. You should have a working Python environment with the required dependencies installed before running the MCP server.

Additional notes

Tips and common issues:

  • The server uses uv as the environment manager; ensure you run commands from within the project directory and that the virtual environment is active.
  • Update the directory path in mcp.config.json to the absolute path of your mcp-yfinance-server installation.
  • If you upgrade dependencies, re-install with uv pip install -e . to reflect changes.
  • For Claude Desktop or other MCP clients, restart the UI after updating the mcp.config.json to ensure new tools are loaded.
  • If you encounter import errors, verify that the pyproject.toml and requirements.txt (if present) are properly resolved in the virtual environment.
  • You can customize environment variables in mcp.config.json under an env section if needed (e.g., API keys or rate limits).

Related MCP Servers

Sponsor this space

Reach thousands of developers