Skip to main content
Glama
alpacahq

alpaca-mcp-server

Official
by alpacahq

Server Configuration

Describes the environment variables required to run the server.

NameRequiredDescriptionDefault
PAPERNoSet to False to enable live trading with real funds (default is True for paper trading)True
ALPACA_API_KEYYesYour Alpaca API key for paper or live account
ALPACA_SECRET_KEYYesYour Alpaca secret key for paper or live account

Capabilities

Features and capabilities supported by this server

CapabilityDetails
tools
{
  "listChanged": true
}
prompts
{
  "listChanged": false
}
resources
{
  "subscribe": false,
  "listChanged": false
}
experimental
{}

Tools

Functions exposed to the LLM to take actions

NameDescription
place_stock_orderA

Place a stock or ETF order.

Args: symbol: Stock ticker (e.g., "AAPL", "SPY"). side: "buy" or "sell". qty: Number of shares. Mutually exclusive with notional. notional: Dollar amount to trade. Mutually exclusive with qty. Only valid for market orders with time_in_force="day". type: Order type — "market", "limit", "stop", "stop_limit", "trailing_stop". time_in_force: "day", "gtc", "opg", "cls", "ioc", or "fok". limit_price: Required for limit and stop_limit orders. stop_price: Required for stop and stop_limit orders. trail_price: Dollar trail amount for trailing_stop orders. trail_percent: Percent trail for trailing_stop orders. extended_hours: Allow execution in extended hours. Only works with type="limit" and time_in_force="day". client_order_id: Unique idempotency key. If the request times out, you can safely retry with the same value — the API will reject duplicates. Recommended for every order. order_class: "simple", "bracket", "oco", or "oto". Automatically set to "bracket" when take_profit or stop_loss params are provided. take_profit_limit_price: Limit price for bracket take-profit leg. stop_loss_stop_price: Stop price for bracket stop-loss leg. stop_loss_limit_price: Limit price for bracket stop-loss leg.

place_crypto_orderA

Place a cryptocurrency order.

Args: symbol: Crypto pair (e.g., "BTC/USD", "ETH/USD"). side: "buy" or "sell". qty: Number of coins/tokens. Mutually exclusive with notional. notional: Dollar amount to trade. Mutually exclusive with qty. Only valid for market orders. type: "market", "limit", or "stop_limit". time_in_force: "gtc" (default) or "ioc". Crypto does not support "day" or "fok". limit_price: Required for limit and stop_limit orders. stop_price: Required for stop_limit orders. client_order_id: Unique idempotency key. If the request times out, you can safely retry with the same value — the API will reject duplicates. Recommended for every order.

place_option_orderA

Place an options order (single-leg or multi-leg).

For single-leg orders, provide symbol, side, and qty. For multi-leg orders, provide qty, legs, and optionally order_class="mleg" (auto-inferred). Symbol and side on the parent are not needed for multi-leg.

Args: qty: Number of contracts. Required for both single-leg and multi-leg orders. For multi-leg, this is the strategy multiplier — each leg's ratio_qty is scaled by this value (e.g., qty="10" with ratio_qty="2" = 20 contracts for that leg). type: "market" or "limit". time_in_force: "day" only. Options do not support other values. symbol: OCC option symbol (e.g., "AAPL250321C00150000"). Required for single-leg. side: "buy" or "sell". Required for single-leg. position_intent: "buy_to_open", "buy_to_close", "sell_to_open", or "sell_to_close". Clarifies whether the trade opens or closes a position. Optional but recommended. limit_price: Required for limit orders. For multi-leg, this is the net debit/credit (positive = debit/cost, negative = credit/proceeds). client_order_id: Unique idempotency key. If the request times out, you can safely retry with the same value — the API will reject duplicates. Recommended for every order. order_class: Set to "mleg" for multi-leg orders. Automatically inferred when legs are provided. legs: List of leg dicts for multi-leg orders (max 4). Each leg requires "symbol" and "ratio_qty" (string). Optional per-leg fields: "side" ("buy" or "sell") and "position_intent".

get_stock_barsA

Retrieve historical price bars (OHLCV) for one or more stocks.

When start is omitted, it is automatically computed as now minus the days/hours/minutes lookback.

Args: symbols: Comma-separated tickers (e.g. "AAPL" or "AAPL,MSFT,GOOG"). timeframe: Bar aggregation period — "1Min", "5Min", "15Min", "30Min", "1Hour", "1Day", "1Week", or "1Month". start: Inclusive start time (RFC 3339). Omit to use relative lookback. end: Inclusive end time (RFC 3339). Omit for current time. days: Days to look back when start is omitted (default 5). hours: Additional hours in the lookback (default 0). minutes: Additional minutes in the lookback (default 0). limit: Max total data points returned across all symbols, 1–10000 (default 1000). adjustment: Price adjustment — "raw", "split", "dividend", "spin-off", or "all". Comma-separated combos allowed (e.g. "split,dividend"). Default "raw". feed: Data feed — "sip" (all US exchanges, default, paid), "iex" (IEX only, free tier), "otc", or "boats". currency: Price currency (ISO 4217, e.g. "USD"). Default USD. sort: Timestamp sort order — "asc" (default) or "desc". asof: As-of date (YYYY-MM-DD) for point-in-time symbol mapping. Useful for backtesting with historical ticker changes.

