Trading Server
БесплатноНе проверенExposes Alpaca paper trading tools (get positions and account) via SSE transport, designed for Claude Desktop and n8n.
Описание
Exposes Alpaca paper trading tools (get positions and account) via SSE transport, designed for Claude Desktop and n8n.
README
A Model Context Protocol (MCP) server that exposes Alpaca paper trading tools via SSE transport. Designed to serve Claude Desktop (over LAN) and n8n (localhost).
Features
- SSE Transport: Server-Sent Events for real-time communication
- Two Core Tools:
get_positions— Retrieve all open positions from Alpacaget_account— Get account summary and buying power
- Multi-client Support: Claude Desktop (LAN) + n8n (localhost)
- PM2 Integration: Production deployment on Mac Mini
Quick Start
Setup
Clone and install:
npm installConfigure environment:
cp .env.example .env # Edit .env with your Alpaca API credentialsRun locally:
npm run devOr start with PM2:
npm run pm2:start
Environment Variables
APCA_API_KEY_ID— Your Alpaca API keyAPCA_API_SECRET_KEY— Your Alpaca secret keyPORT— Server port (default: 3100)NODE_ENV— Environment (production/development)
Architecture
src/
├── server.js # Express + MCP SSE transport
├── tools/
│ └── alpaca.js # Tool definitions and handlers
└── alpaca/
└── client.js # Reusable Alpaca API client
Server Details
- Port: 3100
- Transport: Server-Sent Events (SSE)
- Base URL: https://paper-api.alpaca.markets/v2
- Auth: APCA-API-KEY-ID and APCA-API-SECRET-KEY headers
Tools
get_positions
Fetches all open positions from your Alpaca paper account.
Returns:
{
"positions": [
{
"symbol": "ETHUSD",
"qty": 1.5,
"avg_fill_price": 2800.00,
"current_price": 2850.00,
"side": "long",
"unrealized_pl": 75.00,
"unrealized_plpc": 0.0267
}
]
}
get_account
Fetches account summary including buying power and cash balance.
Returns:
{
"account": {
"id": "...",
"account_number": "...",
"buying_power": 25000.00,
"cash": 10000.00,
"portfolio_value": 35000.00,
"multiplier": 1,
"equity": 35000.00,
"last_equity": 35000.00
}
}
Development
Watch mode with auto-restart:
npm run dev
View PM2 logs:
npm run pm2:logs
Restart service:
npm run pm2:restart
Production Deployment
On Mac Mini, use PM2 ecosystem file:
npm run pm2:start
The process will:
- Auto-restart on crashes
- Start on system boot (if configured)
- Rotate logs daily
- Maintain error and output logs
Connecting Clients
Claude Desktop
Configure in claude_desktop_config.json:
{
"mcpServers": {
"trading": {
"command": "node",
"args": ["/path/to/mcp-trading-server/src/server.js"],
"env": {
"APCA_API_KEY_ID": "...",
"APCA_API_SECRET_KEY": "..."
}
}
}
}
n8n
Create HTTP Request node pointing to http://localhost:3100
Troubleshooting
Connection refused: Ensure server is running on port 3100
lsof -i :3100
Auth errors: Verify .env has valid Alpaca credentials
PM2 issues: Check logs
pm2 logs mcp-trading-server
License
MIT
Установка Trading Server
У этого сервера нет опубликованного пакета — он собирается из исходников. Открой репозиторий и следуй инструкции в README.
▸ github.com/JNB-DCLARK/mcp-trading-serverFAQ
Trading Server MCP бесплатный?
Да, Trading Server MCP бесплатный — установка в пару кликов через Unyly без оплаты.
Нужен ли API-ключ для Trading Server?
Нет, Trading Server работает без API-ключей и переменных окружения.
Trading Server — hosted или self-hosted?
Доступен hosted-вариант: Unyly запускает сервер в облаке, локальная установка не обязательна.
Как установить Trading Server в Claude Desktop, Claude Code или Cursor?
Открой Trading Server на unyly.org, выбери вкладку своего клиента (Claude Desktop, Claude Code, Cursor) и нажми Install — конфиг сгенерируется автоматически, без правки JSON.
Похожие MCP
Fetch
Web content fetching and conversion for efficient LLM usage.
AWS KB Retrieval
Retrieval from AWS Knowledge Base using Bedrock Agent Runtime.
автор: modelcontextprotocolSpring AI MCP Server
Provides auto-configuration for setting up an MCP server in Spring Boot applications.
llm-analysis-assistant
A very streamlined mcp client that supports calling and monitoring stdio/sse/streamableHttp, and can also view request responses through the /logs page. It also
автор: xuzexin-hzCompare Trading Server with
Не уверен что выбрать?
Найди свой стек за 60 секунд
Автор?
Embed-бейдж для README
Похожее
Все в категории ai
