
laukikk/alpaca-mcp 是从 https://github.com/laukikk/alpaca-mcp. 导入的 MCP 服务器候选
概览
laukikk/alpaca-mcp 是从 https://github.com/laukikk/alpaca-mcp. 导入的 MCP 服务器候选
概述(AI 翻译)
一个模型上下文协议(MCP)服务器,提供与Alpaca交易API的接口,允许您管理股票和加密投资组合、下单交易并访问市场数据。
特色
- 账户管理:查看账户详情、余额及投资组合状态
- 交易:下卖、限价、止损和止损限价单
- 投资组合管理:查看头寸、计算表现及平仓
- 市场数据:获取实时报价和历史价格数据
- 资产信息:获取可交易资产的详细信息
安装
通过Smithery安装
通过Smithery自动安装Alpaca Trading MCP Server用于Claude Desktop:
手动安装
- 克隆此仓库
- 安装依赖:
或者用紫外线:
配置
-
将
.env.example文件复制到.env: -
将您的羊驼纸币交易API凭证添加到
.env文件中:
您可以通过在Alpaca注册账户来获取这些凭证。
用途
运行MCP服务器:
服务器将启动并供MCP客户端连接。
用Claude桌面测试
配置:
本页由 AI 翻译,技术细节请以原文为准。
README
以下为原文 README 节选,完整内容请查看原文。
Alpaca Trading MCP Server
A Model Context Protocol (MCP) server that provides an interface to the Alpaca trading API, allowing you to manage your stock and crypto portfolio, place trades, and access market data.
Features
- Account Management: View account details, balances, and portfolio status
- Trading: Place market, limit, stop, and stop-limit orders
- Portfolio Management: View positions, calculate performance, and close positions
- Market Data: Access real-time quotes and historical price data
- Asset Information: Get details about tradable assets
Installation
Installing via Smithery
To install Alpaca Trading MCP Server for Claude Desktop automatically via Smithery:
npx -y @smithery/cli install @laukikk/alpaca-mcp --client claude
Manual Installation
- Clone this repository
- Install dependencies:
pip install -e .
Or using uv:
uv pip install -e .
Configuration
- Copy the
.env.examplefile to.env:
cp .env.example .env
- Add your Alpaca Paper Trading API credentials to the
.envfile:
ALPACA_PAPER_API_KEY = "your-api-key"
ALPACA_PAPER_API_SECRET = "your-api-secret"
You can obtain these credentials by creating an account at Alpaca.
Usage
Run the MCP server:
python src/server.py
The server will start and be available for MCP clients to connect to.
Testing with Claude for Desktop
Configuration:
Open your Claude for Desktop App configuration in a text editor. Create the file if it doesn’t exist.
- Windows:
%APPDATA%\Claude\claude_desktop_config.json - Mac:
~/Library/Application\ Support/Claude/claude_desktop_config.json
Add the Alpaca MCP server configuration:
{
"mcpServers": {
"alpaca": {
"command": "uv",
"args": [
"--directory",
"/ABSOLUTE/PATH/TO/PARENT/FOLDER/alpaca-mcp-server",
"run",
"src/server.py"
]
}
}
}
MCP For Server Developers: Quickstart
Available Resources
The server provides the following resources:
account://info- Get current account informationpositions://all- Get all current positionspositions://{symbol}- Get position details for a specific symbolorders://recent/{limit}- Get most recent orders with specified limitmarket://{symbol}/quote- Get current market quote for a specific symbolmarket://{symbol}/bars/{timeframe}- Get historical price bars for a symbol with specified timeframeassets://list- List tradable assets available on Alpacaassets://{symbol}- Get detailed asset information by symbol
Available Tools
安装
npx -y @smithery/cli install @laukikk/alpaca-mcp --client claude配置
{
"mcpServers": {
"alpaca": {
"command": "uv",
"args": [
"--directory",
"/ABSOLUTE/PATH/TO/PARENT/FOLDER/alpaca-mcp-server",
"run",
"src/server.py"
]
}
}
}