get_stock_quotesA

Retrieve historical bid/ask quotes (level 1) for one or more stocks.

When start is omitted, it is automatically computed as now minus the days/hours/minutes lookback.

Args: symbols: Comma-separated tickers (e.g. "AAPL" or "AAPL,MSFT"). start: Inclusive start time (RFC 3339). Omit to use relative lookback. end: Inclusive end time (RFC 3339). Omit for current time. days: Days to look back when start is omitted (default 0). hours: Additional hours in the lookback (default 0). minutes: Additional minutes in the lookback (default 20). limit: Max total data points returned across all symbols, 1–10000 (default 1000). feed: Data feed — "sip" (all US exchanges, default, paid), "iex" (free tier), "otc", or "boats". Paper/free accounts must set feed="iex" to avoid 403 errors. currency: Price currency (ISO 4217). Default USD. sort: Timestamp sort order — "asc" (default) or "desc". asof: As-of date (YYYY-MM-DD) for point-in-time symbol mapping.

get_stock_tradesA

Retrieve historical trade data for one or more stocks.

When start is omitted, it is automatically computed as now minus the days/hours/minutes lookback.

Args: symbols: Comma-separated tickers (e.g. "AAPL" or "AAPL,MSFT"). start: Inclusive start time (RFC 3339). Omit to use relative lookback. end: Inclusive end time (RFC 3339). Omit for current time. days: Days to look back when start is omitted (default 0). hours: Additional hours in the lookback (default 0). minutes: Additional minutes in the lookback (default 20). limit: Max total data points returned across all symbols, 1–10000 (default 1000). feed: Data feed — "sip" (all US exchanges, default, paid), "iex" (free tier), "otc", or "boats". Paper/free accounts must set feed="iex" to avoid 403 errors. currency: Price currency (ISO 4217). Default USD. sort: Timestamp sort order — "asc" (default) or "desc". asof: As-of date (YYYY-MM-DD) for point-in-time symbol mapping.

get_crypto_barsA

Retrieve historical price bars (OHLCV) for one or more cryptocurrencies.

When start is omitted, it is automatically computed as now minus the days/hours/minutes lookback.

Args: symbols: Comma-separated crypto pairs (e.g. "BTC/USD" or "BTC/USD,ETH/USD"). timeframe: Bar aggregation period — "1Min", "5Min", "15Min", "30Min", "1Hour", "1Day", "1Week", or "1Month". start: Inclusive start time (RFC 3339). Omit to use relative lookback. end: Inclusive end time (RFC 3339). Omit for current time. days: Days to look back when start is omitted (default 1). hours: Additional hours in the lookback (default 0). minutes: Additional minutes in the lookback (default 0). limit: Max total data points returned across all symbols, 1–10000 (default 1000). sort: Timestamp sort order — "asc" (default) or "desc".

get_crypto_quotesA

Retrieve historical bid/ask quotes for one or more cryptocurrencies.

When start is omitted, it is automatically computed as now minus the days/hours/minutes lookback.

Args: symbols: Comma-separated crypto pairs (e.g. "BTC/USD" or "BTC/USD,ETH/USD"). start: Inclusive start time (RFC 3339). Omit to use relative lookback. end: Inclusive end time (RFC 3339). Omit for current time. days: Days to look back when start is omitted (default 0). hours: Additional hours in the lookback (default 0). minutes: Additional minutes in the lookback (default 15). limit: Max total data points returned across all symbols, 1–10000 (default 1000). sort: Timestamp sort order — "asc" (default) or "desc".

get_crypto_tradesA

Retrieve historical trade data for one or more cryptocurrencies.

When start is omitted, it is automatically computed as now minus the days/hours/minutes lookback.

Args: symbols: Comma-separated crypto pairs (e.g. "BTC/USD" or "BTC/USD,ETH/USD"). start: Inclusive start time (RFC 3339). Omit to use relative lookback. end: Inclusive end time (RFC 3339). Omit for current time. days: Days to look back when start is omitted (default 0). hours: Additional hours in the lookback (default 0). minutes: Additional minutes in the lookback (default 15). limit: Max total data points returned across all symbols, 1–10000 (default 1000). sort: Timestamp sort order — "asc" (default) or "desc".

get_account_infoB

Retrieves and formats the current account information including balances and status.

get_ordersC

Retrieves and formats orders with the specified filters.

cancel_all_ordersB

Cancel all open orders.

get_order_by_client_idA

Retrieves a single order specified by the client order ID. Note: if the order was replaced, this returns the original order (status "replaced") with a replaced_by field pointing to the new order ID.

get_order_by_idB

Retrieves a single order by its ID.

cancel_order_by_idC

Cancel a specific order by its ID.

replace_order_by_idB

Replaces an existing open order with updated parameters. At least one optional field must be provided.

get_all_positionsB

