Alpaca
alpacahq/alpaca-mcp-server · 736 stars · Python · MIT
MCP server 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
Install
The repo has no one-line install. Follow its README.
Files
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.
Alpaca MCP Server v2 is here. This version is a complete rewrite built with FastMCP and OpenAPI. If you're upgrading from v1, please read the Upgrade Guide — tool names, parameters, and configuration have changed.
Table of Contents
- Upgrading from V1
- Prerequisites
- Getting Your API Keys
- Setup
- Configuration
- Features
- Example Prompts
- Available Tools
- Testing
- Project Structure
- Troubleshooting
- Disclosure
Upgrading from V1
V2 is a complete rewrite built with FastMCP and OpenAPI. None of the V1 tools exist in V2 — tool names, parameters, and schemas have changed. You cannot use V2 as a drop-in replacement if your setup depends on specific V1 tool names or parameters.
What changes
How to avoid V1-style usage in V2
MCP clients discover tools dynamically from the server. There is no config file where you "whitelist" tool names — the client gets whatever tools the server exposes. To avoid your client or AI assistant using V2 incorrectly:
- Do not reuse V1 config — Treat V2 as a new server. Update your MCP client config with the new command/args; remove any
.envorinit-based setup. - Clear tool caches — Restart your MCP client (Claude Desktop, Cursor, VS Code, etc.) after switching so it fetches the new tool list instead of using a stale one.
- Start a fresh chat/session — Existing conversations may have cached references to old tool names. Start a new chat so the LLM sees the current V2 tools and their schemas.
- Update custom instructions and rules — If you have Cursor rules, Claude instructions, or other prompts that mention specific V1 tool names (e.g. "use
get_account_info"), update them to match V2 tool names or remove those references and let the LLM discover tools from context. - Restrict tools with
ALPACA_TOOLSETS— If you previously limited which capabilities your assistant could use, V2 supports server-side filtering via theALPACA_TOOLSETSenv var. See Configuration > Toolset Filtering for the list of toolsets.
Summary
Assume no backward compatibility with V1. Reconfigure your MCP client for V2, restart it, and use a fresh session. Check the Available Tools section for the current tool list.
If you had custom V1 workflows
If you documented allowed tools, wrote scripts that call tools by name, or built prompts around specific V1 tool/parameter shapes — treat them as obsolete. Recreate them using the Available Tools listed below and the current parameter schemas exposed by the server.
Staying on V1
If you need to stay on V1, pin to the last V1 release (e.g. uvx alpaca-mcp-server==1.x.x serve) in your MCP client config. V1 remains available on PyPI for existing setups.
Prerequisites
- Python 3.10+ (installation guide)
- uv (installation guide)
- Alpaca Trading API keys (free paper trading account)
- MCP client (Claude Desktop, Cursor, VS Code, etc.)
Getting Your API Keys
- Visit the Alpaca Dashboard
- Create a free paper trading account
- Generate API keys from the dashboard
Setup
Add the server to your MCP client config, then restart the client. No init command, no .env files — credentials are set in one place only.
Claude Desktop
Edit ~/Library/Application Support/Claude/claude_desktop_config.json (Mac) or %APPDATA%\Claude\claude_desktop_config.json (Windows):
{
"mcpServers": {
"alpaca": {
"command": "uvx",
"args": ["alpaca-mcp-server"],
"env": {
"ALPACA_API_KEY": "your_alpaca_api_key",
"ALPACA_SECRET_KEY": "your_alpaca_secret_key"
}
}
}
}
Claude Mobile
Claude Mobile requires a remote MCP server. This package does not configure remote MCP authentication, so do not expose it directly to the public internet with your Alpaca API keys. Use the local stdio setup from a supported desktop client.
ChatGPT
ChatGPT requires a remote MCP server. This package does not configure remote MCP authentication, so do not expose it directly to the public internet with your Alpaca API keys. Use the local stdio setup from a supported desktop client.
Cursor
Install from the Cursor Directory in a few clicks, or add to ~/.cursor/mcp.json:
{
"mcpServers": {
"alpaca": {
"command": "uvx",
"args": ["alpaca-mcp-server"],
"env": {
"ALPACA_API_KEY": "your_alpaca_api_key",
"ALPACA_SECRET_KEY": "your_alpaca_secret_key"
}
}
}
}
VS Code
Create .vscode/mcp.json in your project root. See the official docs.
{
"servers": {
"alpaca": {
"type": "stdio",
"command": "uvx",
"args": ["alpaca-mcp-server"],
"env": {
"ALPACA_API_KEY": "your_alpaca_api_key",
"ALPACA_SECRET_KEY": "your_alpaca_secret_key"
}
}
}
}
PyCharm
See the official guide.
- Go to File → Settings → Tools → Model Context Protocol (MCP)
- Add a new server:
- Type: stdio
- Command: uvx
- Arguments: alpaca-mcp-server
- Set environment variables:
ALPACA_API_KEY=your_alpaca_api_key
ALPACA_SECRET_KEY=your_alpaca_secret_key
Claude Code
claude mcp add alpaca --scope user --transport stdio uvx alpaca-mcp-server \
--env ALPACA_API_KEY=your_alpaca_api_key \
--env ALPACA_SECRET_KEY=your_alpaca_secret_key
Verify with /mcp in the Claude Code CLI.
Antigravity CLI
See the Antigravity MCP docs.
Add to ~/.gemini/antigravity-cli/mcp_config.json (global) or .agents/mcp_config.json (workspace):
{
"mcpServers": {
"alpaca": {
"command": "uvx",
"args": ["alpaca-mcp-server"],
"env": {
"ALPACA_API_KEY": "your_alpaca_api_key",
"ALPACA_SECRET_KEY": "your_alpaca_secret_key"
}
}
}
}
Docker
git clone https://github.com/alpacahq/alpaca-mcp-server.git
cd alpaca-mcp-server
docker build -t mcp/alpaca:latest .
Add to your MCP client config:
{
"mcpServers": {
"alpaca": {
"command": "docker",
"args": [
"run", "--rm", "-i",
"-e", "ALPACA_API_KEY=your_key",
"-e", "ALPACA_SECRET_KEY=your_secret",
"-e", "ALPACA_PAPER_TRADE=true",
"mcp/alpaca:latest"
]
}
}
}
Configuration
Facts
- Kind
- MCP server
- Repo
- alpacahq/alpaca-mcp-server
- Group
- Uncategorized
- Stars
- 736
- License
- MIT
- Language
- Python
- Last push
- 2026-09-25
- Forks
- 334
- Homepage
- alpaca.markets/algotrading
- Topics
- ai-trading, algorithmic-trading, crypto, etfs, mcp, mcp-server, options, stocks, trading, trading-api
- 1Everythingmodelcontextprotocol/serversThis MCP server attempts to exercise all the features of the MCP protocol. It is not intended to be a useful server, but rather a test server for builders of MCP clients. It implements prompts, tools, resources, sampling, and more to showcase MCP capabilities.85.8k
- 2Fetchmodelcontextprotocol/serversA Model Context Protocol server that provides web content fetching capabilities. This server enables LLMs to retrieve and process content from web pages, converting HTML to markdown for easier consumption.85.8k
- 3Gitmodelcontextprotocol/serversA Model Context Protocol server for Git repository interaction and automation. This server provides tools to read, search, and manipulate Git repositories via Large Language Models.85.8k
- 4Memorymodelcontextprotocol/serversA basic implementation of persistent memory using a local knowledge graph. This lets Claude remember information about the user across chats.85.8k
- 5Sequential Thinkingmodelcontextprotocol/serversAn MCP server implementation that provides a tool for dynamic and reflective problem-solving through a structured thinking process.85.8k
- 6Timemodelcontextprotocol/serversA Model Context Protocol server that provides time and timezone conversion capabilities. This server enables LLMs to get current time information and perform timezone conversions using IANA timezone names, with automatic system timezone detection.85.8k