- Home
- MCP servers
- Alpaca
Alpaca
- python
3
GitHub Stars
python
Language
6 months ago
First Indexed
2 months ago
Catalog Refreshed
Documentation & install
Readme and setup notes from the catalogue, plus a client-ready config you can copy for your MCP host.
Installation
Add the following to your MCP client configuration file.
Configuration
View docs{
"mcpServers": {
"miguelyad26-alpaca-mcp-server": {
"command": "python",
"args": [
"/path/to/alpaca_mcp_server.py"
],
"env": {
"API_KEY_ID": "your_alpaca_api_key",
"API_SECRET_KEY": "your_alpaca_secret_key"
}
}
}
}You can run an MCP server that lets Claude and other MCP clients interact with the Alpaca trading API. This server provides real-time market data, account information, positions, and the ability to place and manage orders through natural language queries. Use it to securely connect your trading workflows to Alpaca via simple commands.
How to use
Set up a client that supports MCP and connect it to the Alpaca MCP Server. You can ask for your account balance, view open positions, fetch real-time stock quotes, pull historical price data, and place or manage orders using natural language prompts. The server exposes a concise set of tools for common trading tasks, enabling you to build conversational trading experiences.
How to install
Prerequisites: Python 3.10 or newer, Alpaca API keys, and a compatible MCP client such as Claude for Desktop.
Step 1: Clone the MCP server repository and install dependencies.
git clone https://github.com/YOUR_USERNAME/alpaca-mcp.git
cd alpaca-mcp
Step 2: Install required Python packages.
pip install mcp alpaca-py python-dotenv
Step 3: Create a .env file with your Alpaca API credentials.
API_KEY_ID=your_alpaca_api_key
API_SECRET_KEY=your_alpaca_secret_key
Step 4: Run the server.
python alpaca_mcp_server.py
Configuration and runtime notes
The server uses your Alpaca credentials to access the trading API. Ensure your keys are kept secure and never shared in logs or with untrusted clients.
If you want Claude or another MCP client to connect, you typically provide a simple JSON configuration that points the client at the server and passes your credentials as environment variables.
Security and usage notes
This MCP server has access to your Alpaca account and can place trades. Always review suggested actions before executing trades, and consider using Alpaca’s paper trading mode while testing.
Example commands you can run after connect
Ask for your current account balance and buying power, view your positions, fetch a stock quote, retrieve historical price data, place market or limit orders, and manage or cancel orders.
Available tools
get_account_info
Retrieve balances and overall account status, including buying power and margin details.
get_positions
List current positions in your portfolio with performance data.
get_stock_quote
Fetch the latest live quote for a given stock symbol.
get_stock_bars
Obtain historical price bars for a stock over a specified number of days.
get_orders
List your orders filtered by status and limit.
place_market_order
Place a market order to buy or sell a specified quantity of a stock.
place_limit_order
Place a limit order with a defined price threshold.
cancel_all_orders
Cancel all open orders in the account.
close_all_positions
Close all open positions, with an option to cancel pending orders.