Interact with the Alpaca trading API for stock trading, account management, and market data using LLMs.
This is a Model Context Protocol (MCP) server for Alpaca, allowing LLMs like Claude to interact with the Alpaca trading API. It enables trading stocks, checking positions, fetching market data, and managing your account - all through natural language.
Clone this repository:
git clone https://github.com/YOUR_USERNAME/alpaca-mcp.git
cd alpaca-mcp
Install the required packages:
pip install mcp alpaca-py python-dotenv
Create a .env
file with your Alpaca API credentials:
API_KEY_ID=your_alpaca_api_key
API_SECRET_KEY=your_alpaca_secret_key
Start the server by running:
python alpaca_mcp_server.py
claude_desktop_config.json
:{
"mcpServers": {
"alpaca": {
"command": "python",
"args": [
"/path/to/alpaca_mcp_server.py"
],
"env": {
"API_KEY_ID": "your_alpaca_api_key",
"API_SECRET_KEY": "your_alpaca_secret_key"
}
}
}
}
The server exposes the following tools:
get_account_info()
- Get account balances and statusget_positions()
- List all current positions in the portfolioget_stock_quote(symbol)
- Get the latest quote for a stockget_stock_bars(symbol, days)
- Get historical price bars for a stockget_orders(status, limit)
- List orders with specified statusplace_market_order(symbol, side, quantity)
- Place a market orderplace_limit_order(symbol, side, quantity, limit_price)
- Place a limit ordercancel_all_orders()
- Cancel all open ordersclose_all_positions(cancel_orders)
- Close all open positionsOnce the server is connected to Claude, you can ask questions like:
This server uses Alpaca's paper trading by default. To use real money trading, change paper=True
to paper=False
in the TradingClient
initialization.
This MCP server will have access to your Alpaca account and can place real trades. Always review what Claude is suggesting before approving any trades.
MIT
A read-only MCP server for querying live Salesforce Einstein data using a CData JDBC driver.
Interact with the Appwrite API to manage databases, users, storage, and more. Requires configuration via environment variables.
Interact with the Eyevinn Open Source Cloud API. Requires a Personal Access Token (OSC_ACCESS_TOKEN).
A middleware server that allows large language models to interact directly with PlayFab services.
Deploy a remote MCP server on Cloudflare Workers with OAuth login support, using Cloudflare KV for data storage.
An example of a remote MCP server deployable on Cloudflare Workers without authentication.
A remote MCP server deployable on Cloudflare Workers or runnable locally, requiring no authentication or external data files.
An MCP server for managing ONOS (Open Network Operating System) networks.
Retrieve data from the National Park Service (NPS) API.
Backs up Cloudflare projects to a specified GitHub repository.