Sponsored by Deepsite.site

Robinhood Mcp Server

Created By
rohitsingh-iitd7 months ago
The Robinhood MCP Server provides a comprehensive interface to the Robinhood Crypto API. This server handles authentication, account management, market data retrieval, and trading operations through both REST API and WebSocket interfaces.
Content

Robinhood MCP Server - User Guide

Overview

The Robinhood MCP Server provides a comprehensive interface to the Robinhood Crypto API. This server handles authentication, account management, market data retrieval, and trading operations through both REST API and WebSocket interfaces.

Installation

Prerequisites

  • Python 3.8 or higher
  • pip (Python package manager)

Setup

  1. Clone or download the repository:

    git clone https://github.com/rohitsingh-iitd/robinhood-mcp-server
    cd robinhood-mcp-server
    
  2. Install dependencies:

    pip install -r requirements.txt
    
  3. Configure environment variables:

    • Copy .env.example to .env
    • Edit .env and add your Robinhood API credentials:
      ROBINHOOD_API_KEY=your_api_key_here
      ROBINHOOD_PRIVATE_KEY=your_base64_encoded_private_key_here
      

Running the Server

Start the server with the following command:

python -m src.main

This will start both the REST API server (default port 8000) and the WebSocket server (default port 8001).

REST API Endpoints

Authentication

  • GET /auth/status - Check authentication status

Account

  • GET /account - Get account information
  • GET /account/holdings - Get account holdings (optional query param: asset_code)

Market Data

  • GET /market/best-price - Get best bid/ask price (optional query param: symbol)
  • GET /market/estimated-price - Get estimated price for quantity (required query params: symbol, side, quantity)

Trading

  • GET /trading/pairs - Get available trading pairs (optional query param: symbol)
  • GET /trading/orders - Get order history (optional query param: status)
  • GET /trading/orders/{id} - Get order details
  • POST /trading/orders - Place a new order
    • Required fields: symbol, side, quantity
    • Optional fields: type, price, time_in_force, stop_price
  • DELETE /trading/orders/{id} - Cancel an order

WebSocket API

The WebSocket server provides real-time updates for market data and order status.

Connection

Connect to the WebSocket server at:

ws://localhost:8001

Market Data Subscription

Subscribe to market data updates:

{
  "type": "market_data",
  "action": "subscribe",
  "symbols": ["BTC-USD", "ETH-USD"]
}

Unsubscribe from market data updates:

{
  "type": "market_data",
  "action": "unsubscribe",
  "symbols": ["BTC-USD", "ETH-USD"]
}

Order Updates Subscription

Subscribe to order updates:

{
  "type": "orders",
  "action": "subscribe"
}

Unsubscribe from order updates:

{
  "type": "orders",
  "action": "unsubscribe"
}

Ping/Pong

Send a ping to keep the connection alive:

{
  "type": "ping"
}

The server will respond with:

{
  "type": "pong"
}

Testing

Run the validation tests to ensure the server is working correctly:

python -m tests.test_server

Configuration Options

The following environment variables can be configured in the .env file:

  • ROBINHOOD_API_KEY - Your Robinhood API key
  • ROBINHOOD_PRIVATE_KEY - Your base64-encoded private key
  • HOST - Server host (default: 0.0.0.0)
  • PORT - REST API server port (default: 8000)
  • DEBUG - Enable debug mode (default: False)
  • LOG_LEVEL - Logging level (default: INFO)
  • LOG_FILE - Log file path (default: robinhood_mcp_server.log)
  • RATE_LIMIT_ENABLED - Enable rate limiting (default: True)
  • RATE_LIMIT_REQUESTS - Maximum requests per period (default: 100)
  • RATE_LIMIT_PERIOD - Rate limit period in seconds (default: 60)

Security Considerations

  • API keys and secrets are stored in environment variables, never in code
  • All sensitive data is properly handled
  • Input validation is implemented for all API endpoints
  • Rate limiting is enforced to prevent abuse
  • Proper error handling to avoid leaking sensitive information

