development
location
documentation
public
trading
API
What is Alpaca?
Documentation
Alpaca MCP Server
This is a Model Context Protocol (MCP) server implementation for Alpaca's Trading API. It enables large language models (LLMs) on Claude Desktop, Cursor, or VScode to interact with Alpaca's trading infrastructure using natural language (English). This server supports stock trading, options trading, portfolio management, watchlist handling, and real-time market data access.
Features
Market Data - Real-time quotes, trades, and price bars for stocks
Historical price data and trading history
Option contract quotes and Greeks (via snapshots)
Account Management - View balances, buying power, and account status
Inspect all open and closed positions
Position Management - Get detailed info on individual holdings
Liquidate all or partial positions by share count or percentage
Order Management - Place stock and option orders (market or limit)
Cancel orders individually or in bulk
Retrieve full order history
Options Trading - Search and view option contracts by expiration or strike price
Place multi-leg options strategies
Get latest quotes and Greeks for contracts
Market Status & Corporate Actions - Check if markets are open
Watchlist Management - Create, update, and view personal watchlists
Manage multiple watchlists for tracking assets
Asset Search - Query details for stocks and other Alpaca-supported assets
Prerequisites
Python
GitHub account
Alpaca API keys (with paper or live trading access)
Claude for Desktop or another compatible MCP client
Installation
Clone the repository and navigate to the directory:
git clone https://github.com/alpacahq/alpaca-mcp-server.git
cd alpaca-mcp-server
Create and activate a virtual environment:
python3 -m venv venv
source venv/bin/activate
Install the required packages:
pip install -r requirements.txt
Usage
Open a terminal in the project root directory and run the following command:
For local usage (default - stdio transport):
python alpaca_mcp_server.py
For remote usage (HTTP transport):
python alpaca_mcp_server.py --transport http
License
MIT
Disclosure
Please note that the content on this page is for informational purposes only. Alpaca does not recommend any specific securities or investment strategies. Options trading is not suitable for all investors due to its inherent high risk, which can potentially result in significant losses.