YFinance
Real-time stock API with Python, MCP server example, yfinance stock analysis dashboard
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
Maintainer
Works with
Installation
Manual Installation
npx mcp-yfinanceConfiguration
Configuration Details
claude_desktop_config.json
Performance
Response Metrics
Resource Usage
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)
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-serverCreate 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 .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.pyAdd the server to Claude Desktop configuration
Edit claude_desktop_config.json to register the yfinance server. Use the absolute path to your cloned repository.
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.
YFinance Alternatives — Similar Finance & Fintech Servers
Looking for alternatives to YFinance? Here are other popular finance & fintech servers you can use with Claude, Cursor, and VS Code.
ValueCell
★ 10.7kValueCell is a community-driven, multi-agent platform for financial applications.
Vibe Trading
★ 8.1k'Vibe-Trading: Your Personal Trading Agent'
Quantdinger
★ 6.2kAI quantitative trading platform for crypto, stocks, and forex with backtesting, live trading, market data, and multi-agent research.vibe-trading ,trading-agents,ai-trader,ai-trading
TradingView
★ 2.8kReal-time crypto & stock screening, advanced technical indicators, Bollinger Bands intelligence, candlestick patterns + native Claude Desktop integration. Multi-exchange (Binance, KuCoin, Bybit+). Open-source AI trading infrastructure.
Financial Datasets
★ 2.1kProvides access to comprehensive financial data including income statements, balance sheets, cash flow statements, stock prices, company news, SEC filings, and cryptocurrency information with built-in financial ratio analysis.
Stripe
★ 1.6kThe Stripe Model Context Protocol server allows you to integrate with Stripe APIs through function calling. This protocol supports various tools to interact with different Stripe services.
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.
Set Up YFinance in Your Editor
Choose your AI client for step-by-step setup instructions.
Quick Config Preview
Add this to your claude_desktop_config.json or .cursor/mcp.json
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.