An MCP (Model Context Protocol) server providing access to stock market data and trading capabilities through multiple broker APIs.
π Current Status: v0.7.0-dev - Multi-Broker Support (Robinhood + Schwab)
- β 104 MCP tools total - 80 Robinhood + 24 Schwab (4 deprecated)
- β Multi-broker architecture - Support for Robinhood and Charles Schwab
- β Complete trading functionality - stocks, options, order management
- β Live trading validated - Robinhood stock and options trading tested with real orders
- β Production-ready - HTTP transport, Docker support, comprehensive testing
- β Schwab integration complete - OAuth authentication, 24 tools ready for testing
- π§ Account details fixed - Real financial data instead of N/A values
pip install open-stocks-mcpFor development:
git clone https://github.com/Open-Agent-Tools/open-stocks-mcp.git
cd open-stocks-mcp
uv pip install -e .Create a .env file:
For Robinhood:
ROBINHOOD_USERNAME=your_email@example.com
ROBINHOOD_PASSWORD=your_passwordFor Schwab (optional):
SCHWAB_API_KEY=your_api_key
SCHWAB_APP_SECRET=your_app_secret
SCHWAB_CALLBACK_URL=https://127.0.0.1:8182/
SCHWAB_TOKEN_PATH=~/.tokens/schwab_token.json
# Enable both brokers
ENABLED_BROKERS=robinhood,schwabNote: Schwab requires a developer account and API approval (several days). See docs/SCHWAB_INTEGRATION_PLAN.md for details.
HTTP Transport (Recommended)
open-stocks-mcp-server --transport http --port 3001STDIO Transport
open-stocks-mcp-server --transport stdio# Health check (HTTP transport)
curl http://localhost:3001/health
# Interactive testing
uv run mcp dev src/open_stocks_mcp/server/app.pyProduction Docker Setup:
cd examples/open-stocks-mcp-docker
docker-compose up -dFeatures:
- Persistent session storage
- Automatic log rotation
- Health monitoring
- Security headers and CORS
Add to your MCP settings (~/Library/Application Support/Claude/claude_desktop_config.json):
{
"mcpServers": {
"open-stocks": {
"command": "open-stocks-mcp-server",
"args": ["--transport", "stdio"]
}
}
}{
"mcpServers": {
"open-stocks": {
"command": "python",
"args": ["-m", "mcp_http_client", "http://localhost:3001/mcp"]
}
}
}Robinhood Tools (80 tools):
- All existing Robinhood functionality maintained
- No breaking changes to existing API
Schwab Tools (24 tools):
- Account & Portfolio (5 tools) - account numbers, balances, positions
- Market Data (5 tools) - quotes, price history, instrument search
- Trading (8 tools) - market/limit buy/sell, order management
- Options (6 tools) - chains, expirations, positions, buy/sell
All Schwab tools use schwab_ prefix (e.g., schwab_get_portfolio, schwab_buy_stock_market).
- Account information and details
- Portfolio positions and holdings
- Day trading metrics and history
- Stock and options order history
- Real-time stock quotes and fundamentals
- Market movers and top performers
- Sector analysis and market trends
- Historical price data
- Options chains and market data
- Position aggregation and analysis
- Historical options data
- Options instrument search
- Watchlist management - All 5 tools working (add/remove symbols tested with AMC)
- User profile and settings
- Investment preferences
- Account features
- Earnings data and analysis
- Stock ratings and news
- Dividend information
- Corporate actions and splits
- Portfolio analytics
- Performance metrics
- Server health monitoring
- Interest and loan payments
- Account notifications
- Margin calls and interest
- Subscription management
- Referral tracking
- Multi-symbol instrument lookup
- Enhanced search capabilities
- Level II market data (Gold required)
- Direct instrument access
Stock Orders (β Live Tested):
- β Market orders - Buy/sell tested with XOM and AMC
- β Limit orders - Buy/sell tested with XOM ($106) and AMC ($3)
- β Stop-loss orders - Sell tested with AMC (25 shares at $2.50)
- Individual and bulk order cancellation
- β Deprecated: Trailing stop orders, fractional shares (uncommon use cases)
Options Orders (β Live Tested):
- β Options limit orders (buy/sell) - API bugs fixed
- β Options discovery and contract search
- β Credit and debit spread strategies - API bugs fixed, ready for testing
- Live validation: F $9 put sell order placed successfully
Order Management:
- Cancel individual or all orders (stock and options)
- View open positions
- Order status tracking
The server handles Robinhood's authentication requirements:
- Device Verification: Automatic handling of new device approval
- Multi-Factor Authentication: Support for SMS and app-based MFA
- Session Persistence: Cached authentication to reduce re-verification
pytest # All tests
pytest -m "journey_account" # Fast account tests (~1.8s)
pytest -m "journey_market_data" # Market data tests (~3.8s)
pytest -m "not slow and not exception_test" # Recommended for development
# See CLAUDE.md for complete journey testing guideruff check . --fix # Lint and fix
ruff format . # Format code
mypy . # Type check# Set environment variables
export GOOGLE_API_KEY="your-google-api-key"
export ROBINHOOD_USERNAME="email@example.com"
export ROBINHOOD_PASSWORD="password"
# Start Docker server
cd examples/open-stocks-mcp-docker && docker-compose up -d
# Run evaluation
MCP_HTTP_URL="http://localhost:3001/mcp" adk eval examples/google_adk_agent tests/evals/list_available_tools_test.json --config_file_path tests/evals/test_config.jsonCompleted in v0.7.0-dev:
- β Multi-broker architecture - Abstract broker layer supporting multiple brokers
- β Schwab integration - 24 tools across account, market data, trading, and options
- β OAuth authentication - Schwab OAuth 2.0 flow with automatic token refresh
- β Graceful degradation - Server starts even if broker authentication fails
- β Backward compatibility - All Robinhood tools unchanged, no breaking changes
Completed in v0.6.4:
- β
Enhanced Options Tools - New
open_option_positions_with_details()enriches positions with call/put type - β Stock trading API fixes - Market, limit, and stop-loss buy/sell functions now working correctly
- β Live stock trading validation - XOM and AMC orders successfully placed (market, limit, stop-loss)
- β Tool deprecation - Removed 4 uncommon trading functions (buy_stock_stop_loss, trailing stops, fractional shares)
- β
Options trading API fixes -
buy_option_limit,sell_option_limit, and spread strategies now working - β Live options validation - F $9 put successfully traded
- β
Options discovery -
find_optionsfunction working correctly - β Options spreads fixed - Credit and debit spread functions corrected (API signature, data structure, symbol extraction)
- β Watchlist management complete - All 5 watchlist tools working with live testing
- β Watchlist API fixes - Fixed response format changes and parameter binding issues
- β All trading functions ready - Phase 7 complete, ready for Phase 8
Next Priority (Schwab Testing):
- β³ Schwab journey tests (blocked by API credentials)
- β³ Live Schwab trading validation
- β³ Multi-broker integration tests
- β³ Schwab-specific documentation
Out of Scope:
- Crypto trading tools
- Banking/ACH transfers
- Account modifications
- Deposit/withdrawal functionality
See CONTRIBUTING.md for development guidelines.
MIT License - see LICENSE file for details.
Important Security Notes:
- Live trading capabilities - Real orders are placed with actual money
- Never commit credentials to version control
- Use proper file permissions for
.envfiles - Trading validation complete - Both stock and options trading tested
- Always verify trades before execution in production
- Options trading note: Selling options (like puts) can result in assignment and stock ownership
For security concerns, please see our security policy.
Disclaimer: This software is for educational and development purposes. Trading stocks and options involves substantial risk. Always verify trades and understand the risks before executing any financial transactions.