alpaca-mcp-server
by alpacahq·★ 736·综合分 53
Alpaca 官方 MCP 服务器允许通过 AI 助手自然语言交易股票、ETF、加密货币和期权。
概述
Alpaca MCP Server v2 是使用 FastMCP 和 OpenAPI 构建的 Model Context Protocol 的全面实现,通过自然语言界面提供对 Alpaca Trading API 的访问。它支持交易操作、市场数据访问、投资组合管理和策略开发,可直接通过 Claude、Cursor 和 VS Code 等 LLM 工具使用。该服务器支持多种资产类别,包括股票、期权和加密货币交易,并提供实时市场数据和各种订单类型。
试试问 AI
装完之后,这里有 5 个你可以让 AI 做的事:
什么时候选它
当您需要通过 LLM 工具直接进行 AI 驱动的交易,并获取股票、加密货币和期权的全面市场数据时选择此方案。
什么时候不要选它
不适合需要多经纪商支持或要求比基本订单类型更复杂算法交易工具的用户。
此 server 暴露的工具
从 README 抽取出 12 个工具get_account_infoGet account information, balances, and buying power
get_positionsView current positions in the account
place_orderPlace market, limit, stop, or stop-limit orders
cancel_orderCancel one or more open orders
liquidate_positionClose or liquidate positions
get_crypto_quotesGet current quotes for cryptocurrencies
get_option_chainGet available option contracts for a symbol
get_option_quoteGet latest quote for a specific option contract
place_option_orderPlace orders for option contracts
get_market_statusCheck market status and trading hours
get_watchlistsRetrieve and manage watchlists
get_stock_dataGet historical bars, quotes, and trades for stocks
可对比工具
安装
安装
先决条件
- Python 3.10+
- uv
- Alpaca Trading API 密钥
- MCP 客户端(Claude Desktop、Cursor、VS Code 等)
设置(Claude Desktop)
编辑 ~/Library/Application Support/Claude/claude_desktop_config.json:
{
"mcpServers": {
"alpaca": {
"command": "uvx",
"args": ["alpaca-mcp-server"],
"env": {
"ALPACA_API_KEY": "your_alpaca_api_key",
"ALPACA_SECRET_KEY": "your_alpaca_secret_key"
}
}
}
}设置(Cursor)
添加到 ~/.cursor/mcp.json:
{
"mcpServers": {
"alpaca": {
"command": "uvx",
"args": ["alpaca-mcp-server"],
"env": {
"ALPACA_API_KEY": "your_alpaca_api_key",
"ALPACA_SECRET_KEY": "your_alpaca_secret_key"
}
}
}
}FAQ
- 与 v1 版本向后兼容吗?
- 不兼容,v2 是完全重写的,具有不同的工具名称、参数和配置方法。请参阅升级指南获取迁移说明。
- 如何限制可用的交易工具?
- 使用 ALPACA_TOOLSETS 环境变量指定要启用的工具集(例如,'stock-data,crypto-data')。
Hacker News 讨论
开发者社区最近的相关讨论。
- 帖子 by growbell_social · 2025-06-06
alpaca-mcp-server 对比
最后更新于 · 由 README + GitHub 公开数据自动生成。