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. 종속성 설치:

지엑스피1

또는 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