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.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 .env files
  • 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


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.4.tar.gz (110.4 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.4-py3-none-any.whl (76.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: open_stocks_mcp-0.5.4.tar.gz
  • Upload date:
  • Size: 110.4 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.4.tar.gz
Algorithm Hash digest
SHA256 c9a247ab921b34347b28801f163b3932b89f41882a91e0d27ace0d8a80e6e196
MD5 efbaa096efca38b37a52f7fe3d0545ea
BLAKE2b-256 cbf6a43e47470f51aba7619d44bfabab46ae50c852955ffff04eb5c9b3aeaa7e

See more details on using hashes here.

Provenance

The following attestation bundles were made for open_stocks_mcp-0.5.4.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.4-py3-none-any.whl.

File metadata

File hashes

Hashes for open_stocks_mcp-0.5.4-py3-none-any.whl
Algorithm Hash digest
SHA256 cb91012312954894a4db17ec6f36d35036719949c8d46ef006b8428baabc16c1
MD5 87138667f8c6ff8d385b38c62b4498af
BLAKE2b-256 894ba1d7df583fcd80e0b1b020812538b80d3221d9172e61fd7902ece5d76b66

See more details on using hashes here.

Provenance

The following attestation bundles were made for open_stocks_mcp-0.5.4-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