Alpaca's Official MCP Server

by alpacahq

498 downloads
Not rated
GitHub

About

Alpaca’s official MCP Server lets you trade stocks, ETFs, crypto, and options, run data analysis, and build strategies in plain English directly from your favorite LLM tools and IDEs

Details

Author
alpacahq
Downloads
498
Categories
Finance, Other

- Real-time and historical market data for stocks, crypto, and options
- Account balance, buying power, and position inspection
- Place and cancel market, limit, stop, and trailing-stop orders
- Single-leg and multi-leg options trading (spreads, straddles)
- Crypto market, limit, and stop-limit order support
- Market status and corporate actions data

Setting up with Highlight

This MCP is not yet compatible with Highlight’s one-click setup. However, you can still use it with Highlight by following these steps:

  1. Download and install Highlight from highlightai.com/download
  2. Navigate to the plugins tab and select "Add Custom Plugin"
  3. Configure the plugin with the settings below
    Plugin Name Alpaca's Official MCP Server
    Command (node, npx, python, etc.)

    Please refer to the README for specific instructions on how to obtain API keys or other required environment variables.

  4. Enable "Start Automatically" if you want the plugin to start when Highlight launches

From the repository

Install prerequisites (Python 3.10+, uv, Alpaca API keys, an MCP client) and run uvx alpaca-mcp-server init or python3 install.py. Then configure your MCP client by adding the server to its JSON config file with your API keys in the env section.

Claude Desktop / Cursor

Paste into your MCP client config file to install this server.

{
    "mcpServers": {
        "alpaca's official mcp server": {
            "alpaca": {
                "command": "uvx",
                "args": [
                    "alpaca-mcp-server",
                    "serve"
                ],
                "env": {
                    "ALPACA_API_KEY": "your_alpaca_api_key",
                    "ALPACA_SECRET_KEY": "your_alpaca_secret_key"
                }
            }
        }
    }
}

McpServers

{
    "alpaca": {
        "command": "uvx",
        "args": [
            "alpaca-mcp-server",
            "serve"
        ],
        "env": {
            "ALPACA_API_KEY": "your_alpaca_api_key",
            "ALPACA_SECRET_KEY": "your_alpaca_secret_key"
        }
    }
}

<p align="center">
Alpaca logo
</p>

<div align="center">

<a href="https://x.com/alpacahq?lang=en" target="_blank">X</a>
<a href="https://www.reddit.com/r/alpacamarkets/" target="_blank">Reddit</a>
<a href="https://alpaca.markets/slack" target="_blank">Slack</a>
<a href="https://www.linkedin.com/company/alpacamarkets/" target="_blank">LinkedIn</a>
<a href="https://forum.alpaca.markets/" target="_blank">Forum</a>
<a href="https://docs.alpaca.markets/docs/getting-started" target="_blank">Docs</a>
<a href="https://alpaca.markets/sdks/python/" target="_blank">Python SDK</a>

</div>

<p align="center">
A comprehensive Model Context Protocol (MCP) server for Alpaca's Trading API. Enable natural language trading operations through AI assistants like Claude, Cursor, and VS Code. Supports stocks, options, crypto, portfolio management, and real-time market data.
</p>

Table of Contents



- Prerequisites
- Start here
- Getting Your API Keys
- Switching API Keys for Live Trading
- Quick Local Installation for MCP Server
- Features
- Example Prompts
- Example Outputs
- Available Tools
- MCP Client Configuration
- OAuth Bearer Token Support
- HTTP Transport for Remote Usage
- Disclosure

Prerequisites


You need the following prerequisites to configure and run the Alpaca MCP Server.
- Terminal (macOS/Linux) | Command Prompt or PowerShell (Windows)
- Python 3.10+ (Check the official installation guide and confirm the version by typing the following command: python3 --version in Terminal)
- uv (Install using the official guide)\
Tip: uv can be installed either through a package manager (like Homebrew) or directly using curl | sh.
- Alpaca Trading API keys (free paper trading account available)
- MCP client (Claude Desktop, Cursor, VS Code, etc.)

Note: Using an MCP server requires installation and configuration of both the MCP server and MCP client.

Start here


