Skip to main content

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.6-dev - Complete Trading Capabilities

  • 83 MCP tools across 9 categories
  • Complete trading functionality - stocks, options, order management
  • Live trading validated - Stock and options trading tested with real orders
  • 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 (✅ Live Tested):

  • Market, limit, stop-loss, trailing stop orders
  • Fractional share purchases
  • Buy/sell order placement
  • Individual and bulk order cancellation

Options Orders (✅ Live Tested):

  • Options limit orders (buy/sell) - API bugs fixed
  • Options discovery and contract search
  • Credit and debit spread strategies
  • 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

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

Completed in v0.5.6-dev:

  • Options trading API fixes - buy_option_limit and sell_option_limit now working
  • Live options validation - F $9 put successfully traded
  • Options discovery - find_options function working correctly

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:

  • Live trading capabilities - Real orders are placed with actual money
  • Never commit credentials to version control
  • Use proper file permissions for .env files
  • 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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

open_stocks_mcp-0.5.6.tar.gz (111.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

open_stocks_mcp-0.5.6-py3-none-any.whl (76.9 kB view details)

Uploaded Python 3

File details

Details for the file open_stocks_mcp-0.5.6.tar.gz.

File metadata

  • Download URL: open_stocks_mcp-0.5.6.tar.gz
  • Upload date:
  • Size: 111.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for open_stocks_mcp-0.5.6.tar.gz
Algorithm Hash digest
SHA256 af80ac42576f1b35c15fb308939d46074ec9b23feb28f6fbdd49b7c72268f367
MD5 c0deac9e9f183668dcdce5f094dda883
BLAKE2b-256 9db9fd7d83aeca58ae5547e101789dffb044bec7b8c7e7078dbb75311d3c3292

See more details on using hashes here.

Provenance

The following attestation bundles were made for open_stocks_mcp-0.5.6.tar.gz:

Publisher: publish.yml on Open-Agent-Tools/open-stocks-mcp

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file open_stocks_mcp-0.5.6-py3-none-any.whl.

File metadata

File hashes

Hashes for open_stocks_mcp-0.5.6-py3-none-any.whl
Algorithm Hash digest
SHA256 d564dadb68712b73f4f9e59fbe35ae5c43c8ecf1c923ce8eb8b25f5a2315696f
MD5 d17676c66cbba30b03f7aa6517140b26
BLAKE2b-256 0c7d8341c15238b309afdfed30dd4c3ada7952c8204d50e6903c4d47c1bb70d3

See more details on using hashes here.

Provenance

The following attestation bundles were made for open_stocks_mcp-0.5.6-py3-none-any.whl:

Publisher: publish.yml on Open-Agent-Tools/open-stocks-mcp

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page