Stock data via Yahoo Finance API
## Yahoo Finance MCP Server: Real-Time Market Data & Stock Analysis The **Yahoo Finance MCP Server** brings comprehensive stock market data directly into Google Antigravity, enabling developers to build financial applications with real-time quotes, historical data, and market analysis without expensive API subscriptions. ### Why Yahoo Finance MCP? - **Free market data** - Access stock prices, historical data, and financials without API costs - **Global coverage** - Data for stocks, ETFs, mutual funds, and crypto across all major exchanges - **Real-time quotes** - Current prices, volume, and market cap for trading applications - **Fundamental analysis** - Balance sheets, income statements, and key financial ratios - **Historical data** - Years of OHLCV data for backtesting and technical analysis ### Key Features #### 1. Real-Time Stock Quotes ```python # Get current stock data with antigravity result = await mcp.call("yahoo-stock", "get_quote", { "symbols": ["AAPL", "GOOGL", "MSFT", "NVDA"], "fields": ["price", "change", "volume", "marketCap", "peRatio"] }) for stock in result["quotes"]: print(f"{stock[\"symbol\"]}: ${stock[\"regularMarketPrice\"]:.2f}") print(f" Change: {stock[\"regularMarketChangePercent\"]:.2f}%") print(f" Volume: {stock[\"regularMarketVolume\"]:,}") ``` #### 2. Historical Price Data ```python # Fetch historical OHLCV data for analysis historical = await mcp.call("yahoo-stock", "get_history", { "symbol": "AAPL", "period": "1y", "interval": "1d", "events": "div,splits" }) # Calculate simple moving averages closes = [day["close"] for day in historical["prices"]] sma_20 = sum(closes[-20:]) / 20 sma_50 = sum(closes[-50:]) / 50 print(f"SMA20: ${sma_20:.2f}, SMA50: ${sma_50:.2f}") ``` #### 3. Financial Statements ```python # Get company financials for fundamental analysis financials = await mcp.call("yahoo-stock", "get_financials", { "symbol": "TSLA", "modules": ["incomeStatement", "balanceSheet", "cashFlow"] }) income = financials["incomeStatement"]["quarterly"][0] print(f"Revenue: ${income[\"totalRevenue\"]:,.0f}") print(f"Net Income: ${income[\"netIncome\"]:,.0f}") print(f"EPS: ${income[\"basicEPS\"]:.2f}") ``` #### 4. Options Chain Data ```python # Retrieve options data for derivatives trading options = await mcp.call("yahoo-stock", "get_options", { "symbol": "SPY", "expiration": "2024-03-15" }) for call in options["calls"][:5]: print(f"Strike: ${call[\"strike\"]} | Bid: ${call[\"bid\"]} | Ask: ${call[\"ask\"]}") print(f" IV: {call[\"impliedVolatility\"]*100:.1f}% | OI: {call[\"openInterest\"]:,}") ``` ### Configuration ```json { "mcpServers": { "yahoo-stock": { "command": "npx", "args": ["-y", "@anthropic/mcp-yahoo-finance"], "env": { "YAHOO_CACHE_TTL": "60", "YAHOO_RATE_LIMIT": "2000" } } } } ``` ### Use Cases **Portfolio Tracker**: Build real-time portfolio dashboards showing current values, daily changes, and performance metrics across all holdings with automatic refresh. **Stock Screener**: Create custom screeners filtering by P/E ratio, market cap, dividend yield, and technical indicators to identify investment opportunities. **Trading Signals**: Develop automated alert systems when stocks hit price targets, break technical levels, or show unusual volume patterns. **Research Reports**: Generate comprehensive stock analysis reports combining price data, financials, and technical indicators for investment decisions. The Yahoo Finance MCP Server democratizes market data access, empowering developers to build sophisticated financial applications without expensive data subscriptions.
{
"mcpServers": {
"stock-yahoo": {
"mcpServers": {
"stock-yahoo": {
"args": [
"stock-mcp-server"
],
"command": "uvx"
}
}
}
}
}