Alpaca Trading MCP Server

Alpaca Trading MCP Server

alpaca-mcp-server-mardiantos•bymardiantos

A Model Context Protocol server implementation for Alpaca trading that lets LLMs interact with Alpaca's trading API.

License: MIT License•Runtime: Awaiting documentation review•Category: finance crypto

WHAT IT DOES

  • •Provides account management for viewing account information and portfolio summaries.
  • •Exposes market data resources such as real-time quotes and historical price bars for symbols.
  • •Offers trading tools to place market and limit orders and cancel existing orders.
  • •Tracks current positions and recent orders through resources.

BEST FOR

  • •Checking portfolio balance and account information through an LLM client.
  • •Placing buy or sell limit and market orders via natural language prompts.
  • •Cancelling existing orders or reviewing recent orders and positions.

ABOUT ALPACA-MCP-SERVER-MARDIANTOS

Alpaca Trading MCP Server is cataloged as an MCP server attributed to mardiantos. A Model Context Protocol server implementation for Alpaca trading that lets LLMs interact with Alpaca's trading API. It is categorized under finance crypto. See the capability inspector for recorded interfaces and their independent review status; consult upstream documentation for the current interface.

HOW TO INSTALL

Installation configuration is not reviewed. No executable setup is offered for this entry; inspect the source repository before proceeding.

LICENSE

Catalog license label: MIT License. Check the source repository's current license and terms before using, modifying or distributing this software.

Capability inspector

Capability definitions are not reviewed. Unreviewed imports are not exposed as trusted interfaces.

Tools (0)

No reviewed records to display. This does not establish that upstream lacks this capability.

Resources (0)

No reviewed records to display. This does not establish that upstream lacks this capability.

Prompts (0)

No reviewed records to display. This does not establish that upstream lacks this capability.

NEWSLETTER - COMING LATER

Newsletter subscriptions are not open yet

Email delivery is not connected. This page does not collect email addresses or create subscriptions.

Browse the registry for current listings instead.

Community Reviews

Coming later

Reviews for Alpaca Trading MCP Server are not available yet

Review publishing and storage are not connected. This page does not collect or publish ratings or comments, including after sign-in.

FREQUENTLY ASKED QUESTIONS

Does the server use paper trading by default?

Yes, the server uses paper trading by default when ALPACA_PAPER is set to TRUE.

Upstream README

View this exact version on GitHub

README.md · 7a81021defec · Fetched 2026-11-13 11:19:22 UTC

Original upstream text, without AI rewriting. Scripts, forms and unsafe links are filtered for safety.

Showing the last retrieved documentation snapshot; check the source for current changes.

Alpaca Trading MCP Server

Python implementation of the Model Context Protocol (MCP) Server for Alpaca Trading

MIT licensed

A Model Context Protocol (MCP) server implementation for Alpaca trading that enables Large Language Models (LLMs) like Anthropic Claude to interact with Alpaca's trading API. The instructions and commands provided in this README are primarily for MacOS/Linux users.

Alpaca MCP Server Demo with Claude Desktop

Demo showing the Claude for Desktop app on the left side and the Alpaca web console on the right side to verify the operations.

Introduction

Model Context Protocol (MCP)

Model Context Protocol (MCP) is an open protocol developed by Anthropic that standardizes how applications provide context to LLMs. Think of MCP like a USB-C port for AI applications. Just as USB-C provides a standardized way to connect your devices to various peripherals and accessories, MCP provides a standardized way to connect AI models to different data sources and tools.

Alpaca

Alpaca is a modern brokerage platform that provides access to the financial markets through developer-friendly APIs. By using Alpaca API, businesses build investing applications and features for their services. Also, programmatic traders can develop algorithms to automate trading strategies.

Disclaimer

IMPORTANT: This software is provided "as is", without warranty of any kind. By using this code, you acknowledge that trading involves substantial risk, and the author is not responsible for any financial losses incurred through the use of this software. The user assumes all responsibility for trading decisions made using this implementation. Always use paper trading for testing before considering live trading with real money.

References

Features

  • Account Management: View account information and portfolio summary
  • Market Data: Access real-time quotes and historical price bars
  • Trading Operations: Place market and limit orders
  • Position Tracking: Monitor current positions and recent orders

Pre-requisites

  • uv (Python package and project manager) Installation command:
    curl -LsSf https://astral.sh/uv/install.sh | sh
    
  • [Optional] Claude for Desktop (Claude client app for testing)

