# Stock MCP Server - Project Structure
## π Organized File Structure
```
stock_mcp_server/
β
βββ π Python Modules (Core Application)
β βββ stock.server.py # Main MCP server entry point
β βββ run_mcp_server.py # Helper script to start server
β βββ utils.py # Shared utilities (load/save functions)
β βββ price_data.py # Price and stock information tools
β βββ portfolio.py # Portfolio management tools
β βββ analysis.py # Technical analysis indicators
β βββ alerts.py # Alert system (price & RSI)
β βββ dividends.py # Dividend tracking and analysis
β βββ sector.py # Sector analysis and comparison
β βββ risk.py # Risk metrics (Sharpe, Beta, VaR, etc.)
β βββ sentiment.py # Market sentiment tracker β¨ NEW
β
βββ π data/ (Your Personal Data - Auto-generated)
β βββ portfolio.json # Your stock holdings and transactions
β βββ alerts.json # Your price and RSI alerts
β βββ sentiment_history.json # Sentiment tracking history (90 days)
β βββ .gitkeep # Keeps folder in version control
β
βββ π docs/ (Documentation)
β βββ TOOLS_REFERENCE.md # Complete guide to all 48+ tools
β βββ SENTIMENT_TRACKER_SUMMARY.md # Sentiment tracker technical docs
β βββ CURRENT_MARKET_ANALYSIS.md # Example market analysis
β βββ IMPLEMENTATION_SUMMARY.md # Implementation details
β βββ ROADMAP.md # Future features and enhancements
β βββ .gitkeep # Keeps folder in version control
β
βββ π¦ Configuration & Setup
β βββ requirements.txt # Python dependencies
β βββ .gitignore # Git ignore rules (keeps data private)
β βββ README.md # Main documentation and setup guide
β βββ PROJECT_STRUCTURE.md # This file
β
βββ π venv/ (Virtual Environment)
βββ [Python packages installed here]
```
## π File Categories
### Core Python Modules (Root Directory)
All Python source code remains in the root directory for easy imports. Each module is self-contained and registers its tools with the MCP server.
| Module | Tools | Purpose |
|--------|-------|---------|
| `price_data.py` | 3 | Basic stock data retrieval |
| `portfolio.py` | 4 | Holdings and transaction management |
| `analysis.py` | 5 | Technical indicators (RSI, MACD, etc.) |
| `alerts.py` | 6 | Price and RSI alert system |
| `dividends.py` | 4 | Dividend tracking and income |
| `sector.py` | 4 | Sector analysis and rotation |
| `risk.py` | 5 | Risk metrics and portfolio risk |
| `sentiment.py` | 8 | Market sentiment aggregation β¨ |
| **Total** | **48+** | **Complete stock analysis suite** |
### Data Files (`data/` folder)
All JSON data files are now organized in the `data/` folder:
- **Private Data**: Your portfolio, alerts, and sentiment history
- **Auto-generated**: Created automatically when you use features
- **Git-ignored**: Won't be committed to version control (keeps private)
- **Easy Backup**: Copy entire `data/` folder to backup
### Documentation (`docs/` folder)
All markdown documentation organized in the `docs/` folder:
- **User Guides**: How to use tools and features
- **Technical Docs**: Implementation details and architecture
- **Examples**: Market analysis examples and use cases
- **Roadmap**: Future features and enhancements
## π Privacy & Security
### What's Git-Ignored (Private)
The `.gitignore` file keeps these private:
- `data/*.json` - All your personal data files
- `venv/` - Virtual environment (large, not needed in repo)
- `__pycache__/` - Python cache files
- `.DS_Store` - macOS system files
### What's Version Controlled (Shared)
- All Python source code (`.py` files)
- Documentation files (`.md` files)
- Configuration files (`requirements.txt`, `.gitignore`)
- Folder structure markers (`.gitkeep`)
## π¦ Setup & Installation
### Quick Start
```bash
# 1. Navigate to project
cd stock_mcp_server
# 2. Activate virtual environment
source venv/bin/activate # macOS/Linux
# or
venv\Scripts\activate # Windows
# 3. Verify structure
ls -la data/ # Should see .gitkeep and any existing .json files
ls -la docs/ # Should see all .md documentation files
# 4. Run server (via MCP config in Cursor)
# The server will automatically create data files as needed
```
## π Migration from Old Structure
### What Changed (v0.4.0)
**Before:**
```
stock_mcp_server/
βββ [python files]
βββ portfolio.json
βββ alerts.json
βββ TOOLS_REFERENCE.md
βββ ROADMAP.md
βββ [other .md files]
```
**After:**
```
stock_mcp_server/
βββ [python files]
βββ data/
β βββ portfolio.json
β βββ alerts.json
β βββ sentiment_history.json
βββ docs/
βββ TOOLS_REFERENCE.md
βββ ROADMAP.md
βββ [other .md files]
```
### Automatic Path Updates
β
All file paths updated in `utils.py`
β
No code changes needed in your MCP configuration
β
Existing data automatically found in new locations
β
All imports and tools work seamlessly
## π Data Management
### Accessing Your Data
```bash
# View your portfolio
cat data/portfolio.json | python -m json.tool
# View your alerts
cat data/alerts.json | python -m json.tool
# View sentiment history
cat data/sentiment_history.json | python -m json.tool
```
### Backing Up Your Data
```bash
# Backup all data
cp -r data/ data_backup_$(date +%Y%m%d)/
# Restore from backup
cp -r data_backup_20251023/* data/
```
### Resetting Data
```bash
# Clear all data (keeps folder structure)
rm data/*.json
# Data will be recreated automatically when you use features
```
## π Documentation Quick Links
| Document | Purpose |
|----------|---------|
| `README.md` | Main documentation, setup guide, features overview |
| `docs/TOOLS_REFERENCE.md` | Complete reference for all 48+ tools |
| `docs/SENTIMENT_TRACKER_SUMMARY.md` | Market sentiment tracker technical docs |
| `docs/CURRENT_MARKET_ANALYSIS.md` | Example market analysis with sentiment data |
| `docs/IMPLEMENTATION_SUMMARY.md` | Technical implementation details |
| `docs/ROADMAP.md` | Future features and enhancement roadmap |
| `PROJECT_STRUCTURE.md` | This file - project organization |
## π― Benefits of New Structure
### β
Better Organization
- Clear separation: Code vs Data vs Docs
- Easier to navigate and find files
- Professional project structure
### β
Privacy First
- All personal data in one folder
- Easy to gitignore and keep private
- Simple backup and restore
### β
Documentation Hub
- All guides in one place (`docs/`)
- Easy to reference and share
- Clean separation from code
### β
Scalability
- Easy to add new data files
- Easy to add new documentation
- Maintains clean root directory
## π Next Steps
1. **Explore Documentation**
- Read `docs/TOOLS_REFERENCE.md` for complete tool guide
- Check `docs/SENTIMENT_TRACKER_SUMMARY.md` for sentiment features
2. **Start Using Features**
- Portfolio tracking β Data saved in `data/portfolio.json`
- Set alerts β Saved in `data/alerts.json`
- Track sentiment β History in `data/sentiment_history.json`
3. **Backup Regularly**
- Copy `data/` folder to safe location
- Consider cloud backup for important portfolios
4. **Share Knowledge**
- Share `docs/` folder with team
- Keep `data/` private
- Contribute improvements to code
---
**Project Structure Version:** 0.4.0
**Last Updated:** October 23, 2025
**Status:** β
Production Ready