MCP Trading Server
Enables n8n automation workflows to access Alpaca paper trading account information and positions through MCP tools.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@MCP Trading Servershow my open positions"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
MCP Trading Server
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
Related MCP server: Alpaca MCP Server
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 clientServer 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 devView PM2 logs:
npm run pm2:logsRestart service:
npm run pm2:restartProduction Deployment
On Mac Mini, use PM2 ecosystem file:
npm run pm2:startThe 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 :3100Auth errors: Verify .env has valid Alpaca credentials
PM2 issues: Check logs
pm2 logs mcp-trading-serverLicense
MIT
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- Alicense-qualityDmaintenanceA Model Context Protocol server enabling LLMs like Claude to interact with the Alpaca trading API through natural language for stock trading, checking positions, fetching market data, and managing your account.Last updated27MIT
- Alicense-qualityDmaintenanceA Model Context Protocol server that enables LLMs like Claude to interact with the Alpaca trading API, allowing for trading stocks, checking positions, fetching market data, and managing accounts through natural language.Last updated3MIT
- Alicense-qualityDmaintenanceProvides tools for interacting with the Alpaca Trading API, enabling trading operations like getting account information, placing/canceling orders, listing positions, and accessing market data.Last updatedMIT
- Alicense-qualityDmaintenanceEnables natural language trading operations through Alpaca's Trading API, supporting stocks, options, crypto, portfolio management, and real-time market data access through AI assistants like Claude.Last updatedMIT
Related MCP Connectors
16 AI-native tools with dual SSE + streamable-http transport. Free tier available.
AI Reasoning Cache & Consensus Layer with 11 MCP tools via Streamable HTTP.
MCP server exposing the Backtest360 engine API as tools for AI agents.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/JNB-DCLARK/mcp-trading-server'
If you have feedback or need assistance with the MCP directory API, please join our Discord server