Alpaca Trading MCP Server
羊驼交易 MCP 服务器
模型上下文协议 (MCP) 服务器提供 Alpaca 交易 API 的接口,允许您管理股票和加密货币投资组合、进行交易和访问市场数据。
特征
账户管理:查看账户详情、余额和投资组合状态
交易:下达市价单、限价单、止损单和止损限价单
投资组合管理:查看仓位、计算业绩、平仓
市场数据:获取实时报价和历史价格数据
资产信息:获取可交易资产的详细信息
Related MCP server: Alpaca MCP Server
安装
克隆此存储库
安装依赖项:
pip install -e .或者使用 uv:
uv pip install -e .配置
将
.env.example文件复制到.env:
cp .env.example .env将您的 Alpaca Paper Trading API 凭证添加到
.env文件:
ALPACA_PAPER_API_KEY = "your-api-key"
ALPACA_PAPER_API_SECRET = "your-api-secret"您可以通过在Alpaca创建帐户来获取这些凭证。
用法
运行 MCP 服务器:
python src/server.py服务器将启动并可供 MCP 客户端连接。
可用资源
服务器提供以下资源:
account://info- 获取当前帐户信息positions://all- 获取所有当前职位positions://{symbol}- 获取特定符号的位置详情orders://recent/{limit}- 获取指定限制的最近订单market://{symbol}/quote- 获取特定符号的当前市场报价market://{symbol}/bars/{timeframe}- 获取指定时间范围内符号的历史价格条assets://list- 列出 Alpaca 上可交易的资产assets://{symbol}- 按符号获取详细资产信息
可用工具
该服务器提供以下工具:
get_account_info_tool- 获取当前帐户信息place_market_order- 下达市价单来买入或卖出股票place_limit_order- 下达限价单以指定价格买入或卖出股票place_stop_order- 当股票达到指定价格时,下达买入或卖出的止损订单place_stop_limit_order- 结合止损和限价订单功能,下达止损限价订单cancel_order- 根据订单 ID 取消未结订单close_position- 关闭特定符号的未平仓头寸get_portfolio_summary- 获取投资组合的综合摘要
Available Tools
8 toolscancel_orderB
Cancel an open order by its ID.
Args: order_id: ID of the order to cancel
Returns: Confirmation of cancellation
Inputs: order_id (required).
close_positionC
Close an open position for a specific symbol.
Args: symbol: Stock symbol to close position for
Returns: Confirmation of position closure
Inputs: symbol (required).
get_account_info_toolB
Get current account information.
Returns: Account summary with balance and status
Inputs: no named parameters.
get_portfolio_summaryB
Get a comprehensive summary of the portfolio including account details and open positions.
Returns: Portfolio summary with account and positions information
Inputs: no named parameters.
place_limit_orderB
Place a limit order to buy or sell a stock at a specified price.
Args: symbol: Stock symbol (e.g., 'AAPL') quantity: Number of shares to buy or sell (can be fractional) side: Either 'buy' or 'sell' limit_price: Maximum price for buy or minimum price for sell time_in_force: Order duration - 'day', 'gtc' (good till canceled), 'ioc' (immediate or cancel)
Returns: Order confirmation details
Inputs: symbol (required), quantity (required), side (required), limit_price (required), +1 more.
place_market_orderB
Place a market order to buy or sell a stock.
Args: symbol: Stock symbol (e.g., 'AAPL') quantity: Number of shares to buy or sell (can be fractional) side: Either 'buy' or 'sell'
Returns: Order confirmation details
Inputs: symbol (required), quantity (required), side (required).
place_stop_limit_orderA
Place a stop-limit order combining stop and limit order features.
Args: symbol: Stock symbol (e.g., 'AAPL') quantity: Number of shares to buy or sell (can be fractional) side: Either 'buy' or 'sell' stop_price: Price that triggers the order limit_price: Maximum/minimum price for the triggered order time_in_force: Order duration - 'day', 'gtc' (good till canceled)
Returns: Order confirmation details
Inputs: symbol (required), quantity (required), side (required), stop_price (required), +2 more.
place_stop_orderA
Place a stop order to buy or sell a stock when it reaches a specified price.
Args: symbol: Stock symbol (e.g., 'AAPL') quantity: Number of shares to buy or sell (can be fractional) side: Either 'buy' or 'sell' stop_price: Price that triggers the order time_in_force: Order duration - 'day', 'gtc' (good till canceled)
Returns: Order confirmation details
Inputs: symbol (required), quantity (required), side (required), stop_price (required), +1 more.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 8 tools
Each tool has a clearly distinct purpose with no ambiguity. Order placement tools (market, limit, stop, stop-limit) are well-differentiated by order type, while account/portfolio tools and order/position management tools serve separate functions. An agent can easily distinguish between them based on their specific actions.
Most tools follow a consistent verb_noun pattern (e.g., cancel_order, close_position, place_market_order). However, get_account_info_tool deviates slightly with the '_tool' suffix, breaking perfect consistency. The naming is otherwise predictable and readable across the set.
With 8 tools, this server is well-scoped for trading operations. It covers essential functions like order placement (4 tools), order cancellation, position management, and account/portfolio queries. Each tool earns its place without being overly sparse or bloated for the domain.
The toolset provides strong coverage for core trading workflows: placing various order types, managing orders and positions, and viewing account/portfolio data. A minor gap exists in the lack of tools for modifying existing orders or retrieving specific order details, but agents can work around this with the available tools.
Maintenance
Related MCP Connectors
Trading MCP server for AI agents, with live market data, account reads and controlled execution.
Financial data MCP server for Claude, ChatGPT, Cursor and Codex. Real-time stock quotes, financial statements, options flow, SEC filings, insider trades, 13F holdings, macro data and market news from gloom.sh, the open-source Bloomberg Terminal alternative.
A comprehensive Model Context Protocol (MCP) server that enables AI assistants to interact with yo…
MCP server for OpenMM — exposes market data, account, trading, and strategy tools to AI agents
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceA Model Context Protocol server enabling LLMs like Claude to interact with the Alpaca trading API through natural language for stock trading, checking positions, fetching market data, and managing your account.28MIT
- AlicenseNot gradedqualityDmaintenanceA Model Context Protocol server that enables LLMs like Claude to interact with the Alpaca trading API, allowing for trading stocks, checking positions, fetching market data, and managing accounts through natural language.3MIT
- AlicenseNot gradedqualityDmaintenanceAn MCP server implementation for Alpaca's Trading API that enables LLMs to interact with Alpaca's trading infrastructure using natural language, supporting stock, options, and crypto trading, portfolio management, watchlists, and market data.4MIT

NINX MCP Serverofficial
AlicenseNot gradedqualityDmaintenanceA Model Context Protocol (MCP) server that provides financial trading tools and market analysis capabilities, enabling AI assistants to access real-time market data, execute trades, analyze portfolios, and perform comprehensive financial analysis.MIT