
alpaca mcp
MCP Server for Alpaca Crypto API
Repository Info
About This Server
MCP Server for Alpaca Crypto API
Model Context Protocol (MCP) - This server can be integrated with AI applications to provide additional context and capabilities, enabling enhanced AI interactions and functionality.
Documentation
Alpaca MCP Server
A Model Context Protocol (MCP) server that provides real-time access to cryptocurrency market data through the Alpaca API. This server implements a standardized interface for retrieving cryptocurrency data.
Features
- Daily, weekly, and monthly cryptocurrency time series data
- Latest crypto exchange rates
- Historical bar/candle data
- Built-in error handling and rate limit management
Installation
Using Claude Desktop
Installing via Docker
- Clone the repository and build a local image to be utilized by your Claude desktop client
cd alpaca-mcp
docker build -t mcp/alpaca .
- Change your
claude_desktop_config.jsonto match the following, replacingREPLACE_API_KEYandREPLACE_API_SECRETwith your actual keys:
claude_desktop_config.jsonpath
- On MacOS:
~/Library/Application\ Support/Claude/claude_desktop_config.json- On Windows:
%APPDATA%/Claude/claude_desktop_config.json
{
"mcpServers": {
"alpaca": {
"command": "docker",
"args": [
"run",
"-i",
"-e",
"ALPACA_API_KEY",
"-e",
"ALPACA_API_SECRET",
"mcp/alpaca"
],
"env": {
"ALPACA_API_KEY": "REPLACE_API_KEY",
"ALPACA_API_SECRET": "REPLACE_API_SECRET"
}
}
}
}
Installing via UV (Fast Python Package Installer)
UV is a modern Python package installer that can simplify the installation process. To use UV with alpaca-mcp:
- First, install UV if you don't have it already:
# Using pip
pip install uv
# Using brew on macOS
brew install uv
- Configure your Claude Desktop config file to use UV:
{
"mcpServers": {
"alpaca": {
"command": "uv",
"args": [
"--directory",
"/path/to/alpaca-mcp",
"run",
"alpaca-mcp"
],
"env": {
"ALPACA_API_KEY": "REPLACE_API_KEY",
"ALPACA_API_SECRET": "REPLACE_API_SECRET"
}
}
}
}
- Install the package with UV:
# Clone the repository
git clone https://github.com/berlinbra/alpaca-mcp.git
cd alpaca-mcp
# Install dependencies using UV
uv pip install -e .
- Run the server using UV:
uv run alpaca_mcp/server.py
- For debugging purposes, you can use the MCP inspector:
npx @modelcontextprotocol/inspector uv --directory /path/to/alpaca-mcp run src/alpaca_mcp/server.py
Standard Development Setup
# Clone the repository
git clone https://github.com/berlinbra/alpaca-mcp.git
cd alpaca-mcp
# Create and activate a virtual environment
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
# Install the package in development mode
pip install -e .
Available Tools
Currently, the server implements the following tool:
get-crypto-bars: Get historical bar/candle data for cryptocurrencies
More tools will be added in the future.
get-crypto-bars
Input Schema:
{
"symbol": {
"type": "string",
"description": "Cryptocurrency symbol (e.g., BTC/USD, ETH/USD)"
},
"timeframe": {
"type": "string",
"description": "Timeframe for bars (e.g., 1Day, 1Hour, 1Min)",
"default": "1Day"
},
"start": {
"type": "string",
"description": "Start date in YYYY-MM-DD format"
},
"limit": {
"type": "integer",
"description": "Maximum number of bars to return",
"default": 10
}
}
Example Response:
Cryptocurrency bars for BTC/USD (1Day):
Date: 2025-04-10
Open: $68750.12
High: $69200.45
Low: $67900.78
Close: $68900.32
Volume: 12345.67
---
Date: 2025-04-11
Open: $68900.32
High: $70100.55
Low: $68400.21
Close: $69800.44
Volume: 15678.90
Error Handling
The server includes comprehensive error handling for various scenarios:
- Rate limit exceeded
- Invalid API key
- Network connectivity issues
- Timeout handling
- Malformed responses
Error messages are returned in a clear, human-readable format.
Prerequisites
- Python 3.12 or higher
- httpx
- mcp
- alpaca-py
- python-dotenv (for loading environment variables)
License
This MCP server is licensed under the MIT License.
Quick Start
Clone the repository
git clone https://github.com/berlinbra/alpaca-mcpInstall dependencies
cd alpaca-mcp
npm installFollow the documentation
Check the repository's README.md file for specific installation and usage instructions.
Repository Details
Recommended MCP Servers
Discord MCP
Enable AI assistants to seamlessly interact with Discord servers, channels, and messages.
Knit MCP
Connect AI agents to 200+ SaaS applications and automate workflows.
Apify MCP Server
Deploy and interact with Apify actors for web scraping and data extraction.
BrowserStack MCP
BrowserStack MCP Server for automated testing across multiple browsers.
Zapier MCP
A Zapier server that provides automation capabilities for various apps.