- Home
- MCP servers
- Alpaca
Alpaca
- python
0
GitHub Stars
python
Language
7 months ago
First Indexed
3 months ago
Catalog Refreshed
Documentation & install
Readme and setup notes from the catalogue, plus a client-ready config you can copy for your MCP host.
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.
How to use
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.
How to install
Prerequisites: Python 3.10 or newer, and uv available on your system.
One-click local setup with uvx (recommended):
uvx alpaca-mcp-server init
If 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"
}
}
}
}
Additional setup for remote HTTP transport
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 http
Or bind to a specific host and port for remote usage:
alpaca-mcp-server serve --transport http --host 0.0.0.0 --port 9000
Client 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"
}
}
}
}
Available tools
get_account_info
View balance, buying power, and account status.
get_positions
List all held assets.
get_open_position
Detailed info on a specific position.
close_position
Close part or all of a position.
close_all_positions
Liquidate entire portfolio.
get_stock_quote
Real-time bid/ask quote for stocks.
get_stock_bars
Historical OHLCV bars with flexible timeframes.
get_stock_latest_trade
Latest market trade price.
get_stock_latest_bar
Most recent OHLC bar.
get_stock_snapshot
Comprehensive snapshot with quote, trade, and bars.
get_stock_trades
Trade-level history for stocks.
get_orders
Retrieve all or filtered orders.
place_stock_order
Place stock orders of various types.
cancel_order_by_id
Cancel a specific order.
cancel_all_orders
Cancel all open orders.
place_crypto_order
Place crypto orders with multiple time-in-force options.
get_option_contracts
Get option contracts with flexible filtering.
get_option_latest_quote
Latest quote for an option contract.
get_option_snapshot
Get Greeks and underlying for an option.
place_option_market_order
Execute option strategies.
exercise_options_position
Exercise a held option to convert to underlying.
get_market_clock
Market open/close schedule.
get_market_calendar
Holidays and trading days.
get_corporate_announcements
Historical and future corporate actions.
create_watchlist
Create a new watchlist.
update_watchlist
Modify an existing watchlist.
get_watchlists
Retrieve all saved watchlists.
get_asset_info
Search asset metadata.
get_all_assets
List all tradable instruments with filters.