home / mcp / alpaca mcp server
Alpaca’s official MCP Server lets you trade stocks, ETFs, crypto, and options, run data analysis, and build strategies in plain English directly from your favorite LLM tools and IDEs
Configuration
View docs{
"mcpServers": {
"alpacahq-alpaca-mcp-server": {
"url": "https://your-domain.com/mcp",
"headers": {
"ALPACA_API_KEY": "sk_yourapikey",
"ALPACA_SECRET_KEY": "secret_yoursecret"
}
}
}
}You can run and connect Alpaca's MCP Server to your preferred MCP client to trade programmatically using natural language prompts. It provides real-time market data, account, positions, orders, and diverse trading capabilities for stocks, crypto, and options within a single, extensible server.
Connect the Alpaca MCP Server to an MCP client such as Claude Desktop, Cursor, VS Code, or Claude Code. Use the client to issue natural language commands that get translated into trading actions, place orders, fetch market data, manage watchlists, and inspect your portfolio. The server supports real-time quotes, trades, and price bars; historical data; account and position management; and a wide range of order types and options strategies. Start by configuring your MCP server credentials, then add the server to your MCP client of choice. When you issue prompts, the MCP client routes them to the server and returns structured results you can review before execution.
Prerequisites you need before installing the MCP server.
Then follow concrete installation options to get started quickly.
Keep your Alpaca API keys secure. Treat all credentials as sensitive. When you use remote hosting or cloud deployments, ensure access is restricted and secured with proper authentication and TLS. The MCP client configuration can override server env settings, so verify that your keys and trading mode (paper vs live) are correct in the appropriate config.
If you encounter issues, verify that your environment variables are set, the MCP server is reachable from your MCP client, and the client is restarted after any config change. Check for port conflicts when using HTTP transport and consider using transport with a dedicated port or a proxy with authentication for remote access.
Several installation and configuration options are provided to suit your environment. You can install locally with uvx, use install.py for Cursor or Claude Desktop, or run via Docker. For remote hosting, you can deploy the MCP server in the cloud and connect it to Claude Web, Claude Mobile, or other MCP clients.
You can configure the MCP server to run locally using uvx. The following example starts the server and serves MCP requests with environment variables for Alpaca credentials.
Prompts and outputs demonstrate typical trading tasks, such as checking balances, placing orders, retrieving quotes, and inspecting positions. The MCP server returns structured responses that describe the action taken, its status, and any data retrieved or generated.
View balance, buying power, and account status
List all held assets
Detailed info on a specific position
Search asset metadata
List all tradable instruments with filtering options
Historical and future corporate actions (earnings, dividends, splits)
Retrieve account portfolio history with equity and P/L over time
Create a new watchlist with symbols
Retrieve all saved watchlists
Modify an existing watchlist by ID
Get a specific watchlist by ID
Add an asset to a watchlist
Remove an asset from a watchlist
Delete a specific watchlist
Holidays and trading days in a date range
Market open/close times and current status
OHLCV historical bars with flexible timeframes
Historical quote data (level 1 bid/ask) for a stock
Trade-level history for a stock
Most recent OHLCV bar for a stock
Real-time bid/ask quote for one or more symbols
Latest market trade price for a symbol
Comprehensive snapshot for a stock
Historical price bars for cryptocurrency with configurable timeframe
Historical quote data for crypto
Historical trade prints for cryptocurrency
Latest quote for one or more crypto symbols
Latest minute bar for crypto
Latest trade for crypto
Comprehensive crypto snapshot
Get option contracts with flexible filtering
Latest bid/ask on contract
Get Greeks and underlying
Retrieve all or filtered orders
Place a stock order of any type (market, limit, stop, stop_limit, trailing_stop)
Place a crypto order with market, limit, and stop_limit types
Place an options order (single or multi-leg)
Cancel all open orders
Cancel a specific order
Close part or all of a position
Liquidate entire portfolio
Exercise a held option contract