Skip to main content

MCP Server based on open stock API packages like Robin Stocks

Project description

open-stocks-mcp

🚧 UNDER CONSTRUCTION 🚧

An MCP (Model Context Protocol) server providing access to stock market data through open-source APIs like Robin Stocks.

Project Intent

This project aims to create a standardized interface for LLM applications to access stock market data, portfolio information, and trading capabilities through the Model Context Protocol.

Planned Features

  • Real-time stock price data
  • Portfolio management tools
  • Market analysis capabilities
  • Historical data access
  • Trading alerts and notifications

Status

  • Foundation: MCP server scaffolding complete
  • Infrastructure: CI/CD, testing, and publishing pipeline established
  • Package: Published to PyPI as open-stocks-mcp (v0.1.5)
  • Communication: Server/client MCP communication verified working
  • 🔄 In Progress: Robin Stocks API integration
  • 📋 Next: Core stock market tools implementation

Installation

Install the Open Stocks MCP server via pip:

pip install open-stocks-mcp

For development installation from source:

git clone https://github.com/Open-Agent-Tools/open-stocks-mcp.git
cd open-stocks-mcp
uv pip install -e .

Credential Management

The Open Stocks MCP server uses Robin Stocks for market data access, which requires Robinhood account credentials.

Setting Up Credentials

  1. Create a .env file in your project root:
ROBINHOOD_USERNAME=your_email@example.com
ROBINHOOD_PASSWORD=your_password
  1. Secure your credentials:
    • Never commit the .env file to version control
    • Ensure proper file permissions: chmod 600 .env
    • Consider using a password manager or secure credential storage

Multi-Factor Authentication (MFA)

If your Robinhood account has MFA enabled you will have a pop up in the mobile app, it is recommended to have your app open during login.

Starting the MCP Server Locally

Via Command Line

Start the server in stdio transport mode (for MCP clients):

# Using the installed package
open-stocks-mcp-server --transport stdio

# For development with auto-reload
uv run open-stocks-mcp-server --transport stdio

Testing the Server

Use the MCP Inspector for interactive testing:

# Run the inspector with the server (mcp CLI required)
uv run mcp dev src/open_stocks_mcp/server/app.py

Note: The mcp command is installed with the mcp[cli] package dependency.

Adding the MCP Client to an ADK Agent

To integrate Open Stocks MCP with your ADK (Agent Development Kit) agent:

1. Update MCP Settings

Add the server to your MCP settings configuration (typically in mcp_settings.json or similar):

{
  "mcpServers": {
    "open-stocks": {
      "command": "open-stocks-mcp-server",
      "args": ["--transport", "stdio"],
      "env": {}
    }
  }
}

2. Claude Desktop Integration

For Claude Desktop app, add to your configuration:

macOS: ~/Library/Application Support/Claude/claude_desktop_config.json Windows: %APPDATA%\Claude\claude_desktop_config.json

{
  "mcpServers": {
    "open-stocks": {
      "command": "open-stocks-mcp-server",
      "args": ["--transport", "stdio"]
    }
  }
}

3. Available Tools

Once connected, your agent will have access to tools like:

  • get_portfolio - Retrieve current portfolio holdings and values
  • get_stock_orders - Get list of stock orders and their status
  • (More tools coming in future versions)

Current Functionality (v0.1.5)

The package currently includes:

Robin Stocks Authentication

  • Environment-based login: Stores credentials in .env file
  • Auto-login flow: Automatic credential detection and login on server startup
  • MFA Support: Mobile app notification for accounts with MFA enabled

Testing

Basic Tests

Run the basic test suite:

uv run pytest

Login Flow Integration Tests

Test the complete login flow with real credentials from .env:

# Run all tests including integration tests
uv run pytest -m integration

# Run specific login flow tests
uv run pytest tests/test_server_login_flow.py -v

# Run without integration tests (no credentials needed)
uv run pytest -m "not integration"

Note: Integration tests require valid ROBINHOOD_USERNAME and ROBINHOOD_PASSWORD in your .env file. These tests mock the actual Robin Stocks API calls to avoid real authentication attempts.

Test Categories

  • Unit tests: Basic functionality without external dependencies
  • Integration tests: Login flow tests using real credentials (but mocked API calls)
  • Slow tests: Performance and stress tests (marked with @pytest.mark.slow)

For development with auto-reloading:

uv run pytest --watch

License

Apache License 2.0 - see LICENSE file for details.

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.1.5.tar.gz (39.7 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.1.5-py3-none-any.whl (37.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: open_stocks_mcp-0.1.5.tar.gz
  • Upload date:
  • Size: 39.7 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.1.5.tar.gz
Algorithm Hash digest
SHA256 68686ad3c5d8c5e7fc325c586a2911cba435d92d43d5dbb05baa9d8b8fc4c1ee
MD5 b3648372282ced7d89b4be155965eacf
BLAKE2b-256 ea9751db34392b211edd8d7a88ef3c140e63ca23b518abc5ee9a5ff6315154ba

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for open_stocks_mcp-0.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 56834149a13e51c9d349d36bc52f47830b049eee683ce35cdeb427c666b6f318
MD5 4400fca46949064444fc229da27916b1
BLAKE2b-256 e3315273e96c34c28842873f518e7124963987c17a15976aff7a3855d46fd088

See more details on using hashes here.

Provenance

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