TA

tedlikeskix/alpaca-mcp-server

Developer tools

이 페이지는 AI로 자동 번역되었습니다. 기술적인 세부 사항은 원문을 확인하세요. 원문 보기

28 stars 21 forks 품질 66 트렌드 0MIT

Alpaca 무역 API를 위한 모형 Context 의정서 (MCP) 서버

개요

이것은 Alpaca의 모델 Context Protocol (MCP) 서버이며, Alpaca 거래 API와 상호 작용하기 위해 Claude와 같은 LLM을 허용합니다. 그것은 거래 주식을 가능하게, 포지션을 확인, 시장 데이터를 fetching, 귀하의 계정 관리 - 모든 자연 언어를 통해. - - 실시간 증권 시세 표시 및 과거 가격 데이터 받기 - 당신의 잔액을 확인, 힘 구매, 상태 - 📈 - 현재 위치와 성능보기 - - 시장 및 제한 주문 - natural - 목록, 트랙 및 취소 주문 - Python 3.10+ - Alpaca API 키 - 데스크탑 또는 다른 MCP 클라이언트용 Claude 3. Alpaca API 자격 증명을 가진 .env 파일을 만드십시오: 1. 바탕 화면 2. 설정 3. "개발자"를 클릭하고 "Edit Config" 4. claude desktop config에 서버 구성을 추가합니다.

개요(AI 번역)

이것은 Alpaca의 모델 Context Protocol (MCP) 서버이며, Alpaca 거래 API와 상호 작용하기 위해 Claude와 같은 LLM을 허용합니다. 그것은 거래 주식을 가능하게, 포지션을 확인, 시장 데이터를 fetching, 귀하의 계정 관리 - 모든 자연 언어를 통해.

특징

  • Market Data - 실시간 재고 견적 및 과거 가격 데이터 받기
  • SOFT Account Information - 잔액, 구매력, 상태 확인
  • 📈Position Management - 현재 위치와 성능 보기
  • ** 주문 배치 ** - 자연 언어를 통해 시장 및 제한 주문
  • **주문 관리 ** - 목록, 트랙 및 취소 주문

필수품

  • 파이썬 3.10+
  • Alpaca API 키
  • 데스크탑 또는 다른 MCP 클라이언트용 Claude

설치

  1. Clone 이 저장소:

  2. 필요한 패키지를 설치:

  3. Alpaca API 자격 증명을 가진 [T0]] 파일을 만드십시오:

사용법

서버 실행

실행하여 서버 시작:

데스크탑용 Claude 구성

  1. 데스크탑을 위한 열려있는 Claude

  2. 설정으로 이동

  3. "개발자"를 클릭하고 “Edit Config”

  4. 서버 구성 추가 claude_desktop_config.json:

  5. 데스크탑을 위한 득점방해 및 재시작

사용 가능한 도구

이 페이지는 AI로 자동 번역되었습니다. 기술적인 세부 사항은 원문을 확인하세요.

README

원문 README의 일부입니다. 원문 보기.

Alpaca MCP Server

This is a Model Context Protocol (MCP) server for Alpaca, allowing LLMs like Claude to interact with the Alpaca trading API. It enables trading stocks, checking positions, fetching market data, and managing your account - all through natural language.

Features

  • 📊 Market Data - Get real-time stock quotes and historical price data
  • 💵 Account Information - Check your balances, buying power, and status
  • 📈 Position Management - View current positions and their performance
  • 🛒 Order Placement - Place market and limit orders through natural language
  • 📋 Order Management - List, track, and cancel orders

Prerequisites

  • Python 3.10+
  • Alpaca API keys
  • Claude for Desktop or another MCP client

Installation

  1. Clone this repository:

    git clone https://github.com/YOUR_USERNAME/alpaca-mcp.git
    cd alpaca-mcp
    
  2. Install the required packages:

    pip install mcp alpaca-py python-dotenv
    
  3. Create a .env file with your Alpaca API credentials:

    API_KEY_ID=your_alpaca_api_key
    API_SECRET_KEY=your_alpaca_secret_key
    

Usage

Running the server

Start the server by running:

python alpaca_mcp_server.py

Configuring Claude for Desktop

  1. Open Claude for Desktop
  2. Go to Settings
  3. Click on “Developer” and then “Edit Config”
  4. Add the server configuration to claude_desktop_config.json:
{
  "mcpServers": {
    "alpaca": {
      "command": "python",
      "args": [
        "/path/to/alpaca_mcp_server.py"
      ],
      "env": {
        "API_KEY_ID": "your_alpaca_api_key",
        "API_SECRET_KEY": "your_alpaca_secret_key"
      }
    }
  }
}
  1. Save and restart Claude for Desktop

Available Tools

The server exposes the following tools:

  • get_account_info() - Get account balances and status
  • get_positions() - List all current positions in the portfolio
  • get_stock_quote(symbol) - Get the latest quote for a stock
  • get_stock_bars(symbol, days) - Get historical price bars for a stock
  • get_orders(status, limit) - List orders with specified status
  • place_market_order(symbol, side, quantity) - Place a market order
  • place_limit_order(symbol, side, quantity, limit_price) - Place a limit order
  • cancel_all_orders() - Cancel all open orders
  • close_all_positions(cancel_orders) - Close all open positions

Example Queries

Once the server is connected to Claude, you can ask questions like:

  • “What’s my current account balance and buying power?”
  • “Show me my current positions”
  • “Get the latest quote for AAPL”
  • “Show me the price history for TSLA over the last 10 days”
  • “Buy 5 shares of MSFT at market price”
  • “Sell 10 shares of AMZN with a limit price of $130”
  • “Cancel all my open orders”

Note

This server uses Alpaca’s paper trading by default. To use real money trading, change paper=True to paper=False in the TradingClient initialization.

Security Notice

GitHub에서 전체 README 보기

설치

This server does not publish a one-line install command.

Open the repository installation guide MCP 초보자라면? mcpskill.org 가이드부터 시작하세요 →

설정

{ "mcpServers": { "alpaca": { "command": "python", "args": [ "/path/to/alpaca_mcp_server.py" ], "env": { "API_KEY_ID": "your_alpaca_api_key", "API_SECRET_KEY": "your_alpaca_secret_key" } } } }