Troubleshooting

If you encounter issues:

  1. Check the log file for detailed error messages
  2. Verify your API credentials are correct
  3. Ensure you have proper network connectivity
  4. Check that the Robinhood API is available

License

This project is licensed under the MIT License - see the LICENSE file for details.

Server Config

{
  "mcpServers": {
    "robinhood": {
      "command": "docker",
      "args": [
        "run",
        "-i",
        "--rm",
        "-p",
        "8000:8000",
        "-p",
        "8001:8001",
        "-e",
        "ROBINHOOD_API_KEY",
        "-e",
        "ROBINHOOD_PRIVATE_KEY",
        "-e",
        "HOST=0.0.0.0",
        "-e",
        "PORT=8000",
        "-e",
        "DEBUG=False",
        "-e",
        "LOG_LEVEL=INFO",
        "-e",
        "RATE_LIMIT_ENABLED=True",
        "-e",
        "RATE_LIMIT_REQUESTS=100",
        "-e",
        "RATE_LIMIT_PERIOD=60",
        "robinhood-mcp-server"
      ],
      "env": {
        "ROBINHOOD_API_KEY": "<YOUR_API_KEY>",
        "ROBINHOOD_PRIVATE_KEY": "<YOUR_BASE64_ENCODED_PRIVATE_KEY>"
      }
    }
  }
}
Recommend Servers
TraeBuild with Free GPT-4.1 & Claude 3.7. Fully MCP-Ready.
WindsurfThe new purpose-built IDE to harness magic
AiimagemultistyleA Model Context Protocol (MCP) server for image generation and manipulation using fal.ai's Stable Diffusion model.
Serper MCP ServerA Serper MCP Server
Tavily Mcp
Jina AI MCP ToolsA Model Context Protocol (MCP) server that integrates with Jina AI Search Foundation APIs.
Playwright McpPlaywright MCP server
TimeA Model Context Protocol server that provides time and timezone conversion capabilities. This server enables LLMs to get current time information and perform timezone conversions using IANA timezone names, with automatic system timezone detection.
BlenderBlenderMCP connects Blender to Claude AI through the Model Context Protocol (MCP), allowing Claude to directly interact with and control Blender. This integration enables prompt assisted 3D modeling, scene creation, and manipulation.
CursorThe AI Code Editor
MCP AdvisorMCP Advisor & Installation - Use the right MCP server for your needs
Amap Maps高德地图官方 MCP Server
EdgeOne Pages MCPAn MCP service designed for deploying HTML content to EdgeOne Pages and obtaining an accessible public URL.
Howtocook Mcp基于Anduin2017 / HowToCook (程序员在家做饭指南)的mcp server,帮你推荐菜谱、规划膳食,解决“今天吃什么“的世纪难题; Based on Anduin2017/HowToCook (Programmer's Guide to Cooking at Home), MCP Server helps you recommend recipes, plan meals, and solve the century old problem of "what to eat today"
Zhipu Web SearchZhipu Web Search MCP Server is a search engine specifically designed for large models. It integrates four search engines, allowing users to flexibly compare and switch between them. Building upon the web crawling and ranking capabilities of traditional search engines, it enhances intent recognition capabilities, returning results more suitable for large model processing (such as webpage titles, URLs, summaries, site names, site icons, etc.). This helps AI applications achieve "dynamic knowledge acquisition" and "precise scenario adaptation" capabilities.
Visual Studio Code - Open Source ("Code - OSS")Visual Studio Code
DeepChatYour AI Partner on Desktop
Context7Context7 MCP Server -- Up-to-date code documentation for LLMs and AI code editors
ChatWiseThe second fastest AI chatbot™
Baidu Map百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
MiniMax MCPOfficial MiniMax Model Context Protocol (MCP) server that enables interaction with powerful Text to Speech, image generation and video generation APIs.