mcpField
A
Alpaca MCP Server

Alpaca MCP Server

Local
github.com/berlinbraFinance0Updated 80w ago

About Alpaca MCP Server

Alpaca MCP Server connects MCP clients to cryptocurrency market data from the Alpaca API. It provides historical bars and exchange rates, with error and rate-limit handling.

Key features

  1. 01Daily, weekly, and monthly crypto series
  2. 02Latest crypto exchange rates
  3. 03Historical cryptocurrency bars
  4. 04Error and rate-limit handling

Use cases

  1. 01Review historical BTC/USD candles
  2. 02Check recent cryptocurrency exchange rates

MCP support

It exposes Alpaca cryptocurrency market data to MCP clients through the `get-crypto-bars` tool.

Configuration

Local server config is the same for every client. Copy it into your client’s MCP config file.

mcp.json · Universal config
{
"mcpServers": {
"alpaca-mcp-berlinbra": {
"command": "docker",
"args": [
"run",
"-i",
"--rm",
"build"
]
}
}
}
Run commanddocker run -i --rm build

Local servers need a runtime on your machine (e.g. Node.js 18+). Config file locations differ by client; see your client’s docs.

Packages
ocibuild

Tools

No tool list yet

Local servers expose tools only once running on your machine, and the maintainer has not provided a tool list.

Details

From the project README

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.json to match the following, replacing REPLACE_API_KEY and REPLACE_API_SECRET with your actual keys:

claude_desktop_config.json path

  • 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:

  1. First, install UV if you don't have it already:
# Using pip
pip install uv

# Using brew on macOS
brew install uv
  1. 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"
      }
    }
  }
}
  1. 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 .
  1. Run the server using UV:
uv run alpaca_mcp/server.py
  1. 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.

Comments

Markdown supported

New to MCP?

From what the protocol is to installing your first server, these answers cover most first questions.

An open protocol that defines how AI applications connect to external tools and data in a uniform way. Clients talk to the model; MCP servers provide tools, resources and prompt templates. They exchange standard messages, so one server can be reused by many clients.