logo
Free, unlimited AI code reviews that run on commit
git-lrc git-lrc GitHub Install Now We'd appreciate a star git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt

alpaca-gateway-mcp

Facilitates interaction with the Alpaca financial platform's API for comprehensive management of equities and cryptocurrency holdings, trade execution, and retrieval of market intelligence.

Author

alpaca-gateway-mcp logo

laukikk

MIT License

Quick Info

GitHub GitHub Stars 30
NPM Weekly Downloads 0
Tools 1
Last Updated 2026-02-19

Tags

apiapisrequeststrading apiapis httpalpaca trading

Alpaca Trading MCP Gateway Service

Smithery Integration Badge

This Model Context Protocol (MCP) service acts as a robust conduit to the Alpaca brokerage API. It empowers external systems to oversee stock and crypto investment portfolios, submit various trade instructions, and query up-to-the-minute market data feeds.

Core Capabilities

  • Account Oversight: Retrieval of account statements, current valuation figures, and overall portfolio standing.
  • Transaction Execution: Capability to dispatch market, limit, stop, and stop-limit trading instructions.
  • Position Administration: Functions for inspecting current asset holdings, calculating realized/unrealized gains/losses, and liquidating specific positions.
  • Data Acquisition: Access to live market quotes and historical time-series price data.
  • Security Metadata: Fetching detailed specifications for all assets supported by the platform.

Deployment Instructions

Automated Setup via Smithery

To seamlessly integrate the Alpaca Trading MCP Gateway Service into your Claude Desktop environment using Smithery:

bash npx -y @smithery/cli install @laukikk/alpaca-mcp --client claude

Manual Installation Procedure

  1. Obtain the source code repository:

bash git clone cd alpaca-mcp-server

  1. Install required Python dependencies:

Using setuptools:

bash pip install -e .

Alternatively, using the uv dependency manager:

bash uv pip install -e .

Initialization and Credentials

  1. Establish the runtime configuration file by duplicating the template:

bash cp .env.example .env

  1. Populate the .env file with your Alpaca Paper Trading access keys:

ALPACA_PAPER_API_KEY = "your-secure-api-key" ALPACA_PAPER_API_SECRET = "your-secret-access-token"

Credentials can be generated by registering an account on the Alpaca platform: Alpaca Registration Link.

Service Startup

Execute the main server script to bring the service online:

bash python src/server.py

The service will initialize and advertise itself for connection by MCP-enabled clients.

Integration with Claude for Desktop

To enable Claude Desktop to locate and utilize this gateway, modify its configuration file. Create the file if it is absent:

  • Windows Path: %APPDATA%\Claude\claude_desktop_config.json
  • macOS Path: ~/Library/Application\ Support/Claude/claude_desktop_config.json

Append the Alpaca MCP service configuration block:

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

For server development guidance, consult the official documentation: MCP Server Quickstart

Exposed Endpoint Schemas (Resources)

The server exposes the following primary URI endpoints:

  • account://info - Fetches the currently active account metadata.
  • positions://all - Retrieves all open asset positions.
  • positions://{symbol} - Details for a position pertaining to a specific ticker symbol.
  • orders://recent/{limit} - Retrieves the specified count of the most recent transaction records.
  • market://{symbol}/quote - Queries the live trading bid/ask quote for a symbol.
  • market://{symbol}/bars/{timeframe} - Requests historical candlestick data series for a symbol based on the given resolution.
  • assets://list - Enumerates all securities eligible for trading.
  • assets://{symbol} - Provides in-depth descriptive information for a given security identifier.

Available Operational Functions (Tools)

The service makes the following functions available to clients:

  • get_account_info_tool - Retrieve essential account metrics.
  • place_market_order - Submit an immediate-execution order (buy/sell).
  • place_limit_order - Submit an order executable only at or better than a specified price.
  • place_stop_order - Submit an order contingent on a stock reaching a specific trigger price.
  • place_stop_limit_order - Submit an order that combines stop activation with limit execution constraints.
  • cancel_order - Invalidate a pending order using its unique identifier.
  • close_position - Initiate a transaction to zero-out a current holding for a symbol.
  • get_portfolio_summary - Obtain an aggregate performance overview of the entire portfolio.

See Also

`