Installation

  1. Clone this repository

    git clone https://github.com/MardiantoS/alpaca-mcp-server.git
    cd alpaca-mcp-server
    
  2. [Optional but Recommended] Create and activate a virtual environment:

    uv venv
    source .venv/bin/activate
    
  3. Install dependencies. uv reads the uv.lock file and install the specified versions of all dependencies

    uv sync
    
  4. Create a .env file in the project root with your Alpaca credentials:

    ALPACA_API_KEY=your_api_key
    ALPACA_API_SECRET=your_api_secret
    ALPACA_PAPER=TRUE
    

    Note: Alpaca API keys can be acquired in the Alpaca developer web console. Check Alpaca documentation for reference.

Usage (Testing your Alpaca MCP Server with Claude for Desktop)

Make sure you have Claude for Desktop installed.

  1. In your Claude for Desktop, go to Settings (this is the Setting from the menu bar, not the one within the app), then go to Developer tab, click "Edit Config". This will locate the claude_desktop_config.json file.

    Alternatively, you can locate it at ~/Library/Application Support/Claude/claude_desktop_config.json (or refer to MCP documentation site if the file location has changed)

  2. Add the server in the mcpServers key.

    {
        "mcpServers": {
            "alpaca": {
                "command": "/ABSOLUTE/PATH/TO/uv",
                "args": [
                    "--directory",
                    "/ABSOLUTE/PATH/TO/PARENT/FOLDER/alpaca-mcp-server",
                    "run",
                    "alpaca_mcp_server.py"
                ]
            }
        }
    }
    

    Note: Make sure to replace the absolute paths of uv and alpaca-mcp-server directory with the actual path on your machine. Hint: run which uv to show your absolute uv path.

  3. Re-launch your Claude for Desktop if it's already launched. Click on the hammer icon to verify the available MCP tools. Here are some queries you could try:

    • "What's my current Alpaca portfolio balance?"
    • "Place a buy limit order for 10 shares of JPMorgan Chase at $238."
    • "Buy 1 share of GOOGL at market price."
    • "Place a sell limit order for 1 share of AAPL at $210."
    • "Cancel my sell limit order for AAPL." Note: If prompted, allow the tool access to run.

Available Resources

  • account://info - Get account information
  • positions://all - Get all current positions
  • market://quote/{symbol} - Get latest quote for a symbol
  • market://bars/{symbol} - Get historical bars for a symbol (last 7 days)
  • orders://recent - Get recent orders (last 7 days)

Note: Real-time market data features like quotes and historical bars might only be fully accessible with a Live trading account, depending on your Alpaca subscription level.

Available Tools

  • place_market_order(symbol, side, qty) - Place a market order
  • place_limit_order(symbol, side, qty, limit_price) - Place a limit order
  • cancel_order(order_id) - Cancel an existing order
  • get_portfolio_summary() - Get a summary of the current portfolio

Safety Features

  • Uses paper trading by default (ALPACA_PAPER=TRUE)
  • Proper error handling and logging
  • Graceful startup and shutdown with contextlib

License

This project is licensed under the MIT License - see the LICENSE file for details.

Citation

If you use this work in your research or project, please use the following citation:

Mardianto Hadiputro. (2025). Alpaca Trading MCP Server. GitHub. https://github.com/MardiantoS/alpaca-mcp-server

Install configuration

Are you the maintainer?

Claim this server with your GitHub account to request manual ownership verification.

README Embed Badge
Markdown

Link to the catalog listing for Alpaca Trading MCP Server from your README. This badge does not certify ownership, compatibility or security.

[![MCP catalog listing](https://img.shields.io/badge/MCP-awesome--mcp-orange?style=flat-square)](https://awesome-mcp.com/servers/alpaca-mcp-server-mardiantos)

REPOSITORY STATS

GitHub StarsUnavailable
ForksUnavailable

Public repository statistics could not be verified. Check the configured source address; unavailable counts are not zero.

Downloads and pulls

Separate sources, scopes and periods. Never combined or treated as installations, active users or security reviews.

No reviewed package or image identity; download statistics are not listed yet.

Related finance crypto MCP Servers

Alternative and complementary servers in the same category

View all in finance crypto →
USA Spending MCP Server
usaspending-mcp-server•thsmale

A stateless streamable HTTP MCP server for interacting with the official source of government spending data.

Repository stats unavailable
Finance & Analytics
Fortnox MCP server — More AI
more-ai-chatgpt-claude-mcp-fortnox•amor3

A hosted, remote MCP server for Fortnox that lets AI assistants answer questions from a company's bookkeeping and propose changes for approval before writing them.

0
Finance & Analytics

OptimistFi is a read-only remote MCP server that provides perpetual futures market data, perps prop firm rules and pricing, and US equity investment research.

Repository stats unavailable
Finance & Analytics