Alpaca MCP Server
Server Configuration
Describes the environment variables required to run the server.
| Name | Required | Description | Default |
|---|---|---|---|
| ALPACA_API_KEY | Yes | Your Alpaca API key | |
| ALPACA_TOOLSETS | No | Comma-separated list of toolsets to enable (default: all) | all |
| ALPACA_SECRET_KEY | Yes | Your Alpaca secret key | |
| ALPACA_PAPER_TRADE | No | Set to 'false' for live trading (default is 'true') | true |
Capabilities
Features and capabilities supported by this server
| Capability | Details |
|---|---|
| tools | {
"listChanged": true
} |
| prompts | {
"listChanged": false
} |
| resources | {
"subscribe": false,
"listChanged": false
} |
| extensions | {
"io.modelcontextprotocol/ui": {}
} |
| experimental | {} |
Tools
Functions exposed to the LLM to take actions
| Name | Description |
|---|---|
| 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 pre-market, after-hours, and
overnight sessions. Only works with type="limit"
and time_in_force="day" or "gtc".
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.
advanced_instructions: Alpaca Elite Smart Router routing/algo
payload. Stocks-only (the Elite docs explicitly note options
and crypto reject the payload). Requires the account to be
on Elite Smart Router routing; non-Elite accounts will see
the field ignored or rejected by Alpaca's API. Shapes:
DMA Gateway (direct routing):
{"algorithm": "DMA",
"destination": "NYSE"|"NASDAQ"|"ARCA",
"display_qty": "<round lot, optional>"}
Only with type="limit"|"market" and time_in_force="day";
not compatible with opg/cls/gtc or stop orders.
VWAP (Volume-Weighted Average Price):
{"algorithm": "VWAP",
"start_time": "<RFC3339, optional>",
"end_time": "<RFC3339, optional>",
"max_percentage": "<0<x<1, optional>"}
Does NOT participate in open/close auctions.
TWAP (Time-Weighted Average Price):
{"algorithm": "TWAP",
"start_time": "<RFC3339, optional>",
"end_time": "<RFC3339, optional>",
"max_percentage": "<0<x<1, optional>"}
Does NOT participate in open/close auctions.
NOTE: PATCH /v2/orders/{id} already documents
|
| 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_locatesB | Returns locate requests for the account, filtered by status, symbol, or date range. Results are sorted by creation date descending. |
| create_locateA | Creates a locate request for a short sale. Requires a symbol and quantity. Optionally set a limit price and all-or-none flag. |
| get_locateB | Returns a single locate request by its ID. |
| get_locate_quotesA | Returns locate availability and pricing for one or more symbols. Provide a comma-separated list of symbols. |
| get_account_infoA | Retrieves and formats the current account information including balances and status. |
| get_account_activitiesC | 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_account_configA | Retrieves the current account configuration settings, including trading restrictions, margin settings, PDT checks, and options trading level. |
| update_account_configA | Updates one or more account configuration settings. Only the fields you provide will be changed; all others retain their current values. |
| get_portfolio_historyC | Retrieves account portfolio history (equity and P/L) over a requested time window. |
| 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_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_clockA | Retrieves and formats current market status and next open/close times. |
| 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_action_announcementA | Retrieves a single corporate action announcement by ID. |
| get_option_contractsC | Retrieves option contracts for underlying symbol(s). |
| get_option_contractA | Retrieves a single option contract by symbol or contract ID. |
| get_ordersC | Retrieves and formats orders with the specified filters. |
| cancel_all_ordersA | Cancel all open orders. |
| get_order_by_idA | Retrieves a single order by its ID. |
| cancel_order_by_idA | 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_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_all_positionsA | 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_positionB | 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. |
| do_not_exercise_options_positionB | Submits a do-not-exercise instruction for a held option contract. |
| exercise_options_positionA | Exercises a held option contract, converting it into the underlying asset. |
| get_watchlistsA | Get all watchlists for the account. |
| create_watchlistB | Creates a new watchlist with specified symbols. |
| get_watchlist_by_idA | 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_idA | Add an asset by symbol to a specific watchlist. |
| delete_watchlist_by_idA | Delete a specific watchlist by its ID. |
| remove_asset_from_watchlist_by_idA | Remove an asset by symbol from a specific watchlist. |
| get_fixed_income_latest_quotesA | Returns the latest quotes for fixed income securities (bonds, treasuries). Provide a comma-separated list of ISINs (e.g. 'US912797SX61,US912810SK51'). Returns bid/ask prices, sizes, and yield-to-maturity for each security. |
| get_index_latest_valuesB | Returns the latest values for market indices (e.g. SPX, VIX, DJI). Provide a comma-separated list of index symbols. |
| get_index_valuesA | Returns historical values for market indices over a time interval. Supports pagination, sorting, and date range filtering. Provide a comma-separated list of index symbols. |
| get_newsA | Retrieves news articles for stocks and crypto. Filter by symbols, date range, and sort order. Returns headlines, summaries, URLs, and associated ticker symbols. |
| 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_tradesA | 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_market_moversA | Returns the top market movers (gainers and losers) based on real-time SIP data. |
| get_most_active_stocksB | Screens the market for most active stocks by volume or trade count. |
| 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_tradeA | 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_corporate_actionsB | Retrieves and formats corporate action announcements. |
| get_stock_latest_barB | Get the latest minute bar for one or more stocks. |
| get_stock_latest_quoteC | Retrieves and formats the latest quote for one or more stocks. |
| get_stock_snapshotA | 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
| Name | Description |
|---|---|
No prompts | |
Resources
Contextual data attached and managed by the client
| Name | Description |
|---|---|
No resources | |
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
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/bartest5/alpacahq_alpaca-mcp-server'
If you have feedback or need assistance with the MCP directory API, please join our Discord server