alpaca-mcp-server
1
The Alpaca Trading MCP Server is a Python-based implementation of the Model Context Protocol, designed to facilitate interaction between Alpaca's trading API and Large Language Models like Anthropic Claude. It supports account management, market data access, and trading operations while ensuring safety with features like paper trading.
Alpaca Trading MCP Server
Overview
A Model Context Protocol (MCP) server implementation for Alpaca trading that allows interaction with Alpaca's trading API using Large Language Models (LLMs) such as Anthropic Claude. The server facilitates account management, market data access, trading operations, and position tracking. Usage is primarily intended for MacOS/Linux users.
Features
- Account Management: View account information and portfolio summary.
- Market Data: Access real-time quotes and historical price bars.
- Trading Operations: Place market and limit orders.
- Position Tracking: Monitor current positions and recent orders.
Installation
- Clone the repository.
- Optionally create and activate a virtual environment.
- Install dependencies using
uv
. - Add your Alpaca credentials to a
.env
file.
Usage
- Configure Claude for Desktop with the MCP server details.
- Test server using sample queries for portfolio balance and order placements.
Tools and Resources
account://info
for account info.positions://all
for current positions.market://quote/{symbol}
for latest quotes.place_market_order()
for market orders.
Safety Features
- Default to paper trading.
- Error handling and logging.
- Graceful startup and shutdown.