Airsc miễn phí cho tất cả. Nếu nó giúp bạn, hãy ủng hộ $2–$20.

Ủng hộ
MCP serverAn toànThanh toán & bán hàngCần cài đặt chút

alpaca-mcp-server

alpacahq · alpacahq/alpaca-mcp-server

MCP server này cho phép các agent AI thực hiện giao dịch cổ phiếu, ETF, tiền điện tử, và quyền chọn, phân tích dữ liệu và xây dựng chiến lược giao dịch bằng ngôn ngữ tự nhiên.

MCP Server chính thức của Alpaca cho phép bạn giao dịch cổ phiếu, ETF, tiền mã hóa và quyền chọn, chạy phân tích dữ liệu và xây dựng chiến lược bằng tiếng Anh thông thường trực tiếp từ các công cụ LLM và IDE yêu thích của bạn.

1k sao333Giấy phép: MITCập nhật 23 ngày trước0 lượt mở

Xem trước

▍

Bạn có thể làm gì với nó

  • Tự động mua bán cổ phiếu dựa trên phân tích thị trường.
  • Tạo một agent AI để quản lý danh mục đầu tư tiền điện tử.
  • Phát triển các truy vấn ngôn ngữ tự nhiên để lấy dữ liệu thị trường theo thời gian thực.

Kiểm tra an toàn

An toàn

Không thấy dấu hiệu rủi ro trong các file đã quét.

Quét tự động các file trong repo. Luôn xem lại code trước khi chạy.

Trích từ README

A comprehensive Model Context Protocol (MCP) server for Alpaca's Trading API. Enable natural language trading operations through AI assistants like Claude, Cursor, and VS Code. Supports stocks, options, crypto, portfolio management, and real-time market data.

Alpaca MCP Server v2 is here. This version is a complete rewrite built with FastMCP and OpenAPI. If you're upgrading from v1, please read the Upgrade Guide — tool names, parameters, and configuration have changed.

Table of Contents


Upgrading from V1

V2 is a complete rewrite built with FastMCP and OpenAPI. None of the V1 tools exist in V2 — tool names, parameters, and schemas have changed. You cannot use V2 as a drop-in replacement if your setup depends on specific V1 tool names or parameters.

What changes

AspectV1V2
Tool namesHand-crafted (e.g. get_account_info)Spec-derived with overrides (e.g. get_account_info — names may overlap but schemas differ)
ParametersCustom schemasAligned with Alpaca API specs
Configuration.env + init commandEnv vars in MCP client config only
Tool filteringNot supportedALPACA_TOOLSETS env var
WhitelistingNot supportedUse ALPACA_TOOLSETS to restrict tools

How to avoid V1-style usage in V2

MCP clients discover tools dynamically from the server. There is no config file where you "whitelist" tool names — the client gets whatever tools the server exposes. To avoid your client or AI assistant using V2 incorrectly:

  1. Do not reuse V1 config — Treat V2 as a new server. Update your MCP client config with the new command/args; remove any .env or init-based setup.
  2. Clear tool caches — Restart your MCP client (Claude Desktop, Cursor, VS Code, etc.) after switching so it fetches the new tool list instead of using a stale one.
  3. Start a fresh chat/session — Existing conversations may have cached references to old tool names. Start a new chat so the LLM sees the current V2 tools and their schemas.
  4. Update custom instructions and rules — If you have Cursor rules, Claude instructions, or other prompts that mention specific V1 tool names (e.g. "use get_account_info"), update them to match V2 tool names or remove those references and let the LLM discover tools from context.
  5. Restrict tools with ALPACA_TOOLSETS — If you previously limited which capabilities your assistant could use, V2 supports server-side filtering via the ALPACA_TOOLSETS env var. See Configuration > Toolset Filtering for the list of toolsets.

Summary

Assume no backward compatibility with V1. Reconfigure your MCP client for V2, restart it, and use a fresh session. Check the Available Tools section for the current tool list.

If you had custom V1 workflows

If you documented allowed tools, wrote scripts that call tools by name, or built prompts around specific V1 tool/parameter shapes — treat them as obsolete. Recreate them using the Available Tools listed below and the current parameter schemas exposed by the server.

Staying on V1

If you need to stay on V1, pin to the last V1 release (e.g. uvx alpaca-mcp-server==1.x.x serve) in your MCP client config. V1 remains available on PyPI for existing setups.


Prerequisites

Getting Your API Keys

  1. Visit the Alpaca Dashboard
  2. Create a free paper trading account
  3. Generate API keys from the dashboard

Setup

Add the server to your MCP client config, then restart the client. No init command, no .env files — credentials are set in one place only.

Claude Desktop

Edit ~/Library/Application Support/Claude/claude_desktop_config.json (Mac) or %APPDATA%\Claude\claude_desktop_config.json (Windows):

{
  "mcpServers": {
    "alpaca": {
      "command": "uvx",
      "args": ["alpaca-mcp-server"],
      "env": {
        "ALPACA_API_KEY": "your_alpaca_api_key",
        "ALPACA_SECRET_KEY": "your_alpaca_secret_key"
      }
    }
  }
}

Claude Mobile

Claude Mobile requires a remote MCP server. This package does not configure remote MCP authentication, so do not expose it directly to the public internet with your Alpaca API keys. Use the local stdio setup from a supported desktop client.

ChatGPT

ChatGPT requires a remote MCP server. This package does not configure remote MCP authentication, so do not expose it directly to the public internet with your Alpaca API keys. Use the local stdio setup from a supported desktop client.

Cursor

Instal

Xem mã nguồn trên GitHub