How to connect Claude to Alpaca via MCP
✓ Written from official docs · checked 2026-10-16
Alpaca's official MCP server runs locally and exposes 65 tools across the Trading and Market Data APIs. These steps come from Alpaca's MCP docs.
Prerequisites
- Python 3.10+
uvwithuvx- Alpaca API keys (a free paper trading account is enough to start)
- An MCP client: Claude Desktop, Claude Code, Cursor, VS Code, Gemini CLI or PyCharm
Claude Desktop
Add to claude_desktop_config.json:
{
"mcpServers": {
"alpaca": {
"command": "uvx",
"args": ["alpaca-mcp-server"],
"env": {
"ALPACA_API_KEY": "your_alpaca_api_key",
"ALPACA_SECRET_KEY": "your_alpaca_secret_key"
}
}
}
}
Claude Code (CLI)
claude mcp add alpaca --scope user --transport stdio uvx alpaca-mcp-server \ --env ALPACA_API_KEY=your_alpaca_api_key \ --env ALPACA_SECRET_KEY=your_alpaca_secret_key
Verify
Restart the client and ask: "What is my Alpaca account balance and buying power?" If account details come back, it is connected.
Safety settings
ALPACA_PAPER_TRADEdefaults totrue. Live trading only happens when you set it tofalseand use live keys.ALPACA_TOOLSETSlimits the tools exposed. A read-only example from the docs:account,stock-data,crypto-data,options-data,news(notradingtoolset).- Alpaca warns: never paste API keys into chat; orders execute directly against the Trading API, so review AI-suggested orders.
- Some real-time data needs an Algo Trader Plus subscription.