The StockScreen MCP server provides comprehensive stock screening capabilities through Yahoo Finance, enabling large language models to evaluate stocks based on technical, fundamental, and options criteria. It also supports watchlist management and result storage features for more organized analysis.
To install the StockScreen MCP server:
# Clone the repository
git clone https://github.com/twolven/mcp-stockscreen.git
cd mcp-stockscreen
# Install dependencies
pip install -r requirements.txt
Add the StockScreen MCP server to your Claude configuration by editing your claude-desktop-config.json
file:
{
"mcpServers": {
"stockscreen": {
"command": "python",
"args": ["path/to/stockscreen.py"]
}
}
}
Replace "path/to/stockscreen.py"
with the full path to where you saved the stockscreen.py file.
The StockScreen MCP server offers three main tools:
run_stock_screen
)This tool allows you to screen stocks based on different criteria types.
{
"screen_type": "technical",
"criteria": {
"min_price": 50.0, # Minimum stock price
"max_price": 200.0, # Maximum stock price
"min_volume": 1000000, # Minimum average volume
"above_sma_200": true, # Price above 200-day SMA
"above_sma_50": true, # Price above 50-day SMA
"min_rsi": 40.0, # Minimum RSI value
"max_rsi": 70.0, # Maximum RSI value
"max_atr_pct": 5.0, # Maximum ATR as percentage of price
"category": "large_cap" # Optional: market cap category filter
},
"watchlist": "my_watchlist", # Optional: name of watchlist to screen
"save_result": "tech_screen_result" # Optional: name to save results
}
{
"screen_type": "fundamental",
"criteria": {
"min_market_cap": 5000000000, # Minimum market cap ($5B)
"min_pe": 10.0, # Minimum P/E ratio
"max_pe": 30.0, # Maximum P/E ratio
"min_dividend": 2.0, # Minimum dividend yield (%)
"min_revenue_growth": 5.0, # Minimum revenue growth rate
"category": "large_cap" # Optional: market cap category filter
},
"watchlist": "dividend_stocks", # Optional: name of watchlist to screen
"save_result": "div_screen_result" # Optional: name to save results
}
{
"screen_type": "options",
"criteria": {
"min_iv": 30.0, # Minimum implied volatility (%)
"max_iv": 80.0, # Maximum implied volatility (%)
"min_option_volume": 1000, # Minimum options volume
"min_put_call_ratio": 0.7, # Minimum put/call ratio
"max_spread": 5.0, # Maximum bid-ask spread (%)
"min_days_to_earnings": 5, # Minimum days until earnings
"max_days_to_earnings": 30, # Maximum days until earnings
"category": "mid_cap" # Optional: market cap category filter
},
"save_result": "earnings_options" # Optional: name to save results
}
{
"screen_type": "news",
"criteria": {
"keywords": ["acquisition", "partnership"], # Keywords to search for
"exclude_keywords": ["lawsuit", "downgrade"], # Keywords to exclude
"min_days": 0, # Minimum days back to search
"max_days": 7, # Maximum days back to search
"management_changes": true, # Filter for management changes
"require_all_keywords": false, # Require all keywords to match
"category": "mid_cap" # Optional: market cap category filter
},
"save_result": "recent_news" # Optional: name to save results
}
{
"screen_type": "custom",
"criteria": {
"category": "large_cap",
"technical": {
"min_price": 50.0,
"above_sma_200": true
},
"fundamental": {
"min_dividend": 1.5,
"max_pe": 25.0
},
"options": {
"min_days_to_earnings": 10
}
},
"save_result": "custom_screen"
}
manage_watchlist
)Create, update, delete, or retrieve watchlists:
# Create a new watchlist
{
"action": "create",
"name": "tech_stocks",
"symbols": ["AAPL", "MSFT", "GOOGL", "AMZN", "META"]
}
# Update an existing watchlist
{
"action": "update",
"name": "tech_stocks",
"symbols": ["AAPL", "MSFT", "GOOGL", "AMZN", "META", "NVDA"]
}
# Delete a watchlist
{
"action": "delete",
"name": "tech_stocks"
}
# Get watchlist contents
{
"action": "get",
"name": "tech_stocks"
}
get_screening_result
)Access previously saved screening results:
{
"name": "tech_screen_result"
}
You can filter stocks by market capitalization categories:
When you run a screen, you'll receive a structured response containing:
For technical screens, each matching stock includes:
When working with Claude and the StockScreen tools, you can use the following prompt:
"I've enabled the stockscreen tools which provide stock screening capabilities. You can use three main functions:
Screen stocks with various criteria types:
Manage watchlists:
Access saved screening results:
To add this MCP server to Claude Code, run this command in your terminal:
claude mcp add-json "stockscreen" '{"command":"python","args":["path/to/stockscreen.py"]}'
See the official Claude Code MCP documentation for more details.
There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json
file so that it is available in all of your projects.
If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json
file.
To add a global MCP server go to Cursor Settings > Tools & Integrations and click "New MCP Server".
When you click that button the ~/.cursor/mcp.json
file will be opened and you can add your server like this:
{
"mcpServers": {
"stockscreen": {
"command": "python",
"args": [
"path/to/stockscreen.py"
]
}
}
}
To add an MCP server to a project you can create a new .cursor/mcp.json
file or add it to the existing one. This will look exactly the same as the global MCP server example above.
Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.
The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.
You can also explicitly ask the agent to use the tool by mentioning the tool name and describing what the function does.
To add this MCP server to Claude Desktop:
1. Find your configuration file:
~/Library/Application Support/Claude/claude_desktop_config.json
%APPDATA%\Claude\claude_desktop_config.json
~/.config/Claude/claude_desktop_config.json
2. Add this to your configuration file:
{
"mcpServers": {
"stockscreen": {
"command": "python",
"args": [
"path/to/stockscreen.py"
]
}
}
}
3. Restart Claude Desktop for the changes to take effect