alpacatrader-mcp-gateway
A Model Context Protocol (MCP) bridge facilitating interaction with the Alpaca financial API suite for comprehensive stock and cryptocurrency asset management, trade execution, and real-time market intelligence retrieval.
Author

laukikk
Quick Info
Actions
Tags
Alpaca Trading MCP Server
This specialized Model Context Protocol (MCP) service layer furnishes a programmatic conduit to the robust Alpaca financial platform, enabling sophisticated oversight of equity and digital currency holdings, precise order placement, and access to dynamic market intelligence.
Core Capabilities
- Account Oversight: Retrieve comprehensive account specifications, current financial standing, and aggregated portfolio metrics.
- Transaction Execution: Initiate and manage orders, including market, limit, stop, and stop-limit instructions across supported instruments.
- Portfolio Stewardship: Monitor existing asset allocations, calculate realized and unrealized performance metrics, and liquidate specific holdings.
- Market Data Feeds: Consume instantaneous price quotations and historical time-series data for trend analysis.
- Instrument Identification: Query metadata pertaining to all assets permissible for trading via the Alpaca infrastructure.
Deployment Protocols
Automated Provisioning via Smithery
For seamless integration with Claude Desktop environments using Smithery, execute the following command:
bash npx -y @smithery/cli install @laukikk/alpaca-mcp --client claude
Manual Software Installation
- Obtain a local copy of the source repository:
bash
git clone
- Install required Python dependencies using standard tools:
bash pip install -e .
Alternatively, employ the uv dependency manager for potentially faster resolution:
bash uv pip install -e .
Configuration Directives
- Replicate the example environment file to establish local configuration:
bash cp .env.example .env
- Populate the
.envfile with your designated Alpaca Paper Trading access credentials:
ALPACA_PAPER_API_KEY = "your-api-key" ALPACA_PAPER_API_SECRET = "your-api-secret"
Credentials can be generated by registering on the Alpaca platform.
Service Initiation
To launch the MCP infrastructure layer:
bash python src/server.py
The process will initialize, establishing a listening socket ready for connection requests from compatible MCP clients.
Testing & Integration with Claude Desktop
Client Configuration Steps:
Locate and open the configuration file for your Claude Desktop application in a suitable editor. If absent, this step involves creation.
- Windows OS Path:
%APPDATA%\Claude\claude_desktop_config.json - macOS Path:
~/Library/Application\ Support/Claude/claude_desktop_config.json
Integrate the Alpaca MCP gateway definition into the mcpServers object:
{ "mcpServers": { "alpaca": { "command": "uv", "args": [ "--directory", "/ABSOLUTE/PATH/TO/PARENT/FOLDER/alpaca-mcp-server", "run", "src/server.py" ] } } }
For further developer guidance, consult the MCP For Server Developers: Quickstart.
Accessible Data Endpoints
The server exposes the following structured data interfaces:
account://info- Fetch current operational account metadata.positions://all- Retrieve documentation for every open holding.positions://{symbol}- Access specific details pertaining to a single asset position.orders://recent/{limit}- Query the specified quantity of the most recently executed transactions.market://{symbol}/quote- Obtain the instantaneous bid/ask quote for a specified instrument.market://{symbol}/bars/{timeframe}- Request time-series price aggregates based on the designated interval.assets://list- Obtain a comprehensive catalogue of all tradable securities.assets://{symbol}- Retrieve exhaustive descriptive information for an asset identifier.
Available Operational Functions (Tools)
The following functional tools are exposed for external invocation:
get_account_info_tool- Retrieve the latest comprehensive account summary.place_market_order- Execute an immediate buy or sell instruction for a security.place_limit_order- Submit a conditional transaction to execute only at or better than a defined price point.place_stop_order- Initiate an order contingent upon reaching a specified trigger price.place_stop_limit_order- Combine stop-trigger functionality with a specific limit price constraint.cancel_order- Revoke a pending order using its unique identifier.close_position- Liquidate all shares associated with a particular symbol position.get_portfolio_summary- Generate an aggregated, high-level analysis of the entire investment portfolio.
