home / mcp / alpaca mcp server
Provides real-time market data, order placement, and portfolio actions via MCP between AI assistants and Alpaca trading.
Configuration
View docs{
"mcpServers": {
"cliffsgpt-alpaca-mcp-clone": {
"url": "http://your-server-ip:8000/mcp",
"headers": {
"ALPACA_API_KEY": "your_alpaca_api_key",
"ALPACA_SECRET_KEY": "your_alpaca_secret_key",
"ALPACA_PAPER_TRADE": "True"
}
}
}
}You can run a dedicated MCP server to connect Alpacaβs trading capabilities with AI assistants. This server enables real-time market data access, order placement, and portfolio management through MCP-enabled clients like Claude Desktop, Cursor, and VS Code. It supports stocks, options, crypto, and comprehensive trading workflows, while letting you operate from local or remote setups.
Connect Alpaca MCP Server to your MCP client (for example Claude Desktop, Cursor, or VS Code). Start the local server for interactive use, or run a remote HTTP transport for access from another machine. Your MCP client will send natural language trading requests, and the server translates them into Alpaca API calls once you provide your API credentials. Make sure you configure your client with the proper API keys and trading mode (paper or live). You can place trades, query balances, inspect positions, fetch market data, and manage watchlists through natural language prompts.
Prerequisites: Python 3.10 or newer, and uv available on your system.
One-click local setup with uvx (recommended):
uvx alpaca-mcp-server initIf you donβt have uv yet, install it first and restart your terminal so uv/uvx are recognized.
Configure the MCP client with your Alpaca API keys in the clientβs environment block (examples shown for JSON config).
Example minimal local config for the MCP server (stdio mode) to run with uvx and environment keys for Alpaca credentials:
{
"mcpServers": {
"alpaca": {
"command": "uvx",
"args": ["alpaca-mcp-server", "serve"],
"env": {
"ALPACA_API_KEY": "your_alpaca_api_key",
"ALPACA_SECRET_KEY": "your_alpaca_secret_key"
}
}
}
}To access the MCP server from another machine, run the server with HTTP transport and configure the client with the HTTP URL.
Start the server for remote access (default host and port):
alpaca-mcp-server serve --transport httpOr bind to a specific host and port for remote usage:
alpaca-mcp-server serve --transport http --host 0.0.0.0 --port 9000Client configuration example (Claude Desktop / Cursor) using HTTP transport:
{
"mcpServers": {
"alpaca": {
"type": "http",
"url": "http://your-server-ip:8000/mcp",
"env": {
"ALPACA_API_KEY": "your_alpaca_api_key",
"ALPACA_SECRET_KEY": "your_alpaca_secret_key"
}
}
}
}View balance, buying power, and account status.
List all held assets.
Detailed info on a specific position.
Close part or all of a position.
Liquidate entire portfolio.
Real-time bid/ask quote for stocks.
Historical OHLCV bars with flexible timeframes.
Latest market trade price.
Most recent OHLC bar.
Comprehensive snapshot with quote, trade, and bars.
Trade-level history for stocks.
Retrieve all or filtered orders.
Place stock orders of various types.
Cancel a specific order.
Cancel all open orders.
Place crypto orders with multiple time-in-force options.
Get option contracts with flexible filtering.
Latest quote for an option contract.
Get Greeks and underlying for an option.
Execute option strategies.
Exercise a held option to convert to underlying.
Market open/close schedule.
Holidays and trading days.
Historical and future corporate actions.
Create a new watchlist.
Modify an existing watchlist.
Retrieve all saved watchlists.
Search asset metadata.
List all tradable instruments with filters.