Skip to main content
Glama
Alpaca Trading MCP Server

Alpaca Trading MCP Server

by laukikk

アルパカトレーディングMCPサーバー

Alpaca 取引 API へのインターフェイスを提供するモデル コンテキスト プロトコル (MCP) サーバー。これにより、株式および暗号通貨ポートフォリオの管理、取引の実行、市場データへのアクセスが可能になります。

特徴

  • アカウント管理: アカウントの詳細、残高、ポートフォリオのステータスを表示します

  • 取引:成行注文、指値注文、逆指値注文、ストップリミット注文を出す

  • ポートフォリオ管理: ポジションの表示、パフォーマンスの計算、ポジションのクローズ

  • 市場データ: リアルタイムの相場情報と過去の価格データにアクセス

  • 資産情報: 取引可能な資産の詳細を取得します

Related MCP server: Alpaca MCP Server

インストール

  1. このリポジトリをクローンする

  2. 依存関係をインストールします:

pip install -e .

またはuvを使用します:

uv pip install -e .

構成

  1. .env.exampleファイルを.envにコピーします。

cp .env.example .env
  1. Alpaca Paper Trading API の資格情報を.envファイルに追加します。

ALPACA_PAPER_API_KEY = "your-api-key"
ALPACA_PAPER_API_SECRET = "your-api-secret"

Alpacaでアカウントを作成すると、これらの資格情報を取得できます。

使用法

MCP サーバーを実行します。

python src/server.py

サーバーが起動し、MCP クライアントが接続できるようになります。

利用可能なリソース

サーバーは次のリソースを提供します。

  • account://info - 現在のアカウント情報を取得する

  • positions://all - 現在のポジションをすべて取得する

  • positions://{symbol} - 特定のシンボルのポジション詳細を取得します

  • orders://recent/{limit} - 指定された制限内で最新の注文を取得します

  • market://{symbol}/quote - 特定のシンボルの現在の市場相場を取得します

  • market://{symbol}/bars/{timeframe} - 指定した時間枠のシンボルの過去の価格バーを取得します。

  • assets://list - Alpaca で取引可能な資産をリストします

  • assets://{symbol} - シンボルで詳細な資産情報を取得します

利用可能なツール

サーバーは次のツールを提供します。

  • get_account_info_tool - 現在のアカウント情報を取得する

  • place_market_order - 株式の売買の成行注文を出す

  • place_limit_order - 指定した価格で株式を売買するための指値注文を出す

  • place_stop_order - 指定された価格に達したときに株を買ったり売ったりするストップ注文を出す

  • place_stop_limit_order - ストップ注文とリミット注文の機能を組み合わせたストップリミット注文を出す

  • cancel_order - ID でオープン注文をキャンセルする

  • close_position - 特定のシンボルのオープンポジションをクローズする

  • get_portfolio_summary - ポートフォリオの包括的な概要を取得します

Available Tools

8 tools
cancel_orderB

Cancel an open order by its ID.

Args: order_id: ID of the order to cancel

Returns: Confirmation of cancellation

Inputs: order_id (required).

close_positionC

Close an open position for a specific symbol.

Args: symbol: Stock symbol to close position for

Returns: Confirmation of position closure

Inputs: symbol (required).

get_account_info_toolB

Get current account information.

Returns: Account summary with balance and status

Inputs: no named parameters.

get_portfolio_summaryB

Get a comprehensive summary of the portfolio including account details and open positions.

Returns: Portfolio summary with account and positions information

Inputs: no named parameters.

place_limit_orderB

Place a limit order to buy or sell a stock at a specified price.

Args: symbol: Stock symbol (e.g., 'AAPL') quantity: Number of shares to buy or sell (can be fractional) side: Either 'buy' or 'sell' limit_price: Maximum price for buy or minimum price for sell time_in_force: Order duration - 'day', 'gtc' (good till canceled), 'ioc' (immediate or cancel)

Returns: Order confirmation details

Inputs: symbol (required), quantity (required), side (required), limit_price (required), +1 more.

place_market_orderB

Place a market order to buy or sell a stock.

Args: symbol: Stock symbol (e.g., 'AAPL') quantity: Number of shares to buy or sell (can be fractional) side: Either 'buy' or 'sell'

Returns: Order confirmation details

Inputs: symbol (required), quantity (required), side (required).

place_stop_limit_orderA

Place a stop-limit order combining stop and limit order features.

Args: symbol: Stock symbol (e.g., 'AAPL') quantity: Number of shares to buy or sell (can be fractional) side: Either 'buy' or 'sell' stop_price: Price that triggers the order limit_price: Maximum/minimum price for the triggered order time_in_force: Order duration - 'day', 'gtc' (good till canceled)

Returns: Order confirmation details

Inputs: symbol (required), quantity (required), side (required), stop_price (required), +2 more.

place_stop_orderA

Place a stop order to buy or sell a stock when it reaches a specified price.

Args: symbol: Stock symbol (e.g., 'AAPL') quantity: Number of shares to buy or sell (can be fractional) side: Either 'buy' or 'sell' stop_price: Price that triggers the order time_in_force: Order duration - 'day', 'gtc' (good till canceled)

Returns: Order confirmation details

Inputs: symbol (required), quantity (required), side (required), stop_price (required), +1 more.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A3.5/5.0

    Scored across 8 tools

    Disambiguation5/5

    Each tool has a clearly distinct purpose with no ambiguity. Order placement tools (market, limit, stop, stop-limit) are well-differentiated by order type, while account/portfolio tools and order/position management tools serve separate functions. An agent can easily distinguish between them based on their specific actions.

    Naming Consistency4/5

    Most tools follow a consistent verb_noun pattern (e.g., cancel_order, close_position, place_market_order). However, get_account_info_tool deviates slightly with the '_tool' suffix, breaking perfect consistency. The naming is otherwise predictable and readable across the set.

    Tool Count5/5

    With 8 tools, this server is well-scoped for trading operations. It covers essential functions like order placement (4 tools), order cancellation, position management, and account/portfolio queries. Each tool earns its place without being overly sparse or bloated for the domain.

    Completeness4/5

    The toolset provides strong coverage for core trading workflows: placing various order types, managing orders and positions, and viewing account/portfolio data. A minor gap exists in the lack of tools for modifying existing orders or retrieving specific order details, but agents can work around this with the available tools.

    Maintenance

    ActivityInactive
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      D
      maintenance
      A Model Context Protocol server enabling LLMs like Claude to interact with the Alpaca trading API through natural language for stock trading, checking positions, fetching market data, and managing your account.
      28
      MIT
    • A
      license
      Not graded
      quality
      D
      maintenance
      A Model Context Protocol server that enables LLMs like Claude to interact with the Alpaca trading API, allowing for trading stocks, checking positions, fetching market data, and managing accounts through natural language.
      3
      MIT
    • A
      license
      Not graded
      quality
      D
      maintenance
      An MCP server implementation for Alpaca's Trading API that enables LLMs to interact with Alpaca's trading infrastructure using natural language, supporting stock, options, and crypto trading, portfolio management, watchlists, and market data.
      4
      MIT
    • A
      license
      Not graded
      quality
      D
      maintenance
      A Model Context Protocol (MCP) server that provides financial trading tools and market analysis capabilities, enabling AI assistants to access real-time market data, execute trades, analyze portfolios, and perform comprehensive financial analysis.
      MIT