alpaca
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
claude mcp add --transport stdio alpacahq-alpaca-mcp-server uvx alpaca-mcp-server serve \ --env ALPACA_API_KEY="your_alpaca_api_key" \ --env ALPACA_SECRET_KEY="your_alpaca_secret_key"
How to use
The Alpaca MCP Server exposes Alpaca's trading API through the Model Context Protocol, enabling natural language trading capabilities via AI assistants such as Claude Desktop, Cursor, and VS Code. It supports trading across assets (stocks, options, and crypto), portfolio management, and real-time market data. Once running, you can connect your MCP client to the alpaca MCP server instance using the provided mcp.json configuration. Use the included tools to place orders, query account status, fetch market data, and manage risk with natural language prompts. The server relies on your Alpaca API credentials to perform live or paper trading as configured in your environment variables and client configuration.
How to install
Prerequisites:
- Python 3.10+
- uv (installation guidance at https://docs.astral.sh/uv/getting-started/installation/)
- Alpaca Trading API keys (paper trading available)
- MCP client (Claude Desktop, Cursor, VS Code, etc.)
Step 1: Install uvx (one-time)
- Install uv/uvx per your platform following the official guide
Step 2: Install the Alpaca MCP Server (local installation)
- Option A: One-click via uvx (recommended for quick start)
- uvx alpaca-mcp-server init
Step 3: Configure API keys
- Set your Alpaca API keys in your environment or a .env file used by the MCP server:
- ALPACA_API_KEY=your_alpaca_api_key
- ALPACA_SECRET_KEY=your_alpaca_secret_key
Step 4: Run the MCP server
- Start the server with uvx using the embedded config example:
- uvx alpaca-mcp-server serve
Step 5: Configure MCP client
- Add the Alpaca MCP server to your MCP client configuration (Claude Desktop, Cursor, etc.) with the following example: { "mcpServers": { "alpaca": { "command": "uvx", "args": ["alpaca-mcp-server", "serve"], "env": { "ALPACA_API_KEY": "your_alpaca_api_key", "ALPACA_SECRET_KEY": "your_alpaca_secret_key" } } } }
Optional: If you prefer a local Python-based run, ensure Python 3.10+ is installed and run the server using your preferred Python workflow after cloning the repository and installing dependencies as needed.
Additional notes
Tips and common issues:
- Ensure your Alpaca API keys have the appropriate permissions for the actions you want to perform (trading vs data access).
- If you encounter environment variable issues, verify that your MCP client config takes precedence following the client’s docs.
- When switching from paper to live trading, update TRADE_API_URL/STREAM_DATA_WSS and related env values in your .env and client config as needed.
- If uvx is not recognized in your shell, restart your terminal or add uvx to your PATH.
- For troubleshooting, check the MCP server logs for authentication errors, invalid keys, or network connectivity problems with Alpaca services.
Related MCP Servers
ai-trader
Backtrader-powered backtesting framework for algorithmic trading, featuring 20+ strategies, multi-market support, CLI tools, and an integrated MCP server for professional traders.
mcp-aktools
📈 提供股票、加密货币的数据查询和分析功能MCP服务器
mcp_massive
An MCP server for Massive.com Financial Market Data
composer-trade
Composer's MCP server lets MCP-enabled LLMs like Claude backtest trading ideas and automatically invest in them for you
QMT
QMT-MCP 模块化量化交易助手
ccxt
CCXT MCP Server bridges the gap between AI models and cryptocurrency trading by providing a standardized interface through the Model Context Protocol. Created to empower automated trading strategies, this tool allows AI assistants like Claude and GPT to directly interact with over 100 cryptocurrency exchanges without requiring users to write comple