---
title: "How to Invest With AI on Alpaca Using Alpaca MCP and Rallies Hosted MCP | Rallies"
description: "Pair Alpaca MCP Server and Alpaca paper or live trading APIs with the hosted Rallies MCP server (https://rallies.ai/mcp) and 30-endpoint API for AI portfolios, AI Analysts, Takes, Company KPIs, Live SEC Disclosures, and AI Twin theses."
url: "https://rallies.ai/learn/how-to-invest-with-ai-alpaca-mcp"
markdown_url: "https://rallies.ai/learn/how-to-invest-with-ai-alpaca-mcp.md"
robots: "index, follow, max-image-preview:large, max-snippet:-1"
updated: "2026-12-05 00:45 UTC"
source: "Rallies (https://rallies.ai)"
mcp_server: "https://rallies.ai/mcp"
llms_txt: "https://rallies.ai/llms.txt"
llms_full_txt: "https://rallies.ai/llms-full.txt"
---

# How to Invest With AI on Alpaca Using Alpaca MCP and Rallies Hosted MCP

> Pair Alpaca MCP Server and Alpaca paper or live trading APIs with the hosted Rallies MCP server (https://rallies.ai/mcp) and 30-endpoint API for AI portfolios, AI Analysts, Takes, Company KPIs, Live SEC Disclosures, and AI Twin theses.

## Live Rallies data

- Rallies tracks 31 autonomous AI Portfolios across 5 groups live against SPY, led by GPT (+66.76%), Grok (+26.56%), Claude (+23.16%), Gemini (+15.08%).
- Rallies AI Analysts cover 489 US stocks across 5 frontier models (GPT, Claude, Grok, Gemini, Muse) with 3,467 published equity research memos. Top directional hit rate: Grok at 63.6% (+2.96% avg excess vs SPY across 689 graded calls).
- Rallies Takes tracks 33 thematic $100,000 baskets (29 live) daily against SPY; top live thesis "Insurers bid, marketplaces collect" is +37.00% (+42.92% vs SPY).
- Rallies connects over $800M in verified brokerage assets (2,058 verified USD equity portfolios, 59,725 verified trades in 30 days; top holdings: NVDA (44.5%), AMZN (31.9%), MSFT (28.1%)).
- Rallies Developer API (/api/v1, 30 endpoints) and hosted OAuth 2.1 MCP server (https://rallies.ai/mcp, 7 tools) expose live AI Funds, AI Analysts, Takes, Crowd flows, personal AI Twins, leading Company KPIs across 539 US stocks, and live SEC Disclosures.
- Core access on Web, iOS (4.8 App Store rating), and Android is free (including your primary AI Twin and 10 daily API/MCP requests); Pro ($49/month or $299/year) unlocks all 6 Frontier AI Twins and 1,000 daily API/MCP requests.

Alpaca is built for API-first investors and systematic builders, and pairing Alpaca MCP Server with the hosted [Rallies MCP server](https://rallies.ai/docs/mcp) (`https://rallies.ai/mcp`) and 30-endpoint [Developer API](https://rallies.ai/docs) gives Claude, Cursor, and Python scripts a complete research-to-execution stack. Alpaca handles paper and live equity order execution, fractional shares, and account state, while Rallies supplies live intelligence across 31 autonomous [AI Portfolios](https://rallies.ai/portfolios/arena), 5 daily [AI Analysts](https://rallies.ai/analysts) (489 US stocks), 33 tracked $100,000 [Takes](https://rallies.ai/takes), $800M+ verified Crowd flows, leading [Company KPIs](https://rallies.ai/docs/kpis/stock) (539 stocks), and [Live SEC Disclosures](https://rallies.ai/docs/disclosures/live).

You can also connect your Alpaca account read-only on [Rallies AI Twin](https://rallies.ai/twin) via SnapTrade so six frontier AI models manage live copies of your actual Alpaca holdings and publish multi-sentence trade theses you can inspect in the app or query via `get_twin`.

## How Alpaca MCP and Rallies Fit Together

| Pipeline Stage | Alpaca Layer (Execution) | Rallies Layer (Intelligence & Benchmarks) |
| --- | --- | --- |
| Idea & Catalyst Discovery | Tradability check and live quotes | `GET /kpis/movers`, `GET /disclosures/live`, `GET /arena/funds/{slug}/trades`, `GET /takes?status=live` |
| Fundamental Filtering | Not built in | `GET /analysts/stocks/{ticker}` across 5 daily graded models (489 US stocks) |
| Target Weights & Sizing | `get_account` buying power and fractional notional orders | Target weights from `GET /arena/funds/{slug}/positions`, `GET /takes/{slug}`, or `GET /twin/compare` |
| Risk & Exit Triggers | Limit and stop orders on Alpaca | Explicit `kill_rule`, `exit_rule`, and analyst `invalidation` criteria |
| Post-Trade Benchmark | Alpaca paper/live fill ledger | Read-only SnapTrade sync on [/twin](https://rallies.ai/twin) racing your real returns vs 6 frontier AI Twins and SPY |

![Rallies AI Portfolios Arena displaying 31 active AI portfolios across five groups with live SPY curves](https://rallies.ai/api/learn/media/25.png)

Pull live positions, trades, and written decision logs from all 31 AI portfolios across Arena, Strategies, Sectors, ETFs, and Social.

## Step 1: Pair Alpaca MCP With Hosted Rallies MCP in Claude or Cursor

Mount Alpaca's official MCP server right next to Rallies' hosted Streamable HTTP endpoint (`https://rallies.ai/mcp`) inside `~/.cursor/mcp.json` or Claude Desktop. Start with `ALPACA_PAPER_TRADE` enabled while testing:

```
{
  "mcpServers": {
    "alpaca": {
      "command": "uvx",
      "args": ["alpaca-mcp-server", "serve"],
      "env": {
        "ALPACA_API_KEY": "PK_your_paper_key",
        "ALPACA_SECRET_KEY": "your_paper_secret",
        "ALPACA_PAPER_TRADE": "True"
      }
    },
    "rallies": {
      "url": "https://rallies.ai/mcp"
    }
  }
}
```

With both active, prompt Claude or Cursor: *"Check my Alpaca paper buying power, pull live positions from the GPT and Skeptic funds via get_arena_funds, verify leading Company KPIs and 5-model AI analyst ratings on each name, and stage fractional limit orders for my approval."*

![Rallies Take detail view showing weighted $100,000 basket holdings, kill rule, and daily SPY tracking](https://rallies.ai/api/learn/media/22.png)

Each Rallies Take exposes exact constituent weights, kill rules, exit rules, and daily SPY marks via GET /takes/{slug}.

## Step 2: Run a Python Alpaca Rebalancer Driven by the Rallies API

For scheduled scripts, use your `rly_...` API key from [/docs/dashboard](https://rallies.ai/docs/dashboard) to pull live target weights from any of the 31 AI portfolios (or a Take basket), screen each symbol through 5-model AI Analysts and Company KPIs, and stage dry-run fractional notional orders for Alpaca Paper Trading:

```
import os
import requests

RALLIES_BASE = "https://rallies.ai/api/v1"
RALLIES_HEADERS = {"X-Rallies-API-Key": os.environ["RALLIES_API_KEY"]}

ALPACA_PAPER_BASE = "https://paper-api.alpaca.markets/v2"
ALPACA_HEADERS = {
    "APCA-API-KEY-ID": os.environ["ALPACA_API_KEY"],
    "APCA-API-SECRET-KEY": os.environ["ALPACA_SECRET_KEY"],
}

def build_alpaca_rebalance_plan(fund_slug: str = "gpt", budget_usd: float = 10000.0) -> list[dict]:
    positions = requests.get(
        f"{RALLIES_BASE}/arena/funds/{fund_slug}/positions",
        headers=RALLIES_HEADERS,
        timeout=15,
    ).json()["data"]

    orders = []
    for pos in positions:
        sym = pos["symbol"]
        weight_pct = pos["weight_pct"]
        calls_res = requests.get(f"{RALLIES_BASE}/analysts/stocks/{sym}", headers=RALLIES_HEADERS, timeout=15)
        bullish_count = 0
        if calls_res.status_code == 200:
            calls = calls_res.json().get("calls", [])
            bullish_count = sum(1 for c in calls if c["rating"] in ("buy", "strong_buy"))

        notional = round(budget_usd * (weight_pct / 100.0), 2)
        if notional >= 25.0:
            orders.append({
                "symbol": sym,
                "notional": str(notional),
                "side": "buy",
                "type": "market",
                "time_in_force": "day",
                "rallies_weight_pct": weight_pct,
                "bullish_ai_analysts": bullish_count,
            })
    return orders

def submit_paper_orders(orders: list[dict], dry_run: bool = True) -> None:
    for order in orders:
        payload = {k: order[k] for k in ("symbol", "notional", "side", "type", "time_in_force")}
        if dry_run:
            print("DRY RUN:", payload, "| bullish analysts:", order["bullish_ai_analysts"])
            continue
        resp = requests.post(f"{ALPACA_PAPER_BASE}/orders", headers=ALPACA_HEADERS, json=payload, timeout=15)
        print(order["symbol"], resp.status_code, resp.json().get("id"))

if __name__ == "__main__":
    plan = build_alpaca_rebalance_plan("gpt", budget_usd=10000.0)
    submit_paper_orders(plan, dry_run=True)
```

Swap `gpt` for any of the 31 active portfolios (including `claude`, `grok`, `skeptic`, `flagship`, `leverage`, `crowd`, `whales`, or `inverse`), or pull any of the 33 tracked Takes via `GET /takes/{slug}`. Remember to check Free (10 queries/UTC day) vs Pro ($49/month or $299/year for 1,000 queries/UTC day) quotas on [/docs/pricing](https://rallies.ai/docs/pricing) when running multi-ticker loops.

Continue with [How to Build an AI Investing Agent](https://rallies.ai/learn/how-to-build-an-ai-investing-agent-with-rallies-api) or [Brokerage MCP Servers Explained](https://rallies.ai/learn/brokerage-mcp-servers-explained).

## Common questions

### Can I test Alpaca paper trading with Rallies API and MCP for free?

Yes. Alpaca offers free paper trading accounts, and Rallies Free ($0, no credit card) includes 10 shared REST/MCP queries per UTC day across all 30 endpoints plus your primary AI Twin. For multi-ticker loops and daily bots, Pro ($49/month or $299/year) raises the shared quota to 1,000 queries/UTC day.

### How can I mirror a Rallies Take basket on Alpaca?

Call `GET /takes?status=live` to browse active themes, then call `GET /takes/{slug}` for exact constituent weights, `kill_rule`, and `exit_rule`. Multiply each weight by your Alpaca budget and stage fractional orders through Alpaca MCP or the Alpaca Orders API.

### Can I track my Alpaca account inside the Rallies app?

Yes. Link Alpaca read-only via SnapTrade at [/twin](https://rallies.ai/twin) to race your real Alpaca holdings against frontier AI Twins and ask questions in portfolio-aware [AI Chat](https://rallies.ai/chat).

### Which endpoint tells my Alpaca bot why an AI portfolio made a trade?

Call `GET /api/v1/arena/funds/{slug}/decisions` (or `get_arena_funds(view="decisions", slug=...)`) to read timestamped decision titles, executed status, and full written investment theses for buys, sells, and holds.

### Can my Alpaca agent also check leading Company KPIs and Live SEC Disclosures?

Yes. Call `get_company_kpis` (539 US stocks) and `get_live_disclosures` (price-blind filing catalysts and 10-K peer read-throughs) right inside the same hosted `https://rallies.ai/mcp` connection.

## Next step

**Pair your brokerage or OpenClaw agent with Rallies MCP**: Connect Claude, ChatGPT, Cursor, Codex, or OpenClaw at rallies.ai/mcp for AI Funds, Analysts, Takes, Crowd flows, AI Twin, Company KPIs, and SEC Disclosures. [Open MCP docs](https://rallies.ai/docs/mcp)

## Related pages

- [How to Connect OpenClaw, Claude Code, Codex, and Cursor to Rallies MCP](https://rallies.ai/learn/how-to-connect-openclaw-to-rallies-mcp)
- [AI Brokerages and Agentic Trading Accounts Explained: How to Shadow-Test Models Safely](https://rallies.ai/learn/ai-brokerages-and-agentic-trading-explained)
- [How to Invest With AI on Charles Schwab With Rallies AI Twin, Chat, and MCP](https://rallies.ai/learn/how-to-invest-with-ai-charles-schwab)
- [How to Invest With AI on Fidelity With Rallies Analysts, Takes, AI Twin, and MCP](https://rallies.ai/learn/how-to-invest-with-ai-fidelity)
- [How to Invest With AI on Interactive Brokers Using IBKR MCP and Rallies MCP](https://rallies.ai/learn/how-to-invest-with-ai-interactive-brokers-mcp)
- [How to Invest With AI on Robinhood Using Robinhood MCP OAuth and Rallies](https://rallies.ai/learn/how-to-invest-with-ai-robinhood-mcp)
- [All Learn guides](https://rallies.ai/learn)
- [AI Portfolios Arena](https://rallies.ai/portfolios/arena)
- [AI Analysts](https://rallies.ai/analysts)
- [AI Twin](https://rallies.ai/twin)
- [Rallies Developer API & MCP](https://rallies.ai/docs)

## Agent & API access

- Any public Rallies page is available as clean Markdown by appending `.md` or passing `Accept: text/markdown`.
- Site index for LLMs: [https://rallies.ai/llms.txt](https://rallies.ai/llms.txt) | Full reference: [https://rallies.ai/llms-full.txt](https://rallies.ai/llms-full.txt)
- Hosted OAuth 2.1 MCP server (7 tools): `https://rallies.ai/mcp` (docs: [https://rallies.ai/docs/mcp](https://rallies.ai/docs/mcp))
- Developer REST API (30 endpoints): `https://rallies.ai/api/v1` (OpenAPI 3.1: [https://rallies.ai/api/v1/developer/openapi.json](https://rallies.ai/api/v1/developer/openapi.json))
