使用说明
羊驼MCP服务器
公开Alpaca市场数据和经纪API作为MCP工具。
安装
通过Smithery安装
通过以下方式自动安装Claude Desktop的羊驼市场数据服务器 史密瑟里:
npx -y @smithery/cli install @cesarvarela/alpaca-mcp --client claude
手动安装
npm install alpaca-mcp
地方发展
git clone <repo-url>
cd alpaca-mcp
npm install
环境变量
创建一个 .env 在项目根目录下使用:
ALPACA_ENDPOINT=https://data.alpaca.markets
ALPACA_BROKER_ENDPOINT=https://broker-api.alpaca.markets
ALPACA_API_KEY=YOUR_ALPACA_API_KEY
ALPACA_SECRET_KEY=YOUR_ALPACA_SECRET_KEY
命令
- 开始 (dev):
npm start(跑步npx tsx index.ts) - 构建:
npm run build(编译为dist/) - 运行编译:
node dist/index.js
用法
一旦运行,MCP服务器就会监听stdin/stdout。使用任何MCP客户端或CLI:
npm link # optional
alpaca-mcp # starts server globally
可用工具
- 获取资产
{ assetClass?: "us_equity" | "crypto" } - 买股票吧
{ symbols: string[]; start: string; end: string; timeframe: string } - 获得市场日
{ start: string; end: string } - 获取新闻
{ start: string; end: string; symbols: string[] }
每个返回JSON content[0].text 或者错误。
MCP客户端配置
通过以下方式集成 mcp.config.json,在下面添加以下内容 mcpServers 按键:
{
"mcpServers": {
"alpaca-mcp": {
"command": "npx",
"args": [
"-y",
"alpaca-mcp"
],
"env": {
"ALPACA_ENDPOINT": "https://data.alpaca.markets",
"ALPACA_BROKER_ENDPOINT": "https://broker-api.alpaca.markets",
"ALPACA_API_KEY": "<YOUR_API_KEY>",
"ALPACA_SECRET_KEY": "<YOUR_SECRET_KEY>"
}
}
}
}
## Publishing
```bash
npm publish
许可证
国际协调委员会
