A comprehensive suite of Model Context Protocol (MCP) servers for portfolio management, market data access, and trading operations, organized as a UV workspace.
portfolio_service/
├── brokerage_service/ # Order execution and portfolio management
├── market_data_service/ # Market data and technical analysis
├── research_service/ # Market research and screening
├── common/ # Shared utilities and libraries
├── pyproject.toml # Workspace root configuration
└── uv.lock # Shared lockfile for all workspace members
This repository uses UV workspaces to manage multiple interconnected packages. Each service is a separate package that shares common dependencies and utilities.
- Python 3.11+
- UV package manager
- Clone the repository:
git clone https://github.com/itay1542/portfolio_service.git
cd portfolio_service
- Install dependencies for all workspace members:
uv sync
- Run a specific service:
# Run the brokerage service
uv run --package brokerage_service python src/server.py
# Run the market data service
uv run --package market_data_service python src/server.py
# Run the research service
uv run --package research_service python src/server.py
Create a .env
file in each service directory with the required credentials:
# TradeStation Configuration (market_data_service)
TRADESTATION_API_KEY="your_api_key"
TRADESTATION_API_SECRET="your_api_secret"
TS_REFRESH_TOKEN="your_refresh_token"
TS_ACCOUNT_ID="your_account_id"
# Interactive Brokers Configuration (shared)
IBKR_ACCOUNT_ID="your_account_id"
IBKR_CLIENT_ID="1"
IBKR_HOST="127.0.0.1"
IBKR_PORT="7496"
- Order execution and management
- Portfolio tracking
- Account management
- Position monitoring
- Real-time and historical market data
- Technical analysis
- News integration
- Options chain data
- TradingView market scanning
- Custom stock screening
- Technical indicator analysis
- Market research tools
Note: Requires a running IBKR TWS instance
- Market data access
- Order management
- News integration
- Options trading support
- Account monitoring
Market scanning capabilities with:
- Custom screening queries
- Pre-built scanners
- Technical indicator analysis
- Fundamental data access
Use the MCP Inspector for real-time debugging:
# Debug a specific service
npx @modelcontextprotocol/inspector uv run --package market_data_service python src/server.py
Run tests for a specific package:
uv run --package common pytest
Add dependencies to a specific service:
uv add --package market_data_service pandas
Configure in the appropriate location for your OS:
~/Library/Application\ Support/Claude/claude_desktop_config.json
%APPDATA%/Claude/claude_desktop_config.json
{
"mcpServers": {
"brokerage_service": {
"command": "uv",
"args": [
"--directory",
"<path_to_portfolio_service>",
"run",
"--package",
"brokerage_service",
"python",
"brokerage_service/src/server.py"
],
"env": {
"IBKR_ACCOUNT_ID": "your_account_id",
"IBKR_CLIENT_ID": "1",
"IBKR_HOST": "127.0.0.1",
"IBKR_PORT": "7496",
"TRADESTATION_API_KEY": "your_api_key",
"TRADESTATION_API_SECRET": "your_api_secret",
"TS_REFRESH_TOKEN": "your_refresh_token",
"TS_ACCOUNT_ID": "your_account_id",
"IBKR_CLIENT_ID": "1",
}
},
"market_data_service": {
"command": "uv",
"args": [
"--directory",
"<path_to_portfolio_service>",
"run",
"--package",
"market_data_service",
"python",
"market_data_service/src/server.py"
],
"env": {
"TRADESTATION_API_KEY": "your_api_key",
"TRADESTATION_API_SECRET": "your_api_secret",
"TS_REFRESH_TOKEN": "your_refresh_token",
"TS_ACCOUNT_ID": "your_account_id",
"IBKR_ACCOUNT_ID": "your_account_id",
"IBKR_CLIENT_ID": "2",
"IBKR_HOST": "127.0.0.1",
"IBKR_PORT": "7496",
}
},
"research_service": {
"command": "uv",
"args": [
"--directory",
"<path_to_portfolio_service>",
"run",
"--package",
"research_service",
"python",
"research_service/src/server.py"
]
}
}
}
- Create a new branch for your feature
- Make your changes
- Run tests across all affected packages
- Submit a pull request