StockScreen MCP Server
A Model Context Protocol (MCP) server providing comprehensive stock screening capabilities through Yahoo Finance. Enables LLMs to screen stocks based on technical, fundamental, and options criteria, with support for watchlist management and result storage.
Features
Stock Screening
Data Management
- Watchlist Creation and Management
- Screening Result Storage
- Default Symbol Categories
- Mega Cap (>$200B)
- Large Cap ($10B-$200B)
- Mid Cap ($2B-$10B)
- Small Cap ($300M-$2B)
- Micro Cap ($200B
- "large_cap": $10B-$200B
- "mid_cap": $2B-$10B
- "small_cap": $300M-$2B
- "micro_cap": <$300M
- "etf": ETF instruments
manage_watchlist
{
"action": str, # Required: "create", "update", "delete", "get"
"name": str, # Required: watchlist name (1-50 chars, alphanumeric with _ -)
"symbols": List[str] # Required for create/update: list of stock symbols
}
get_screening_result
{
"name": str # Required: name of saved screening result
}
Response Formats
Technical Screen Response
{
"screen_type": "technical",
"criteria": dict, # Original criteria used
"matches": int, # Number of matching stocks
"results": [ # List of matching stocks
{
"symbol": str,
"price": float,
"volume": float,
"rsi": float,
"sma_20": float,
"sma_50": float,
"sma_200": float,
"atr": float,
"atr_pct": float,
"price_changes": {
"1d": float, # 1-day price change %
"5d": float, # 5-day price change %
"20d": float # 20-day price change %
},
"ma_distances": {
"pct_from_20sma": float,
"pct_from_50sma": float,
"pct_from_200sma": float
}
}
],
"rejected": [ # List of stocks that didn't match
{
"symbol": str,
"rejection_reasons": List[str]
}
],
"timestamp": str
}
Usage Prompt for Claude
"I've enabled the stockscreen tools which provide stock screening capabilities. You can use three main functions:
-
Screen stocks with various criteria types:
- Technical: Price, volume, RSI, moving averages, ATR
- Fundamental: Market cap, P/E, dividends, growth
- Options: IV, volume, earnings dates
- Custom: Combine multiple criteria types
-
Manage watchlists:
- Create and update symbol lists
- Delete existing watchlists
- Retrieve watchlist contents
-
Access saved screening results:
- Load previous screen results
- Review matched symbols and criteria
All functions include error handling, detailed market data, and comprehensive responses."
Requirements
- Python 3.12+
- MCP Server
- yfinance
- pandas
- numpy
- asyncio
Limitations
- Data sourced from Yahoo Finance with potential delays
- Rate limits based on Yahoo Finance API restrictions
- Options data availability depends on market hours
- Some financial metrics may be delayed or unavailable
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
License
This project is licensed under the MIT License - see the LICENSE file for details.
Author
Todd Wolven - (https://github.com/twolven)
Acknowledgments
- Built with the Model Context Protocol (MCP) by Anthropic
- Data provided by Yahoo Finance
- Developed for use with Anthropic's Claude