davdunc/mcp_etrade
If you are the rightful owner of mcp_etrade and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.
A comprehensive Model Context Protocol (MCP) server for E*TRADE integration with OAuth authentication, account management, risk calculations, watch lists, and trading guardrails.
E*TRADE MCP Server
A comprehensive Model Context Protocol (MCP) server for E*TRADE integration with OAuth authentication, account management, risk calculations, watch lists, and trading guardrails.
Features
🔐 OAuth Authentication
- Complete E*TRADE OAuth 1.0a flow
- Token management and renewal
- Secure credential handling
💰 Account Management
- Account balance retrieval
- Transaction history
- Portfolio viewing
- Real-time account data
📊 Risk Management
- R-multiple risk calculations
- Daily loss tracking
- Position sizing guardrails
- Risk validation before orders
📋 Watch Lists
- Create, read, update, delete watch lists
- Symbol management
- Independent from portfolio positions
📈 Market Data
- Option chains with expiration dates
- Real-time quotes
- Security lookup by company name
🚨 Alerts
- Price alerts management
- Alert notifications
- Custom alert conditions
Installation
Prerequisites
- Python 3.11+
- E*TRADE developer account with API keys
Install via UVX (Recommended)
uvx --from git+https://github.com/davdunc/mcp_etrade.git mcp_etrade
Install via pip
pip install git+https://github.com/davdunc/mcp_etrade.git
Development Install
git clone https://github.com/davdunc/mcp_etrade.git
cd mcp_etrade
pip install -e .
Configuration
Set your E*TRADE API credentials:
export ETRADE_OAUTH_CONSUMER_KEY="your_consumer_key"
export ETRADE_OAUTH_CONSUMER_SECRET="your_consumer_secret"
Usage
Standalone Server
python -m mcp_etrade.server
With Colosseum Framework
Add to ~/.config/colosseum/mcp.json
:
{
"etrade": {
"type": "etrade",
"command": "uvx",
"args": ["--from", "git+https://github.com/davdunc/mcp_etrade.git", "mcp_etrade"],
"env": {
"ETRADE_OAUTH_CONSUMER_KEY": "${ETRADE_OAUTH_CONSUMER_KEY}",
"ETRADE_OAUTH_CONSUMER_SECRET": "${ETRADE_OAUTH_CONSUMER_SECRET}"
}
}
}
Available Tools
Authentication
get_request_token
- Start OAuth flowget_authorization_url
- Get user authorization URLget_access_token
- Complete OAuth flowrenew_access_token
- Refresh tokensrevoke_access_token
- Revoke access
Account Management
get_account_balance
- Get account balance and detailslist_transactions
- List account transactionsget_transaction_details
- Get specific transaction detailsview_portfolio
- View portfolio positions
Risk Management
calculate_risk_parameters
- Calculate R-multiple risk parametersvalidate_order_risk
- Validate order against risk limitsget_daily_risk_status
- Get current daily risk utilizationrecord_actual_loss
- Record actual trading losses
Watch Lists
create_watch_list
- Create new watch listget_watch_lists
- Get all watch listsupdate_watch_list
- Update existing watch listdelete_watch_list
- Delete watch list
Market Data
get_option_chains
- Get option chains for symbolsget_option_expire_dates
- Get option expiration datesget_quotes
- Get real-time quoteslookup_product
- Search securities by company name
Alerts
list_alerts
- List price alertsdelete_alerts
- Delete alertsget_alert_details
- Get alert details
Risk Management
The server includes comprehensive risk management features:
- Daily Risk Limits: Configurable percentage of account balance
- Position Size Limits: Maximum 50% of account per order
- Loss Tracking: Both potential and actual loss tracking
- Validation: Pre-order risk validation with detailed messages
Example risk validation:
# Validate order before placement
result = await call_tool("validate_order_risk", {
"account_id": "your_account",
"order_value": 1000.00,
"risk_amount": 50.00,
"risk_percentage": 1.0
})
Testing
Run the comprehensive test suite:
pytest
Test Coverage:
- 105 passing tests
- OAuth authentication flows
- Account management operations
- Risk calculation accuracy
- Watch list CRUD operations
- Market data retrieval
- Alert management
Architecture
- Clean JSON Output: Structured responses for agent consumption
- Comprehensive Error Handling: Graceful failure modes
- Mock Data Support: Full functionality without live API calls
- Modular Design: Separate concerns for OAuth, risk, data, etc.
Integration
Designed for integration with:
- Colosseum: Multi-agent trading framework
- LangChain: Agent tooling and orchestration
- MCP Clients: Any MCP-compatible system
License
GNU General Public License v3.0
Contributing
- Fork the repository
- Create a feature branch
- Add tests for new functionality
- Ensure all tests pass
- Submit a pull request
Support
For issues and questions:
- GitHub Issues: https://github.com/davdunc/mcp_etrade/issues
- Documentation: See inline code documentation