Note: These steps assume all Prerequisites have been installed.
- Claude Desktop
- Local: Use uvx or install.py → see Claude Desktop Configuration
- Claude Mobile
- Remote Hosting: Deploy to cloud service → see Claude Mobile Configuration
- ChatGPT
- Remote Hosting: Deploy to cloud service → see ChatGPT Configuration
- Cursor
- Local (Cursor Directory): Use the Cursor Directory entry and connect in a few clicks → see Cursor Configuration
- Local (install.py): Use install.py to set up and auto-configure Cursor → see Cursor Configuration
- VS Code
- Local: Use uvx → see VS Code Configuration
- PyCharm
- Local: Use uvx → see PyCharm Configuration
- Claude Code
- Local: Use uvx or Docker → see Claude Code Configuration
- Gemini CLI
- Local: Use uvx → see Gemini CLI Configuration

Note: How to show hidden files
- macOS Finder: Command + Shift + .
- Linux file managers: Ctrl + H
- Windows File Explorer: Alt, V, H
- Terminal (macOS/Linux): ls -a

Getting Your API Keys



1. Visit Alpaca Trading API Account Dashboard
2. Create a free paper trading account
3. Generate API keys from the dashboard

Switching API Keys for Live Trading



To enable live trading with real funds or switch between different accounts, update API credentials in two places:

1. .env file (used by MCP server)
2. MCP client config JSON (used by MCP client like Claude Desktop, Cursor, etc.)

Important: The MCP client configuration overrides the .env file. When using an MCP client, the credentials in the client's JSON config take precedence.

<details>
<summary><b>Step 1: Update MCP Server Config .env file</b></summary>

Method 1: Run the init command again to update your .env file
``bash

Follow the prompts to update your keys and toggle paper/live trading


uvx alpaca-mcp-server init
`
Method 2: Manually Update

`
ALPACA_API_KEY = "your_alpaca_api_key_for_live_account"
ALPACA_SECRET_KEY = "your_alpaca_secret_key_for_live_account"
ALPACA_PAPER_TRADE = False
TRADE_API_URL = None
TRADE_API_WSS = None
DATA_API_URL = None
STREAM_DATA_WSS = None
`
</details>

<details>
<summary><b>Step 2: Update MCP Client Config Json file</b></summary>

Step 2-1: Edit your MCP client configuration file:
- Claude Desktop:
~/Library/Application Support/Claude/claude_desktop_config.json (Mac) or %APPDATA%\Claude\claude_desktop_config.json (Windows)
- Cursor:
~/.cursor/mcp.json
- VS Code:
.vscode/mcp.json (workspace) or user settings.json

Step 2-2: Update the API keys in the
env section:

For uvx installations:
`json
{
"mcpServers": {
"alpaca": {
"command": "uvx",
"args": ["alpaca-mcp-server", "serve"],
"env": {
"ALPACA_API_KEY": "your_alpaca_api_key_for_live_account",
"ALPACA_SECRET_KEY": "your_alpaca_secret_key_for_live_account"
}
}
}
}
`
Then, restart your MCP client (Claude Desktop, Cursor, etc.)
</details>

Quick Local Installation for MCP Server


<details>
<summary><b>Method 1: One-click installation with uvx from PyPI</b></summary>

Note: Using an MCP server requires installation and configuration of both the MCP server and MCP client.

`bash

Install and configure


uvx alpaca-mcp-server init
`

Note: If you don't have
uv yet, install it first and then restart your terminal so uv/uvx are recognized. See the official guide: https://docs.astral.sh/uv/getting-started/installation/

Then add to your MCP client config :

Config file locations:
- Claude Desktop:
~/Library/Application Support/Claude/claude_desktop_config.json (Mac) or %APPDATA%\Claude\claude_desktop_config.json (Windows)
- Cursor:
~/.cursor/mcp.json (Mac/Linux) or %USERPROFILE%\.cursor\mcp.json (Windows)


`json
{
"mcpServers": {
"alpaca": {
"command": "uvx",
"args": ["alpaca-mcp-server", "serve"],
"env": {
"ALPACA_API_KEY": "your_alpaca_api_key",
"ALPACA_SECRET_KEY": "your_alpaca_secret_key"
}
}
}
}
`

</details>

<details>
<summary><b>Method 2: Install.py for Cursor or Claude Desktop</b></summary>

Clone the repository and navigate to the directory:
`bash
git clone https://github.com/alpacahq/alpaca-mcp-server.git
cd alpaca-mcp-server
``
Execute the following commands in your termina

No reviews yet — be the first

Sign in to leave a review

Use Google, GitHub, or an email account so ratings stay tied to real people.

Email sign in

No reviews posted yet.