Alpaca
The Alpaca MCP Server is an MCP server implementation that connects Claude Desktop, Cursor, and VSCode directly to Alpaca’s trading infrastructure.
This server enables traders to interact with financial markets by letting large language models execute trades, analyze portfolios, and manage investments through natural language.
Features
- 📊 Real-time Market Data – Live quotes, trades, price bars, and historical data for stocks and options
- 💰 Account Management – View balances, buying power, positions, and account status
- 📈 Position Tracking – Monitor holdings with detailed position information and liquidation controls
- 🛒 Order Execution – Place market and limit orders for stocks and options with full order management
- 🎯 Options Trading – Multi-leg strategies, Greeks analysis, and contract searching
- 📅 Market Intelligence – Trading calendars, corporate actions, earnings announcements
- 📋 Watchlist Management – Create and manage multiple asset tracking lists
- 🔍 Asset Discovery – Search and filter tradeable instruments across markets
Use Cases
- Portfolio Managers analyzing positions and executing trades through conversational commands instead of clicking through multiple trading interfaces
- Options Traders building complex strategies like spreads and straddles using natural language descriptions rather than manual contract selection
- Algorithmic Developers prototyping trading strategies by describing logic to Claude before implementing automated systems
- Financial Analysts gathering market data and corporate information for research without switching between data terminals
How to Use It
1. You need Python 3.10+, Alpaca API keys (paper or live trading), and Claude Desktop or another MCP-compatible client.
2. Clone and Setup
git clone https://github.com/YOUR_USERNAME/alpaca-mcp-server.git
cd alpaca-mcp-server
pip install mcp alpaca-py python-dotenv3. Create a .env file in the project directory and insert your Alpaca API key.
ALPACA_API_KEY = "your_alpaca_api_key_for_paper_account"
ALPACA_SECRET_KEY = "your_alpaca_secret_key_for_paper_account"4. Start the Server
python alpaca_mcp_server.py4. config your claude_desktop_config.json:
{
"mcpServers": {
"alpaca": {
"command": "python",
"args": ["/path/to/alpaca_mcp_server.py"],
"env": {
"ALPACA_API_KEY": "your_alpaca_api_key_for_paper_account",
"ALPACA_SECRET_KEY": "your_alpaca_secret_key_for_paper_account"
}
}
}
}Available API Methods
Account & Position Management
get_account_info()– Account balance and statusget_positions()– All current holdingsget_open_position(symbol)– Specific position detailsclose_position(symbol, qty|percentage)– Partial or full liquidationclose_all_positions(cancel_orders)– Complete portfolio liquidation
Stock Trading
get_stock_quote(symbol)– Real-time bid/askget_stock_bars(symbol, start_date, end_date)– Historical OHLCV dataplace_stock_order()– Market, limit, stop, and trailing ordersget_orders(status, limit)– Order history and filteringcancel_order_by_id(order_id)– Individual order cancellation
Options Trading
get_option_contracts(underlying_symbol, expiration_date)– Contract discoveryget_option_latest_quote(option_symbol)– Live option pricingget_option_snapshot(symbol)– Greeks and volatility dataplace_option_market_order(legs, order_class, quantity)– Multi-leg strategies
Market Data & Events
get_market_clock()– Trading session statusget_market_calendar(start, end)– Holiday schedulesget_corporate_announcements()– Earnings, dividends, splits
Live Trading Configuration
For real money trading, update both your .env file and Claude configuration with live account credentials:
ALPACA_API_KEY = "your_alpaca_api_key_for_live_account"
ALPACA_SECRET_KEY = "your_alpaca_secret_key_for_live_account"
PAPER = FalseFAQs
Q: Can I use this with a paper trading account first?
A: Yes, the server defaults to paper trading mode for safe testing. You can practice all trading functions without risking real money before switching to live trading.
Q: What types of orders does the server support?
A: The server handles market orders, limit orders, stop orders, stop-limit orders, and trailing stop orders for both stocks and options. It also supports complex multi-leg option strategies.
Q: How do I access real-time market data?
A: Real-time quotes and trades are available through natural language queries like “What’s the current price of AAPL?” The server returns live bid/ask spreads, last trade prices, and volume data.
Q: Can I manage multiple watchlists through Claude?
A: Yes, you can create, update, and view multiple named watchlists. Commands like “Create a tech watchlist with AAPL, MSFT, NVDA” work directly through conversation.
Q: Is options trading fully supported?
A: The server provides complete options functionality including contract searching, Greeks analysis, quote retrieval, and execution of complex strategies like spreads and straddles through natural language descriptions.
Q: How secure is my trading account information?
A: API keys are stored locally in your configuration files and transmitted directly to Alpaca’s servers. The MCP server acts as a secure bridge without storing sensitive data, but you should treat your API credentials as highly sensitive information.
Latest MCP Servers
CVE
WebMCP
webmcp is an MCP server that connects MCP clients to web search, page fetching, and local LLM-based extraction. It’s ideal…
Google Meta Ads GA4
Featured MCP Servers
Notion
Claude Peers
Excalidraw
FAQs
Q: What exactly is the Model Context Protocol (MCP)?
A: MCP is an open standard, like a common language, that lets AI applications (clients) and external data sources or tools (servers) talk to each other. It helps AI models get the context (data, instructions, tools) they need from outside systems to give more accurate and relevant responses. Think of it as a universal adapter for AI connections.
Q: How is MCP different from OpenAI's function calling or plugins?
A: While OpenAI's tools allow models to use specific external functions, MCP is a broader, open standard. It covers not just tool use, but also providing structured data (Resources) and instruction templates (Prompts) as context. Being an open standard means it's not tied to one company's models or platform. OpenAI has even started adopting MCP in its Agents SDK.
Q: Can I use MCP with frameworks like LangChain?
A: Yes, MCP is designed to complement frameworks like LangChain or LlamaIndex. Instead of relying solely on custom connectors within these frameworks, you can use MCP as a standardized bridge to connect to various tools and data sources. There's potential for interoperability, like converting MCP tools into LangChain tools.
Q: Why was MCP created? What problem does it solve?
A: It was created because large language models often lack real-time information and connecting them to external data/tools required custom, complex integrations for each pair. MCP solves this by providing a standard way to connect, reducing development time, complexity, and cost, and enabling better interoperability between different AI models and tools.
Q: Is MCP secure? What are the main risks?
A: Security is a major consideration. While MCP includes principles like user consent and control, risks exist. These include potential server compromises leading to token theft, indirect prompt injection attacks, excessive permissions, context data leakage, session hijacking, and vulnerabilities in server implementations. Implementing robust security measures like OAuth 2.1, TLS, strict permissions, and monitoring is crucial.
Q: Who is behind MCP?
A: MCP was initially developed and open-sourced by Anthropic. However, it's an open standard with active contributions from the community, including companies like Microsoft and VMware Tanzu who maintain official SDKs.