Retrieves all current positions in the portfolio as JSON.

close_all_positionsA

Closes all open positions by placing sell orders for each. If the market is closed, the sell orders will remain queued and execute at the next market open.

get_open_positionC

Retrieves and formats details for a specific open position.

close_positionA

Closes a specific position for a single symbol by placing a sell order. If the market is closed, the sell order will remain queued and execute at the next market open.

exercise_options_positionC

Exercises a held option contract, converting it into the underlying asset.

do_not_exercise_options_positionC

Submits a do-not-exercise instruction for a held option contract.

get_portfolio_historyB

Retrieves account portfolio history (equity and P/L) over a requested time window.

get_watchlistsB

Get all watchlists for the account.

create_watchlistB

Creates a new watchlist with specified symbols.

get_watchlist_by_idB

Get a specific watchlist by its ID.

update_watchlist_by_idA

Update an existing watchlist. IMPORTANT: this replaces the entire watchlist. You must include the symbols parameter with the full list of desired symbols, otherwise all assets will be removed.

add_asset_to_watchlist_by_idB

Add an asset by symbol to a specific watchlist.

delete_watchlist_by_idC

Delete a specific watchlist by its ID.

remove_asset_from_watchlist_by_idB

Remove an asset by symbol from a specific watchlist.

get_account_configA

Retrieves the current account configuration settings, including trading restrictions, margin settings, PDT checks, and options trading level.

update_account_configB

Updates one or more account configuration settings. Only the fields you provide will be changed; all others retain their current values.

get_account_activitiesB

Returns a list of account activities such as fills, dividends, and transfers.

get_account_activities_by_typeB

Returns account activity entries for a specific type of activity.

get_calendarA

Retrieves and formats market calendar for specified date range. WARNING: Always provide start and end dates (YYYY-MM-DD). Without date bounds the response contains the entire multi-year calendar and will be extremely large.

get_clockB

Retrieves and formats current market status and next open/close times.

get_all_assetsA

Get all available assets with optional filtering. WARNING: The unfiltered response is very large (thousands of assets). Always narrow results with the status, asset_class, or exchange parameters. To look up a single asset, use get_asset instead.

get_assetB

Retrieves and formats detailed information about a specific asset.

get_option_contractsB

Retrieves option contracts for underlying symbol(s).

get_option_contractB

Retrieves a single option contract by symbol or contract ID.

get_corporate_action_announcementB

Retrieves a single corporate action announcement by ID.

get_corporate_action_announcementsA

Retrieves corporate action announcements (dividends, mergers, splits, spinoffs). Use a narrow date range and filter by symbol when possible — broad queries can return very large responses.

get_corporate_actionsB

Retrieves and formats corporate action announcements.

get_option_barsB

Retrieves historical bar (OHLCV) data for one or more option contracts.

get_option_exchange_codesA

Retrieves the mapping of exchange codes to exchange names for option market data. Useful for interpreting exchange fields returned by other option data tools.

get_option_latest_quoteA

Retrieves and formats the latest quote for one or more option contracts including bid/ask prices, sizes, and exchange information.

get_option_snapshotA

Retrieves comprehensive snapshots of option contracts including latest trade, quote, implied volatility, and Greeks.

get_option_chainA

Retrieves option chain data for an underlying symbol, including latest trade, quote, implied volatility, and greeks for each contract. The response can be very large. Use the type (call/put), strike_price_gte/lte, expiration_date, and limit parameters to narrow results.

get_option_tradesB

Retrieves historical trade data for one or more option contracts.

get_option_latest_tradeB

Retrieves the latest trade for one or more option contracts.

get_most_active_stocksB

Screens the market for most active stocks by volume or trade count.

get_market_moversB

Returns the top market movers (gainers and losers) based on real-time SIP data.

get_crypto_latest_barA

Returns the latest minute bar for one or more crypto symbols. The loc parameter is required — always set loc to "us".

get_crypto_latest_orderbookA

Returns the latest orderbook for one or more crypto symbols. The loc parameter is required — always set loc to "us". Note: the response includes the full order book depth and can be large.

get_crypto_latest_quoteB

Returns the latest quote for one or more crypto symbols. The loc parameter is required — always set loc to "us".

get_crypto_latest_tradeB

Returns the latest trade for one or more crypto symbols. The loc parameter is required — always set loc to "us".

get_crypto_snapshotA

Returns a snapshot for one or more crypto symbols including latest trade, quote, minute bar, daily bar, and previous daily bar. The loc parameter is required — always set loc to "us".

get_stock_latest_barB

Get the latest minute bar for one or more stocks.

get_stock_latest_quoteB

Retrieves and formats the latest quote for one or more stocks.

get_stock_snapshotB

Retrieves comprehensive snapshots of stock symbols including latest trade, quote, minute bar, daily bar, and previous daily bar.

get_stock_latest_tradeB

Get the latest trade for one or more stocks.

Prompts

Interactive templates invoked by user choice

NameDescription

No prompts

Resources

Contextual data attached and managed by the client

NameDescription

No resources

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/alpacahq/alpaca-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server