A Model Context Protocol (MCP) server that provides real-time stock market data through Yahoo Finance. Access stock quotes, historical prices, company information, financial statements, and analyst recommendations directly in Claude Desktop or any MCP-compatible client.
This MCP server gives your AI assistant real-time access to:
- π Real-time stock quotes with market data
- π Historical price data and performance metrics
- π’ Company information and business details
- π° Financial statements (income, balance sheet, cash flow)
- π― Analyst recommendations and price targets
- βοΈ Multi-stock comparisons side-by-side
Add to your Claude Desktop config (~/Library/Application Support/Claude/claude_desktop_config.json on Mac or %APPDATA%\Claude\claude_desktop_config.json on Windows):
{
"mcpServers": {
"yahoo-finance": {
"command": "npx",
"args": ["-y", "yahoo-finance-mcp-server"]
}
}
}That's it! The server will auto-install Python dependencies on first run.
npm install -g yahoo-finance-mcp-server
# Then use in Claude Desktop config:
{
"mcpServers": {
"yahoo-finance": {
"command": "yahoo-finance-mcp-server"
}
}
}- Python 3.10+ - Download here
- Node.js (for npm installation)
If you prefer to install manually:
- Save the
yahoo_finance_mcp.pyfile to a folder on your computer - Remember where you saved it (you'll need this path)
To use this server with Claude Desktop, you need to add it to your configuration file.
- Open Terminal
- Type:
nano ~/Library/Application\ Support/Claude/claude_desktop_config.json - Add the following configuration (adjust the path to where you saved the file):
{
"mcpServers": {
"yahoo-finance": {
"command": "python3",
"args": ["/path/to/yahoo_finance_mcp.py"]
}
}
}- Press
Ctrl + X, thenY, thenEnterto save
- Open Notepad as Administrator
- Open:
%APPDATA%\Claude\claude_desktop_config.json - Add the following configuration (adjust the path):
{
"mcpServers": {
"yahoo-finance": {
"command": "python",
"args": ["C:\\path\\to\\yahoo_finance_mcp.py"]
}
}
}- Save the file
Important: Replace /path/to/yahoo_finance_mcp.py with the actual path where you saved the file!
Close Claude Desktop completely and open it again. The Yahoo Finance tools should now be available!
Once Claude Desktop restarts, try asking:
- "What's the current price of Apple stock?"
- "Show me Tesla's stock performance over the last year"
- "Compare Apple, Microsoft, and Google stocks"
- "What do analysts think about Amazon?"
If everything is working, Claude will use the Yahoo Finance tools to answer these questions!
The server provides these tools:
Get current price, volume, market cap, and basic info for a stock.
Example: "What's the price of AAPL?"
Get price history over different time periods (1 day to 10 years).
Example: "Show me Microsoft's stock price over the last 6 months"
Get detailed company information, officers, and comprehensive statistics.
Example: "Tell me about Tesla as a company"
Get income statement, balance sheet, and cash flow data.
Example: "Show me Apple's financial statements"
Compare multiple stocks side-by-side.
Example: "Compare AAPL, MSFT, and GOOGL"
Get Wall Street analyst ratings and price targets.
Example: "What do analysts think about Tesla?"
Here are some example questions you can ask once the server is running:
Basic Quotes:
- "What's the current stock price of Apple?"
- "How is Tesla stock doing today?"
- "Show me the quote for Microsoft"
Historical Data:
- "Show me Amazon's stock performance over the last year"
- "What was Google's stock price history in the last 3 months?"
- "Get me daily prices for Netflix over the past month"
Company Information:
- "Tell me about Apple's business"
- "Who are the executives at Microsoft?"
- "What sector is Tesla in?"
Financial Analysis:
- "Show me Apple's income statement"
- "What's Microsoft's revenue?"
- "Get Tesla's balance sheet"
Comparisons:
- "Compare Apple, Microsoft, and Google stocks"
- "Which is better: Tesla or Ford?"
- "Compare the tech giants"
Analyst Insights:
- "What do analysts think about Amazon?"
- "What's the price target for Tesla?"
- "Show me recent analyst recommendations for Apple"
Solution: Make sure Python is installed and in your PATH. Try using python3 instead of python in the config file (especially on Mac/Linux).
Solution: Install the required libraries:
pip install yfinance pandas mcpOr on Mac/Linux:
pip3 install yfinance pandas mcpSolution: Double-check the path in your claude_desktop_config.json. Make sure:
- The path is correct and complete
- On Windows, use double backslashes (
\\) or forward slashes (/) - The file actually exists at that location
Solution:
- Make sure you saved the config file correctly
- Restart Claude Desktop completely (quit and reopen)
- Check that the JSON syntax is correct (no missing commas or brackets)
Solution:
- Check your internet connection
- Verify the ticker symbol is correct (e.g., "AAPL" not "Apple")
- Some stocks may have limited data available
- Yahoo Finance API may be temporarily down
- This server uses the free Yahoo Finance API through the yfinance library
- All data requests go directly to Yahoo Finance - nothing is stored
- Yahoo Finance has rate limits (~2,000 requests/hour per IP)
- This is intended for personal use only, not commercial applications
- Stock tickers should be in UPPERCASE (AAPL, MSFT, TSLA, etc.)
- Market data may have a 15-20 minute delay for some stocks
- Not all data is available for every stock (especially smaller companies)
- Financial statements are typically available for larger public companies
If you're having trouble:
- Double-check you followed all installation steps
- Make sure Python and all libraries are installed correctly
- Verify your
claude_desktop_config.jsonsyntax is correct - Try the troubleshooting steps above
This tool uses Yahoo Finance's publicly available data through the yfinance library. Yahoo!, Y!Finance, and Yahoo! Finance are registered trademarks of Yahoo, Inc. This tool is not affiliated with, endorsed by, or vetted by Yahoo, Inc.
Please refer to Yahoo!'s terms of use for details on your rights to use the data. This API is intended for personal, educational, and research purposes only.
Once everything is configured, you can start asking Claude about stocks and financial data. Have fun exploring the markets! π
Daniel Shashko
- GitHub: @danishashko
- LinkedIn: daniel-shashko
- npm: @danishashko
MIT Β© Daniel Shashko