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.1.tar.gz (102.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.1-py3-none-any.whl (73.7 kB view details)

Uploaded Python 3

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

Hashes for open_stocks_mcp-0.5.1.tar.gz
Algorithm Hash digest
SHA256 38a4ca93b24b43178569a3c3cb3f20d0851caf93ea642c72b1c6680e2c221938
MD5 ceff47923cd05dcc65481740e34c0101
BLAKE2b-256 3a509d363680ecc287b3a7953d94eb11ca6f790d8c0ab0da80a168b3308ece14

See more details on using hashes here.

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

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.1-py3-none-any.whl.

File metadata

File hashes

Hashes for open_stocks_mcp-0.5.1-py3-none-any.whl
Algorithm Hash digest
SHA256 0405f80df1b679a2bb6e870b112212ed154ff7571ff1197d6fa4b60f089b9437
MD5 7e06df7860d6a63cd4f2a396d15ecc70
BLAKE2b-256 27ec711e4f3487bf1deed2130e46426647fc82af47c59837f3c7cc03d8a39ccc

See more details on using hashes here.

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

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