MCP Server based on open stock API packages like Robin Stocks
Project description
Open Stocks MCP
An MCP (Model Context Protocol) server providing access to stock market data and trading capabilities through Robin Stocks API.
Features
🚀 Current Status: v0.5.1 - Complete BETA Trading Capabilities
- ✅ 83 MCP tools across 9 categories
- ✅ Complete trading functionality - stocks, options, order management
- ✅ Production-ready - HTTP transport, Docker support, comprehensive testing
- ✅ Phases 1-7 complete - Foundation → Analytics → Trading
Installation
pip install open-stocks-mcp
For development:
git clone https://github.com/Open-Agent-Tools/open-stocks-mcp.git
cd open-stocks-mcp
uv pip install -e .
Quick Start
1. Set Up Credentials
Create a .env file:
ROBINHOOD_USERNAME=your_email@example.com
ROBINHOOD_PASSWORD=your_password
2. Start the Server
HTTP Transport (Recommended)
open-stocks-mcp-server --transport http --port 3001
STDIO Transport
open-stocks-mcp-server --transport stdio
3. Test the Server
# Health check (HTTP transport)
curl http://localhost:3001/health
# Interactive testing
uv run mcp dev src/open_stocks_mcp/server/app.py
Docker Deployment
Production Docker Setup:
cd examples/open-stocks-mcp-docker
docker-compose up -d
Features:
- Persistent session storage
- Automatic log rotation
- Health monitoring
- Security headers and CORS
MCP Client Integration
Claude Desktop
Add to your MCP settings (~/Library/Application Support/Claude/claude_desktop_config.json):
{
"mcpServers": {
"open-stocks": {
"command": "open-stocks-mcp-server",
"args": ["--transport", "stdio"]
}
}
}
HTTP Transport Integration
{
"mcpServers": {
"open-stocks": {
"command": "python",
"args": ["-m", "mcp_http_client", "http://localhost:3001/mcp"]
}
}
}
Available Tools
Account & Portfolio (15 tools)
- Account information and details
- Portfolio positions and holdings
- Day trading metrics and history
- Stock and options order history
Market Data (12 tools)
- Real-time stock quotes and fundamentals
- Market movers and top performers
- Sector analysis and market trends
- Historical price data
Options Trading (15 tools)
- Options chains and market data
- Position aggregation and analysis
- Historical options data
- Options instrument search
Watchlists & Profiles (8 tools)
- Watchlist management
- User profile and settings
- Investment preferences
- Account features
Market Research (10 tools)
- Earnings data and analysis
- Stock ratings and news
- Dividend information
- Corporate actions and splits
Analytics & Monitoring (5 tools)
- Portfolio analytics
- Performance metrics
- Server health monitoring
- Interest and loan payments
Notifications (12 tools)
- Account notifications
- Margin calls and interest
- Subscription management
- Referral tracking
Advanced Instruments (4 tools)
- Multi-symbol instrument lookup
- Enhanced search capabilities
- Level II market data (Gold required)
- Direct instrument access
Trading Capabilities (19 tools)
Stock Orders:
- Market, limit, stop-loss, trailing stop orders
- Fractional share purchases
- Buy/sell order placement
Options Orders:
- Options limit orders (buy/sell)
- Credit and debit spread strategies
Order Management:
- Cancel individual or all orders
- View open positions
- Order status tracking
Authentication
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
Development
Testing
pytest # All tests
pytest tests/unit/ # Unit tests (fast)
pytest -m "not slow and not exception_test" # Recommended for development
Code Quality
ruff check . --fix # Lint and fix
ruff format . # Format code
mypy . # Type check
Google ADK Evaluation
# 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.json
Project Scope
Phase 8 (v0.6.0) - Final Phase:
- Quality & reliability improvements
- Enhanced monitoring and observability
- Performance optimization
Out of Scope:
- Crypto trading tools
- Banking/ACH transfers
- Account modifications
- Deposit/withdrawal functionality
Contributing
See CONTRIBUTING.md for development guidelines.
License
MIT License - see LICENSE file for details.
Security
Important Security Notes:
- This is a read-only API with trading capabilities - use with caution
- Never commit credentials to version control
- Use proper file permissions for
.envfiles - Trading tools are provided for educational/development purposes
- Always verify trades before execution in production
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.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file open_stocks_mcp-0.5.1.tar.gz.
File metadata
- Download URL: open_stocks_mcp-0.5.1.tar.gz
- Upload date:
- Size: 102.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
38a4ca93b24b43178569a3c3cb3f20d0851caf93ea642c72b1c6680e2c221938
|
|
| MD5 |
ceff47923cd05dcc65481740e34c0101
|
|
| BLAKE2b-256 |
3a509d363680ecc287b3a7953d94eb11ca6f790d8c0ab0da80a168b3308ece14
|
Provenance
The following attestation bundles were made for open_stocks_mcp-0.5.1.tar.gz:
Publisher:
publish.yml on Open-Agent-Tools/open-stocks-mcp
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
open_stocks_mcp-0.5.1.tar.gz -
Subject digest:
38a4ca93b24b43178569a3c3cb3f20d0851caf93ea642c72b1c6680e2c221938 - Sigstore transparency entry: 367230772
- Sigstore integration time:
-
Permalink:
Open-Agent-Tools/open-stocks-mcp@e49c2b5ab5a1c3f7099c89c2ac58ec824896c36f -
Branch / Tag:
refs/tags/v0.5.1 - Owner: https://github.com/Open-Agent-Tools
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@e49c2b5ab5a1c3f7099c89c2ac58ec824896c36f -
Trigger Event:
release
-
Statement type:
File details
Details for the file open_stocks_mcp-0.5.1-py3-none-any.whl.
File metadata
- Download URL: open_stocks_mcp-0.5.1-py3-none-any.whl
- Upload date:
- Size: 73.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0405f80df1b679a2bb6e870b112212ed154ff7571ff1197d6fa4b60f089b9437
|
|
| MD5 |
7e06df7860d6a63cd4f2a396d15ecc70
|
|
| BLAKE2b-256 |
27ec711e4f3487bf1deed2130e46426647fc82af47c59837f3c7cc03d8a39ccc
|
Provenance
The following attestation bundles were made for open_stocks_mcp-0.5.1-py3-none-any.whl:
Publisher:
publish.yml on Open-Agent-Tools/open-stocks-mcp
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
open_stocks_mcp-0.5.1-py3-none-any.whl -
Subject digest:
0405f80df1b679a2bb6e870b112212ed154ff7571ff1197d6fa4b60f089b9437 - Sigstore transparency entry: 367230777
- Sigstore integration time:
-
Permalink:
Open-Agent-Tools/open-stocks-mcp@e49c2b5ab5a1c3f7099c89c2ac58ec824896c36f -
Branch / Tag:
refs/tags/v0.5.1 - Owner: https://github.com/Open-Agent-Tools
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@e49c2b5ab5a1c3f7099c89c2ac58ec824896c36f -
Trigger Event:
release
-
Statement type: