| name | alpaca-trading-mcp |
| description | Trade stocks, ETFs, crypto, and options through Alpaca's MCP server using natural language in AI assistants |
| triggers | ["place a trade on Alpaca","check my Alpaca portfolio","get real-time stock quotes","create an options strategy","analyze market data with Alpaca","manage my trading watchlist","check crypto prices on Alpaca","place a limit order"] |
Alpaca Trading MCP
Skill by ara.so — MCP Skills collection.
Alpaca MCP Server is an official Model Context Protocol server that enables natural language trading operations through AI assistants. It provides comprehensive access to Alpaca's Trading API for stocks, options, crypto, portfolio management, and real-time market data. Built with FastMCP and OpenAPI, this is a complete v2 rewrite with spec-aligned tooling.
What It Does
- Market Data Access: Real-time and historical quotes, trades, bars for stocks, crypto, and options
- Trading Operations: Place market, limit, stop, trailing-stop orders for any supported asset
- Options Trading: Search contracts, place single/multi-leg strategies, get Greeks and IV
- Portfolio Management: View account info, positions, buying power, portfolio history
- Watchlist Management: Create, update, and manage custom watchlists
- News & Corporate Actions: Access market news and corporate action announcements
Installation
Prerequisites
- Python 3.10+
- uv package manager:
curl -LsSf https://astral.sh/uv/install.sh | sh
- Alpaca API keys (free paper trading account at https://app.alpaca.markets)
- An MCP-compatible client (Claude Desktop, Cursor, VS Code, etc.)
Configuration
Add to your MCP client configuration file:
Claude Desktop (~/Library/Application Support/Claude/claude_desktop_config.json on Mac):
{
"mcpServers": {
"alpaca": {
"command": "uvx",
"args": ["alpaca-mcp-server"],
"env": {
"ALPACA_API_KEY": "your_alpaca_api_key",
"ALPACA_SECRET_KEY": "your_alpaca_secret_key",
"ALPACA_PAPER_TRADE": "true"
}
}
}
}
Cursor (~/.cursor/mcp.json):
{
"mcpServers": {
"alpaca": {
"command": "uvx",
"args": ["alpaca-mcp-server"],
"env": {
"ALPACA_API_KEY": "your_alpaca_api_key",
"ALPACA_SECRET_KEY": "your_alpaca_secret_key",
"ALPACA_PAPER_TRADE": "true"
}
}
}
}
VS Code (.vscode/mcp.json in project root):
{
"mcp": {
"servers": {
"alpaca": {
"type": "stdio",
"command": "uvx",
"args": ["alpaca-mcp-server"],
"env": {
"ALPACA_API_KEY": "your_alpaca_api_key",
"ALPACA_SECRET_KEY": "your_alpaca_secret_key",
"ALPACA_PAPER_TRADE": "true"
}
}
}
}
}
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 \
--env ALPACA_PAPER_TRADE=true
Environment Variables
| Variable | Required | Default | Description |
|---|
ALPACA_API_KEY | Yes | — | Your Alpaca API key |
ALPACA_SECRET_KEY | Yes | — | Your Alpaca secret key |
ALPACA_PAPER_TRADE | No | true | Set to false for live trading |
ALPACA_TOOLSETS | No | all | Comma-separated toolsets to enable |
Toolset Filtering
Restrict available tools by setting ALPACA_TOOLSETS:
{
"env": {
"ALPACA_TOOLSETS": "account,trading,stock-data"
}
}
Available toolsets:
account: Account info, portfolio history, activities
trading: Orders, positions, options exercise
watchlists: Watchlist CRUD operations
assets: Asset lookup, option contracts, market calendar
stock-data: Stock bars, quotes, trades, snapshots
crypto-data: Crypto bars, quotes, trades, orderbooks
options-data: Option bars, quotes, Greeks, chain
corporate-actions: Corporate action announcements
news: News articles
Core Trading Operations
Check Account Status
Place Stock Orders
Get Real-Time Market Data
Options Trading
Manage Positions
Watchlist Management
Advanced Market Data Queries
Screen Stocks
Get News
Corporate Actions
Portfolio Analysis
Get Portfolio History
Account Activities
Common Patterns
Multi-Symbol Quotes
Batch Order Placement
Conditional Order Logic
Options Strategies
Troubleshooting
Server Not Showing in MCP Client
- Restart your MCP client after editing config
- Check JSON syntax in your config file (trailing commas cause issues)
- Verify uv is installed:
uv --version
- Check logs in client's developer console/logs
Authentication Errors
Error: 401 Unauthorized
- Verify
ALPACA_API_KEY and ALPACA_SECRET_KEY are correct
- Ensure you're using paper trading keys if
ALPACA_PAPER_TRADE=true
- Check if keys have necessary permissions in Alpaca dashboard
Tool Not Found
Error: Tool 'old_tool_name' not found
- You may be using v1 tool names. V2 is a complete rewrite.
- Clear MCP client cache and restart
- Start a fresh chat session
- Check Available Tools for current tool names
Rate Limiting
Error: 429 Too Many Requests
- Alpaca API has rate limits (200 requests/minute for paper trading)
- Batch symbol queries when possible (comma-separated symbols)
- Add delays between rapid tool calls
- Upgrade to live account for higher limits
Order Rejected
Error: insufficient buying power / position limit exceeded
- Check account buying power:
get_account_info
- Verify position limits haven't been hit
- For options, ensure account has appropriate trading level
- Check if market is open:
get_clock
Market Data Gaps
Error: no data found for timeframe
- Market may be closed (check
get_clock)
- Symbol may not have data for requested timeframe
- Use
feed: "sip" for consolidated US market data
- Crypto trades 24/7, stocks only during market hours (9:30-16:00 ET)
V1 to V2 Migration
If upgrading from v1:
- Remove any .env files — v2 uses env vars in MCP config only
- Delete v1 tool references in custom instructions/rules
- Restart MCP client to clear tool cache
- Start fresh session so LLM discovers new tools
- Update toolset filtering using
ALPACA_TOOLSETS env var
Docker Issues
docker logs <container-id>
docker run --rm -e ALPACA_API_KEY=test mcp/alpaca:latest env | grep ALPACA
docker run --rm -i \
-e ALPACA_API_KEY=your_key \
-e ALPACA_SECRET_KEY=your_secret \
-e ALPACA_PAPER_TRADE=true \
mcp/alpaca:latest
Live Trading
To switch from paper to live trading:
{
"env": {
"ALPACA_API_KEY": "your_live_api_key",
"ALPACA_SECRET_KEY": "your_live_secret_key",
"ALPACA_PAPER_TRADE": "false"
}
}
⚠️ WARNING: Live trading uses real money. Test thoroughly in paper trading first. Markets are volatile and losses can exceed expectations.
Additional Resources
License
MIT License - Alpaca Markets