Stock Research MCP Server
A multi-agent MCP server for comprehensive stock research and analysis using natural language queries, backed by SEC filings and real-time market data.
README
Stock Research MCP Server
A sophisticated multi-agent Model Context Protocol (MCP) server for comprehensive stock research and analysis. Query any sector or industry using natural language and get instant, detailed analysis backed by SEC filings and real-time market data.
⨠Key Highlights
- š¤ Multi-Agent Architecture: Three specialized AI agents work together for comprehensive analysis
- š Semantic Search: ChromaDB with 8,000+ company SEC filings enables natural language queries
- š Zero Configuration: Automatic ChromaDB setup on first use with streaming progress
- š Dual Interface: Use via Claude Desktop (MCP) or Gradio web interface
- š Real-Time Data: Integration with Yahoo Finance and OpenAI for current market insights
- ā” Fast & Efficient: ~355ms latency for analysis queries after initial setup
š Table of Contents
- Features
- Installation & Quick Start
- ChromaDB Setup
- Configuration
- Usage - Two Ways
- Architecture
- Development
- Extending with APIs
- Troubleshooting
- Updating ChromaDB
- Contributing
- License & Disclaimer
š Features
š¤ Multi-Agent System
Three Specialized Agents Working Together:
-
Stock Search Agent
- Semantic search on SEC filings via ChromaDB
- Live data exclusively from Yahoo Finance API (no mock data)
- Finds companies using natural language queries
-
Stock Categorization Agent
- Groups stocks by price ranges
- High: >$100, Medium: $10-$100, Low: <$10
- Smart categorization logic
-
Stock Analysis Agent
- Price trend analysis (bullish/bearish patterns)
- Live news exclusively from Yahoo Finance with AI sentiment analysis
- Live events exclusively from Yahoo Finance (earnings dates, dividends, ex-dividend dates)
- AI-powered investment recommendations
š Complete Analysis Pipeline
When you query any sector/industry:
- Semantic Search ā Finds relevant companies from SEC filings database
- Live Data Fetching ā Gets current prices, changes, market cap from Yahoo Finance (no mock data)
- Categorization ā Groups stocks by price range
- Deep Analysis ā For each stock:
- Price trends & momentum
- Live news exclusively from Yahoo Finance with AI sentiment analysis
- Live events exclusively from Yahoo Finance (earnings dates, dividend schedules)
- AI-powered investment recommendation
š ChromaDB Integration
- Automatic Build: First query triggers one-time setup (20-40 min)
- 8,000+ Companies: Indexed from SEC EDGAR filings
- Semantic Search: Natural language understanding of sectors/industries
- Persistent Storage: Database saved permanently for instant future queries
- Streaming Progress: Real-time updates during initial build
š¦ Installation & Quick Start
Prerequisites
- Python 3.10+ or higher
- pip package manager
- OpenAI API Key for embeddings
- SEC-compliant User-Agent for filing downloads
Quick Setup (5 minutes)
# 1. Navigate to project directory
cd /Users/pradeepsahu/dev_data/StockSearhMCP
# 2. Create virtual environment
python3 -m venv .venv
# 3. Activate virtual environment
source .venv/bin/activate # macOS/Linux
# .venv\Scripts\activate # Windows
# 4. Install dependencies
pip install -e .
# 5. Set environment variables
export OPENAI_API_KEY="your-openai-api-key"
export SEC_API_USER_AGENT="YourCompany contact@youremail.com"
# 6. (Optional) Test installation
python test_installation.py
Verify Installation
# Quick test - should show analysis of technology stocks
python examples/basic_usage.py
šļø ChromaDB Setup - Automatic on First Use!
⨠NEW: ChromaDB builds automatically on your first query - no manual setup required!
How It Works
-
First Query: When you make your first stock analysis request, the system automatically:
- Detects that ChromaDB doesn't exist
- Fetches company data from SEC
- Downloads and processes filings
- Builds embeddings and stores in ChromaDB
- Shows you real-time progress updates
- Then proceeds with your query
-
Subsequent Queries: ChromaDB is stored permanently, so all future queries are instant!
Required Environment Variables
Set these in your MCP configuration (see Configuration section below):
# Required: OpenAI API key for embeddings
OPENAI_API_KEY="your-openai-api-key"
# Required: SEC-compliant User-Agent
SEC_API_USER_AGENT="Your Company Name contact@youremail.com"
# Optional: Customize ChromaDB storage location (default: ./chroma_db)
CHROMA_PERSIST_DIR="./chroma_db"
# Optional: Adjust processing (lower = faster but fewer companies)
MAX_WORKERS="4" # Parallel downloads (default: 4)
BATCH_SIZE="32" # Embedding batch size (default: 32)
Manual Build (Optional)
If you prefer to build ChromaDB before your first query:
cd /Users/pradeepsahu/dev_data/StockSearhMCP
source .venv/bin/activate
# Set environment variables
export OPENAI_API_KEY="your-key"
export SEC_API_USER_AGENT="YourCompany contact@example.com"
# Run builder
python src/sector/builder.py
Note: First-time build takes 20-40 minutes. You'll see progress updates during the build.
āļø Configuration
Add to your MCP settings file to connect with Claude Desktop or other MCP clients.
macOS/Linux
Edit ~/Library/Application Support/Claude/claude_desktop_config.json:
{
"mcpServers": {
"stock-research": {
"command": "/Users/pradeepsahu/dev_data/StockSearhMCP/.venv/bin/python",
"args": [
"-m",
"stock_research_mcp.server"
],
"env": {
"PYTHONPATH": "/Users/pradeepsahu/dev_data/StockSearhMCP/src",
"OPENAI_API_KEY": "your-openai-api-key-here",
"SEC_API_USER_AGENT": "YourCompany contact@youremail.com",
"CHROMA_PERSIST_DIR": "/Users/pradeepsahu/dev_data/StockSearhMCP/output/chroma_db",
"USE_REAL_API": "true",
"USE_CHROMA_SECTORS": "true",
"MAX_WORKERS": "4",
"BATCH_SIZE": "32"
}
}
}
}
Alternative: Using the installed script
After installation, you can also use:
{
"mcpServers": {
"stock-research": {
"command": "/Users/pradeepsahu/dev_data/StockSearhMCP/.venv/bin/stock-research-mcp",
"env": {
"OPENAI_API_KEY": "your-openai-api-key-here",
"CHROMA_PERSIST_DIR": "/Users/pradeepsahu/dev_data/StockSearhMCP/output/chroma_db",
"USE_REAL_API": "true",
"USE_CHROMA_SECTORS": "true"
}
}
}
}
Windows
Edit %APPDATA%\Claude\claude_desktop_config.json:
{
"mcpServers": {
"stock-research": {
"command": "python",
"args": [
"-m",
"stock_research_mcp.server"
],
"env": {
"PYTHONPATH": "C:\\Users\\YourUsername\\dev_data\\StockSearhMCP\\src",
"OPENAI_API_KEY": "your-openai-api-key-here",
"SEC_API_USER_AGENT": "YourCompany contact@youremail.com",
"CHROMA_PERSIST_DIR": "C:\\Users\\YourUsername\\dev_data\\StockSearhMCP\\output\\chroma_db",
"USE_REAL_API": "true",
"USE_CHROMA_SECTORS": "true",
"MAX_WORKERS": "4",
"BATCH_SIZE": "32"
}
}
}
}
šÆ Usage - Two Ways to Access
1. š Gradio Web Interface (Easiest)
Launch the web interface for a user-friendly experience:
# Option 1: Using launch script
./launch_gradio.sh
# Option 2: Direct Python
python gradio_app.py
Access at: http://localhost:7860
Features:
- šØ Beautiful web UI with real-time progress bars
- š” Example sectors (technology, healthcare, biotech, etc.)
- š Instant analysis results in formatted reports
- š Copy button for results
- š Database status indicator
- š± Mobile-responsive design
Example Usage:
- Enter "technology" or click example button
- Click "Analyze Sector"
- Watch progress during first-time ChromaDB build (20-40 min)
- Get instant results on subsequent queries
- Copy/share analysis reports
Advantages:
- ā No MCP configuration needed
- ā Works without Claude Desktop
- ā Visual progress tracking
- ā Easy to share with team
- ā Direct API access to all features
2. š¤ Claude Desktop (MCP Integration)
Use through Claude Desktop for AI-powered interaction:
Once configured (see Configuration section), Claude automatically decides when to use the tool.
ā Queries that trigger the tool:
"Analyze technology stocks"
"Show me healthcare sector analysis"
"What are the best semiconductor companies?"
"Use analyze_sector for renewable energy"
"Search for biotechnology stocks"
ā Queries that might NOT trigger the tool:
"Tell me about stocks" (too vague - Claude uses general knowledge)
"What's a good investment?" (general advice, not sector-specific)
"Explain the stock market" (educational, not analysis)
š” Pro Tips:
- Be specific about sectors/industries
- Use action words: "analyze", "search", "find"
- Explicitly say "use the tool" if needed
- Start fresh conversation for reliable tool usage
How the System Works
š¬ First Query Flow (one-time setup):
User asks: "Analyze biotechnology sector"
ā
System detects: No ChromaDB found
ā
Automatic Build Starts (streaming progress):
š„ Step 1: Fetching company tickers from SEC ā 8,000 companies
š Step 2: Downloading filings (20-40 min)
Progress: 100/8000, 200/8000... (updates every 10 companies)
š¾ Indexing batches to ChromaDB
š Step 3: Verifying index
ā
Step 4: Build complete! ā 7,500 companies indexed
ā
Query Execution:
- Semantic search finds biotechnology companies
- Multi-agent analysis runs
- Results displayed
ā” Subsequent Queries (instant - <1 second):
User asks: "Show me semiconductor stocks"
ā
ChromaDB Semantic Search (instant):
- Convert "semiconductor" to embedding
- Find matches in SEC filings
- Returns: NVDA, AMD, INTC, QCOM, etc.
ā
Multi-Agent Processing:
āāā Search Agent: Fetch real-time prices (Yahoo Finance)
āāā Categorization Agent: Group by price ranges
āāā Analysis Agent: News, events, recommendations
ā
Comprehensive Report (formatted & delivered)
Example Queries (Any Sector/Industry!)
Technology:
- "Analyze stocks in the technology sector"
- "Show me semiconductor companies"
- "Find artificial intelligence stocks"
Healthcare:
- "Analyze biotechnology companies"
- "Show me pharmaceutical stocks"
- "Find medical device companies"
Other Industries:
- "What are the best renewable energy stocks?"
- "Analyze e-commerce companies"
- "Find cloud computing stocks"
- "Show me cybersecurity companies"
Natural Language Works! The ChromaDB semantic search understands your intent based on SEC filing business descriptions, so you can query any industry using natural language.
Available MCP Tool
analyze_sector
Description: Performs comprehensive multi-agent analysis on any sector or industry.
Parameters:
sector(string, required): Natural language description of sector/industry
Supported Sectors:
- ANY sector or industry! Thanks to ChromaDB semantic search on 8,000+ SEC filings
- Not limited to predefined categories - uses natural language understanding
Examples:
{"sector": "technology"}
{"sector": "biotechnology"}
{"sector": "renewable energy"}
{"sector": "artificial intelligence"}
{"sector": "semiconductor manufacturing"}
š Debugging & Logs
View MCP Server Logs:
# Follow live logs
tail -f ~/Library/Logs/Claude/mcp-server-stock-research.log
# View last 100 lines
tail -100 ~/Library/Logs/Claude/mcp-server-stock-research.log
# Search for errors
grep "ERROR" ~/Library/Logs/Claude/mcp-server-stock-research.log
# View analysis reports
grep -A 50 "STOCK ANALYSIS REPORT" ~/Library/Logs/Claude/mcp-server-stock-research.log
# Search for specific stock
grep "AAPL" ~/Library/Logs/Claude/mcp-server-stock-research.log
What You'll See in Logs:
- Tool calls:
Processing sector analysis request for: technology - Stock fetching:
Fetched AAPL: $276.97 - Agent workflow:
[StockSearchAgent],[StockCategorizationAgent],[StockAnalysisAgent] - ChromaDB:
Found 15 stocks in technology sector - Full analysis results
šļø Architecture
System Flow Diagram
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
ā USER QUERY ā
ā "Analyze stocks in biotechnology sector" ā
āāāāāāāāāāāāāāāāāāāāāāāāāā¬āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
ā
ā¼
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
ā MCP SERVER (server.py) ā
ā - Receives query via stdio ā
ā - Validates input ā
ā - Routes to orchestrator ā
āāāāāāāāāāāāāāāāāāāāāāāāāā¬āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
ā
ā¼
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
ā ORCHESTRATOR (orchestrator.py) ā
ā - Coordinates all 3 agents ā
ā - Manages workflow pipeline ā
ā - Formats final output ā
āāāāāāāāāāāāāāāāāāāāāāāāāā¬āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
ā
āāāāāāāāāāāāāāāāāā“āāāāāāāāāāāāāāāāā
ā ā
ā¼ ā¼
āāāāāāāāāāāāāāāāāāāāāāā āāāāāāāāāāāāāāāāāāāāāāāāāāā
ā STEP 1: SEARCH ā ā ChromaDB Integration ā
ā āāāāāāāāāāāāāāā ā ā āāāāāāāāāāāāāāāāāāā ā
ā StockSearchAgent ā ā ⢠Semantic search ā
ā āāāāāāāāāā⤠⢠8,000+ companies ā
ā Actions: ā ā ⢠SEC filings data ā
ā ⢠Query ChromaDB ā ā ⢠Natural language ā
ā ⢠Yahoo Finance ā āāāāāāāāāāāāāāāāāāāāāāāāāāā
ā ⢠Return stocks ā
āāāāāāāāāāāā¬āāāāāāāāāāā
ā
ā¼
āāāāāāāāāāāāāāāāāāāāāāāāāāā
ā STEP 2: CATEGORIZE ā
ā āāāāāāāāāāāāāāāāāāā ā
ā StockCategorization ā
ā ā
ā ⢠High: >$100 ā
ā ⢠Medium: $10-$100 ā
ā ⢠Low: <$10 ā
āāāāāāāāāāāā¬āāāāāāāāāāāāāāā
ā
ā¼
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
ā STEP 3: ANALYZE (for each stock) ā
ā āāāāāāāāāāāāāāāāāāāāāāāāāāāāā ā
ā StockAnalysisAgent ā
ā ā
ā āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā ā
ā ā Price Analysis: trend, momentum, support ā ā
ā āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā ā
ā āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā ā
ā ā News Collection: sentiment, sources ā ā
ā āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā ā
ā āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā ā
ā ā Events: earnings, dividends, launches ā ā
ā āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā ā
ā āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā ā
ā ā Recommendations: signals, advice, risk ā ā
ā āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā ā
āāāāāāāāāāāāāāāāāāāāāāāāāāāā¬āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
ā
ā¼
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
ā FORMATTED REPORT ā
ā āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā ā
ā STOCK ANALYSIS REPORT - BIOTECHNOLOGY SECTOR ā
ā āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā ā
ā HIGH-VALUE STOCKS (7): MRNA, GILD, BIIB... ā
ā MEDIUM-VALUE STOCKS (12): VRTX, REGN... ā
ā LOW-VALUE STOCKS (8): Small caps... ā
ā ā
ā Full analysis with news, events, recommendations ā
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
Key Innovation: Semantic search on SEC filing data enables natural language understanding of sectors/industries - no hardcoded mappings required!
Project Structure
StockSearhMCP/
āāā src/
ā āāā stock_research_mcp/ # Main package
ā ā āāā server.py ā MCP server entry point
ā ā āāā types.py ā Pydantic data models
ā ā āāā agents/ ā Multi-agent system
ā ā āāā orchestrator.py ā Coordinates all agents
ā ā āāā stock_search_agent.py ā Agent 1: Search
ā ā āāā stock_categorization_agent.py ā Agent 2: Categorize
ā ā āāā stock_analysis_agent.py ā Agent 3: Analyze
ā ā āāā sector_ticker_fetcher.py ā ChromaDB helper
ā ā āāā real_api_fetcher.py ā Yahoo Finance integration
ā āāā sector/ # ChromaDB build system
ā āāā builder.py ā Main build script
ā āāā fetch_tickers.py ā Get companies from SEC
ā āāā fetch_filings.py ā Download 10-K/10-Q filings
ā āāā extract_text.py ā Extract business descriptions
ā āāā embeddings_and_chroma.py ā OpenAI + ChromaDB
ā āāā search_api.py ā Optional: FastAPI interface
āāā gradio_app.py # Web interface
āāā test_gradio_setup.py # Gradio verification
āāā launch_gradio.sh # Launch script
āāā examples/
ā āāā basic_usage.py # Simple example
ā āāā real_api_integration.py # API integration demo
āāā output/
āāā chroma_db/ # ChromaDB persistent storage
Data Models (types.py)
Stock # Company information
āāā symbol: str # AAPL, MSFT, etc.
āāā name: str # Apple Inc.
āāā price: float # 175.43
āāā sector: str # Technology
āāā market_cap: float # Optional
āāā change: float # +1.35
āāā change_percent: float # +0.77%
StockCategory (Enum) # Price ranges
āāā HIGH (> $100)
āāā MEDIUM ($10-$100)
āāā LOW (< $10)
PriceAnalysis # Technical analysis
āāā current_price: float
āāā trend: str # bullish/bearish
āāā support: float # Support level
āāā resistance: float # Resistance level
NewsItem # News articles
āāā title: str
āāā source: str
āāā date: str
āāā sentiment: str # positive/negative/neutral
āāā summary: str
EventItem # Upcoming events
āāā type: str # Earnings Call, Dividend, etc.
āāā date: str
āāā description: str
āāā impact: str # high/medium/low
StockAnalysis # Complete analysis
āāā stock: Stock
āāā category: StockCategory
āāā price_analysis: PriceAnalysis
āāā news: List[NewsItem]
āāā events: List[EventItem]
āāā recommendation: str
š§ Development
Running Tests
# Install development dependencies
pip install -e ".[dev]"
# Run tests
pytest
Code Formatting
# Format code with Black
black src/
# Type checking with mypy
mypy src/
Running Locally
# Run the server directly
python -m stock_research_mcp.server
# Or use the installed script
stock-research-mcp
š Data Sources & API Integration
The system is fully integrated with real APIs and provides live market data:
ā Currently Integrated
1. Yahoo Finance (yfinance) - Exclusive live data source
- ā Real-time stock prices, market cap, and price changes
- ā Live news articles with AI sentiment analysis
- ā Live earnings dates and dividend schedules
- ā Ex-dividend dates and company events
- ā No API key required
- ā ļø No mock data fallback - system fails gracefully if data unavailable
2. ChromaDB with SEC EDGAR
- ā 8,000+ company filings indexed
- ā Semantic search on business descriptions
- ā Natural language sector queries
š Optional Additional APIs
For extended functionality, you can add:
# In stock_search_agent.py
import os
import requests
async def _fetch_stocks_from_source(self, sector: str) -> List[Stock]:
api_key = os.getenv("ALPHA_VANTAGE_API_KEY")
url = f"https://www.alphavantage.co/query?function=SECTOR&apikey={api_key}"
response = requests.get(url)
data = response.json()
# Parse and return Stock objects
return stocks
Recommended APIs:
- Alpha Vantage - Free tier available
- Yahoo Finance API - Python library
- Financial Modeling Prep - Comprehensive data
- Polygon.io - Real-time data
Additional News Sources:
- News API - For broader news coverage
- Finnhub - For financial news aggregation
- Alpha Vantage News - For alternative news feeds
Note: The system already fetches real news from Yahoo Finance via yfinance library.
Additional Event Sources:
- Alpha Vantage Events - For additional earnings calendars
- Finnhub Calendar - For IPO and economic calendars
Note: The system already fetches real earnings dates, dividend schedules, and ex-dividend dates from Yahoo Finance.
Environment Variables
Create a .env file:
# .env
ALPHA_VANTAGE_API_KEY=your_key_here
NEWS_API_KEY=your_key_here
FINNHUB_API_KEY=your_key_here
POLYGON_API_KEY=your_key_here
Load in your code:
from dotenv import load_dotenv
load_dotenv()
Install python-dotenv:
pip install python-dotenv
š Sample Output
The system generates comprehensive reports with this format:
================================================================================
STOCK ANALYSIS REPORT - TECHNOLOGY SECTOR
================================================================================
Total Stocks Analyzed: 10
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
HIGH-VALUE STOCKS (Price > $100)
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
š AAPL - Apple Inc.
Price: $175.43 | Change: 1.35%
Trend: bullish
š° Recent News (3):
⢠Apple reports quarterly earnings [positive]
⢠Analysts upgrade AAPL rating [positive]
š
Upcoming Events (3):
⢠Earnings Call - 2025-12-19 [high impact]
⢠Dividend Payment - 2025-12-04 [medium impact]
š” Recommendation:
Stock shows positive momentum. News sentiment is generally positive...
š ļø Troubleshooting
ChromaDB Issues
Problem: ChromaDB not found / No stocks returned
ā Solutions:
# 1. Verify ChromaDB exists
ls -la output/chroma_db/
# 2. Check environment variable
echo $CHROMA_PERSIST_DIR
# 3. Rebuild if needed
python src/sector/builder.py
# 4. Use absolute path in MCP config
CHROMA_PERSIST_DIR="/Users/pradeepsahu/dev_data/StockSearhMCP/output/chroma_db"
Problem: ChromaDB query error: "Expected include item to be..."
ā Status: FIXED in latest version
- ChromaDB's
query()always returnsidsby default - Latest code removes
"ids"fromincludeparameter - Update from
src/stock_research_mcp/agents/sector_ticker_fetcher.pyif needed
MCP Connection Issues
Problem: Claude Desktop doesn't show the tool
ā Complete Checklist:
-
Config Location (macOS):
# Must be in user home, not system /Library ~/Library/Application Support/Claude/claude_desktop_config.json -
Absolute Python Path:
"command": "/Users/pradeepsahu/dev_data/StockSearhMCP/.venv/bin/python"ā NOT:
"python"or"python3" -
Valid API Key:
"OPENAI_API_KEY": "sk-proj-actual-key-here"ā NOT:
"your-openai-api-key-here" -
JSON Syntax:
- Validate at https://jsonlint.com
- No trailing commas
- Proper quotes and brackets
-
Full Restart:
# Quit (Cmd+Q), wait 5 sec, reopen -
Check Connection:
- Look for š green plug icon (bottom-left of Claude Desktop)
- Click to see connected servers list
-
View Logs:
tail -f ~/Library/Logs/Claude/mcp*.log
Test Server Manually:
cd /Users/pradeepsahu/dev_data/StockSearhMCP
source .venv/bin/activate
python -m stock_research_mcp.server
# Should show: "Stock Research MCP Server starting..."
# Press Ctrl+D to exit
Force Tool Usage in Claude:
- ā Bad: "Tell me about tech stocks" (Claude uses general knowledge)
- ā Good: "Analyze technology sector stocks" (forces tool call)
- ā Explicit: "Use the analyze_sector tool for healthcare"
Installation & Server Issues
Problem: Server won't start
# Check Python version (need 3.10+)
python --version
# Activate virtual environment
source .venv/bin/activate
# Reinstall dependencies
pip install -e .
# Verify OpenAI key
echo $OPENAI_API_KEY
Problem: Import errors
# Check PYTHONPATH in MCP config
echo $PYTHONPATH
# Verify all files exist
ls -la src/stock_research_mcp/agents/
# Check ChromaDB access
ls -la output/chroma_db/
Builder Script Issues
Problem: SEC 403 Forbidden Error
ā Set SEC-compliant User-Agent:
export SEC_API_USER_AGENT="YourCompany contact@example.com"
Problem: OpenAI API Error
ā Solutions:
# Verify key is valid
echo $OPENAI_API_KEY
# Check quota/billing
# Visit: https://platform.openai.com/usage
Problem: Download timeouts
ā Reduce workers:
export MAX_WORKERS="4" # Instead of 8
export BATCH_SIZE="32" # Instead of 64
Gradio Interface Issues
Problem: Port 7860 already in use
# Kill existing process
lsof -ti:7860 | xargs kill -9
# Or change port in gradio_app.py
server_port=8080 # Use different port
Problem: Missing Gradio
pip install gradio
# Or
uv pip install gradio
Problem: OpenAI key not working
Check .env file:
cat .env
# Should have: OPENAI_API_KEY=sk-proj-actual-key
š Updating the ChromaDB Index
When to Rebuild
Rebuild the ChromaDB index when:
- New companies file with SEC
- You want to refresh with latest 10-K/10-Q filings
- The index becomes corrupted
- You want to expand to more companies
How to Update
# Option 1: Full rebuild (deletes old data)
rm -rf output/chroma_db/
python src/sector/builder.py
# Option 2: Incremental update (builder will add/update)
python src/sector/builder.py
Customizing the Index
Include more/fewer companies:
Edit src/sector/fetch_tickers.py to filter by market cap, exchange, etc.
Add specific tickers:
Create a custom ticker list JSON file and modify builder.py
Change filing types:
Edit candidates list in src/sector/fetch_filings.py:
candidates = ["10-K", "20-F", "S-1", "10-Q"] # Modify as needed
š¤ Contributing
Contributions are welcome! Areas for improvement:
- [ ] Integration with real financial APIs
- [ ] Advanced technical analysis indicators
- [ ] Machine learning for stock predictions
- [ ] More sophisticated sentiment analysis
- [ ] Historical data analysis
- [ ] Portfolio management features
- [ ] Real-time price updates
- [ ] Additional sectors and international markets
š License
MIT License
ā ļø Disclaimer
IMPORTANT: This tool is for educational and research purposes only. While the system uses real market data from Yahoo Finance, investment recommendations are algorithmically generated and should NOT be used as the sole basis for actual investment decisions.
- Always conduct your own research
- Consult with a qualified financial advisor
- Past performance does not guarantee future results
- Investing involves risk, including loss of principal
š Resources
š” Tips
- Live data only - The system uses Yahoo Finance exclusively for real-time prices, news, and events (no mock data)
- Rate limiting - Yahoo Finance through yfinance has built-in rate limiting
- Caching - Consider caching API responses for frequently queried stocks
- Error handling - System fails gracefully if Yahoo Finance data is unavailable (no fallback to mock data)
- Logging - All operations are logged to
logs/directory for debugging
Built with ā¤ļø using Python and the Model Context Protocol
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.