AlpacaSAFE
Model Context Protocol (MCP) server for Alpaca trading API
Overview
From the repository's own README, as read at the audited commit. Badges and raw HTML are left out.
This is a Model Context Protocol (MCP) server for Alpaca, allowing LLMs like Claude to interact with the Alpaca trading API. It enables trading stocks, checking positions, fetching market data, and managing your account - all through natural language.
Features
- 📊 Market Data - Get real-time stock quotes and historical price data
- 💵 Account Information - Check your balances, buying power, and status
- 📈 Position Management - View current positions and their performance
- 🛒 Order Placement - Place market and limit orders through natural language
- 📋 Order Management - List, track, and cancel orders
Prerequisites
- Python 3.10+
- Alpaca API keys
- Claude for Desktop or another MCP client
Installation
- Clone this repository:
git clone https://github.com/YOUR_USERNAME/alpaca-mcp.git cd alpaca-mcp
- Install the required packages:
pip install mcp alpaca-py python-dotenv
- Create a
.envfile with your Alpaca API credentials:
API_KEY_ID=your_alpaca_api_key API_SECRET_KEY=your_alpaca_secret_key
Usage
Running the server
Start the server by running:
python alpaca_mcp_server.py
Configuring Claude for Desktop
- Open Claude for Desktop
- Go to Settings
- Click on "Developer" and then "Edit Config"
- Add the server configuration to
claude_desktop_config.json:
{
"mcpServers": {
"alpaca": {
"command": "python",
"args": [
"/path/to/alpaca_mcp_server.py"
],
"env": {
"API_KEY_ID": "your_alpaca_api_key",
"API_SECRET_KEY": "your_alpaca_secret_key"
}
}
}
}- Save and restart Claude for Desktop
Available Tools
The server exposes the following tools:
get_account_info()- Get account balances and statusget_positions()- List all current positions in the portfolioget_stock_quote(symbol)- Get the latest quote for a stock- `get_st
267e214716b4OBSERVED · 2026-10-08Exposed tools (9)
7 read · 2 write · 0 destructive.
| Tool | Risk | Description |
|---|---|---|
cancel_all_orders | read | Cancel all open orders. |
close_all_positions | read | |
get_account_info | read | Get the current account information including balances and status. |
get_orders | read | |
get_positions | read | Get all current positions in the portfolio. |
get_stock_bars | read | |
get_stock_quote | read | |
place_limit_order | write | |
place_market_order | write |
Trust audit
SAFEgrade B · trust 89/100 Nothing in the source contradicts what it says it does. Grade A is reserved for packages that have also passed the behavioural sandbox.
| Layer | What it checks | Result |
|---|---|---|
| L0 | Provenance & inventory | PASS |
| L1 | Static analysis of the code | PASS |
| L2 | Instruction surface (what it tells the agent) | PASS |
| L3 | Class-specific surface | PASS |
| L4 | Behavioural (sandbox) | SKIPPED |
What the source does
- Filesystem
- none-observed
- Network
- none-observed
- Shell
- none-observed
- Dependencies
- not all pinned
- Secrets in source
- none-found
Findings (1)
mcp, alpaca-py, python-dotenv
Gates applied: no_behavioural_pass.
267e214716b4full audit observations/trust-audit/mcp-server/tedlikeskix__alpaca.json · Report an issue / request a re-scanAudit history
Every audit this server has had. A grade with a past is a grade somebody is still checking.
| Date | Source | Verdict | Grade | Score | Change |
|---|---|---|---|---|---|
| 2026-10-08 | 267e214716b4 | SAFE | B | 89 | first audit |
Questions
What is the Alpaca MCP server?
Model Context Protocol (MCP) server for Alpaca trading API
What tools does Alpaca expose?
9 in total: 7 read-only, 2 that write, and 0 that can delete or overwrite. Every one is listed on this page with its risk.
Is Alpaca safe to connect to an agent?
The audit found nothing in the source that contradicts what it says it does, and graded it B (89/100). Grade A is held back for packages that have also passed a sandboxed behavioural run, which is why a clean server reads B.
What credentials does Alpaca need?
It reads API_KEY_ID and API_SECRET_KEY from the environment. Give it a token scoped to the least it needs — an agent that can be talked into calling a tool can be talked into calling it with your credentials.
How does Alpaca run?
It speaks stdio, so it runs as a local process your client starts.
How current is this page?
The grade is for one exact copy of the source (267e214716b4), read on 2026-10-08. The repository is watched and re-audited when it changes.