alpaca-mcp-server  by alpacahq

LLM-driven financial trading and data analysis

Created 3 months ago
266 stars

Top 96.2% on SourcePulse

GitHubView on GitHub
Project Summary

Summary

Alpaca MCP Server enables Large Language Models (LLMs) to interact with Alpaca's trading platform via natural language. It allows users to control stock, crypto, and options trading, manage portfolios, and perform market data analysis directly within LLM-integrated tools like Claude Desktop, Cursor, and VS Code.

How It Works

This project implements the Model Context Protocol (MCP) to translate natural language commands into Alpaca API calls. It acts as a server, supporting stdio and http transports, to bridge LLMs with financial trading infrastructure. The system handles real-time data, order execution, position management, and watchlist operations, providing an AI-driven interface to market activities.

Quick Start & Requirements

  • Installation: Clone repo, set up a Python virtual environment (venv/uv), pip install -r requirements.txt.
  • Prerequisites: Python, Alpaca API keys (paper/live), MCP client (Claude Desktop, Cursor, VS Code).
  • Configuration: Populate .env with API keys.
  • Running: python alpaca_mcp_server.py (stdio) or python alpaca_mcp_server.py --transport http (http).
  • Client Setup: Detailed guides for IDEs/clients are provided, linking to official MCP documentation.

Highlighted Details

  • Comprehensive Trading: Supports real-time/historical data, stock/crypto/options trading (including multi-leg strategies), account/position management, and watchlists.
  • LLM Integration: Specifically designed for seamless integration with popular AI development tools via MCP.
  • Flexible Transport: Offers stdio for local use and http for remote connections, with configurable host/port.
  • Extensive Examples: Numerous natural language query examples cover trading, options, and data analysis.

Maintenance & Community

The README does not specify contributors, sponsorships, or community channels (e.g., Discord, Slack). GitHub Actions workflows are present.

Licensing & Compatibility

  • License: MIT License.
  • Compatibility: Designed for MCP-compliant LLM clients and Alpaca's trading APIs. Docker images are available.

Limitations & Caveats

  • Security: Users must manage API keys securely and critically review LLM-generated trading actions, especially for options. HTTP transport requires careful remote access security configuration.
  • Analytics: Includes opt-out usage analytics via a default user agent.
  • Disclaimers: Alpaca provides standard disclaimers on investment risks and algorithmic calculation accuracy.
Health Check
Last Commit

2 weeks ago

Responsiveness

Inactive

Pull Requests (30d)
2
Issues (30d)
1
Star History
33 stars in the last 30 days

Explore Similar Projects

Feedback? Help us improve.