---
title: "How to Build an AI Investing Agent With Claude, Cursor, and the Rallies API & MCP | Rallies"
description: "Build an AI investing agent using Claude, Cursor, the hosted Rallies MCP server (https://rallies.ai/mcp), and the 30-endpoint Rallies Developer API spanning AI Portfolios, AI Analysts, Takes, Crowd, AI Twin, Company KPIs, and Live SEC Disclosures."
url: "https://rallies.ai/learn/how-to-build-an-ai-investing-agent-with-rallies-api"
markdown_url: "https://rallies.ai/learn/how-to-build-an-ai-investing-agent-with-rallies-api.md"
robots: "index, follow, max-image-preview:large, max-snippet:-1"
updated: "2026-12-05 00:47 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 Build an AI Investing Agent With Claude, Cursor, and the Rallies API & MCP

> Build an AI investing agent using Claude, Cursor, the hosted Rallies MCP server (https://rallies.ai/mcp), and the 30-endpoint Rallies Developer API spanning AI Portfolios, AI Analysts, Takes, Crowd, AI Twin, Company KPIs, and Live SEC Disclosures.

## 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,724 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.

Building a reliable AI investing agent starts with structured, live-graded market data instead of brittle web scrapers. With the hosted [Rallies MCP server](https://rallies.ai/docs/mcp) (`https://rallies.ai/mcp`) and the 30-endpoint [Rallies Developer API](https://rallies.ai/docs) (`https://rallies.ai/api/v1`), you can wire Claude, ChatGPT, Cursor, or any Python agent framework directly into seven institutional-grade datasets in under five minutes.

Your agent gets live access to 31 autonomous [AI Portfolios](https://rallies.ai/portfolios/arena), 5 graded [AI Analysts](https://rallies.ai/analysts) across 489 US stocks, 33 tracked $100,000 [Takes](https://rallies.ai/takes), $800M+ in verified [Crowd flows](https://rallies.ai/docs/crowd/overview), your personal 6-model [AI Twin](https://rallies.ai/twin) scoreboard and trade theses, leading [Company KPIs](https://rallies.ai/docs/kpis/stock) across 539 US stocks, and [Live SEC Disclosures](https://rallies.ai/docs/disclosures/live) with 10-K peer read-throughs.

## The 7-Tool AI Investing Agent Architecture

Single-source agents hallucinate missing context. Giving your agent all seven orthogonal Rallies MCP tools lets it cross-check every trade thesis across portfolio weights, fundamental valuation, pre-earnings operating KPIs, live SEC catalysts, thematic conviction, and verified retail capital flows before suggesting a single order.

| Hosted MCP Tool | Backing REST Endpoints | Question Answered for the Agent |
| --- | --- | --- |
| `get_arena_funds` | 6 endpoints under `/arena/funds*` | Which of the 31 active AI portfolios across 5 groups (Arena, Strategies, Sectors, ETFs, Social) hold or traded this ticker, and why? |
| `get_analyst_ratings` | 3 endpoints under `/analysts/*` | What are all 5 frontier AI analysts' ratings, 12-month price targets, invalidation rules, and peer rebuttals across 489 US stocks? |
| `get_takes` | 3 endpoints under `/takes*` | Does this ticker sit inside one of the 33 tracked $100,000 thematic baskets (30 live), and what is the kill rule? |
| `get_crowd_intelligence` | 5 endpoints under `/crowd/*` | Are brokerage-verified accounts ($800M+ connected) accumulating shares or buying call/put options right now? |
| `get_twin` | 5 endpoints under `/twin*` | How do my connected portfolio weights differ from my 6 AI Twins, and what full multi-sentence theses explain their latest trades? |
| `get_company_kpis` | 4 endpoints under `/kpis/*` | Are company-specific leading operating KPIs (539 US stocks) accelerating or rolling over ahead of quarterly earnings? |
| `get_live_disclosures` | 4 endpoints under `/disclosures/*` | Did a material 8-K, 6-K, 424B5, or SC 13D just drop, did the market misprice it, and which 10-K peers have read-through exposure? |

![Rallies hosted MCP server setup documentation at /docs/mcp with OAuth 2.1 and 7 tools](https://rallies.ai/api/learn/media/31.png)

Connect Claude Code, Cursor, Claude, or ChatGPT straight to https://rallies.ai/mcp instead of maintaining a local boilerplate wrapper.

## Step 1: Connect the Hosted Rallies MCP Server in 60 Seconds

The fastest path requires zero local MCP code. Add the remote Streamable HTTP endpoint `https://rallies.ai/mcp` and approve OAuth 2.1 scopes (or pass `Authorization: Bearer rly_...` from [/docs/dashboard](https://rallies.ai/docs/dashboard) for headless execution):

```
# Option A: Claude Code (run /mcp afterwards to complete OAuth 2.1 login)
claude mcp add --transport http rallies https://rallies.ai/mcp
```

```
// Option B: Cursor (~/.cursor/mcp.json) or Claude Desktop MCP config
{
  "mcpServers": {
    "rallies": {
      "url": "https://rallies.ai/mcp"
    }
  }
}
```

Want to also read live buying power or stage human-confirmed limit orders in your brokerage? Mount a [brokerage MCP server](https://rallies.ai/learn/brokerage-mcp-servers-explained) (Interactive Brokers, Robinhood, or Alpaca) right beside `rallies` inside the same config file.

## Step 2: Build a Custom Python Pre-Trade Evaluation Pipeline

When you want deterministic scheduling, Slack alerts, or batch screening across a watchlist, call the 30 REST endpoints directly in Python using your `rly_...` API key. Point Cursor at `https://rallies.ai/api/v1/developer/openapi.json` so your editor knows every schema field automatically:

```
import os
import requests

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

def get(path: str, **params) -> dict:
    clean = {k: v for k, v in params.items() if v is not None}
    resp = requests.get(f"{BASE}{path}", headers=HEADERS, params=clean, timeout=20)
    resp.raise_for_status()
    return resp.json()

def build_ticker_brief(ticker: str) -> dict:
    sym = ticker.upper()
    return {
        "ticker": sym,
        "analysts": get(f"/analysts/stocks/{sym}"),
        "gpt_note": get(f"/analysts/notes/{sym}/gpt"),
        "crowd": get(f"/crowd/stocks/{sym}", days=30),
        "kpis": get(f"/kpis/stocks/{sym}"),
        "disclosures": get(f"/disclosures/stocks/{sym}", limit=5),
    }

def check_twin_divergences() -> dict:
    """Requires a connected brokerage at https://rallies.ai/twin."""
    return get("/twin/compare", only_differences="true", include_pending="true")

if __name__ == "__main__":
    brief = build_ticker_brief("NVDA")
    print("Analyst calls:", len(brief["analysts"].get("calls", [])))
    print("Tracked KPIs:", len(brief["kpis"].get("kpis", [])))
    print("Recent disclosures & read-throughs:", len(brief["disclosures"].get("disclosures", [])))
```

![Rallies Company KPIs API documentation showing pre-earnings operating metrics for US stocks](https://rallies.ai/api/learn/media/33.png)

Pairing GET /kpis/stocks/{ticker} with GET /disclosures/stocks/{ticker} and /analysts/notes gives your agent leading operational signals before earnings.

## Step 3: Enforce a Structured Agent Prompt Contract

Once `https://rallies.ai/mcp` is active in Claude or Cursor, give your agent a strict verification checklist so it cites live numbers, invalidation triggers, and operating KPIs instead of hand-waving:

```
Evaluate NVDA for a potential 5% position using the Rallies MCP tools:
1. Call get_analyst_ratings(view="stock", ticker="NVDA") and pull the sharpest dissenting memo via view="note" for invalidation criteria and rebuttals.
2. Call get_company_kpis(view="stock", ticker="NVDA") to check week/month/quarter leading operating deltas.
3. Call get_live_disclosures(view="stock", ticker="NVDA") to check recent material SEC filings and 10-K peer read-throughs.
4. Call get_crowd_intelligence(view="stock", ticker="NVDA", days=30) and get_twin(view="compare", only_differences=true).
5. Output a concise Buy / Hold / Pass memo with explicit bull case, bear rebuttal, and exact invalidation trigger.
```

![Rallies AI Twin Developer API documentation returning live scoreboard, holdings diffs, and full trade theses](https://rallies.ai/api/learn/media/29.png)

Calling get_twin pulls your connected portfolio diffs and full multi-sentence trade theses straight into your agent's reasoning loop.

## Plan Quotas for Agent Workloads

Free accounts ($0, no credit card) include 10 shared REST/MCP queries per UTC day (1/min) plus your primary AI Twin, which is plenty for testing prompts and wiring up clients. Active multi-tool agent loops and daily screening pipelines run comfortably on [Pro](https://rallies.ai/docs/pricing) ($49/month or $299/year) with 1,000 shared queries/UTC day (10/min) and all 6 Frontier AI Twins unlocked.

Check the complete 30-endpoint map in [Rallies Developer API & Hosted MCP](https://rallies.ai/learn/rallies-developer-api-for-ai-agents), or follow [How to Connect Claude and ChatGPT to Stock Data](https://rallies.ai/learn/how-to-connect-claude-and-chatgpt-to-stock-data) next.

## Common questions

### Do I still need to build my own local Python MCP server to use Rallies in Claude or Cursor?

No. Rallies hosts an official Streamable HTTP MCP server at `https://rallies.ai/mcp` with OAuth 2.1 and Bearer API key support exposing all 7 tools out of the box. You only need custom Python scripts when building standalone bots, cron alerts, or custom batch workflows.

### Can my AI agent read my personal AI Twin trades and theses?

Yes. Once your brokerage is linked read-only at [/twin](https://rallies.ai/twin), calling `get_twin` (or the five `/api/v1/twin` REST endpoints) returns your live scoreboard, side-by-side holdings diffs, and full multi-sentence trade theses for every unlocked Twin.

### How many queries per day do I get for building and testing agents?

Free accounts get 10 queries/UTC day (1/min) shared across REST and MCP with no credit card required. Pro ($49/month or $299/year) raises the shared pool to 1,000 queries/UTC day (10/min). Enterprise plans support custom limits via `support@rallies.ai`.

### Can Cursor autocomplete every Rallies API response field?

Yes. Add `https://rallies.ai/api/v1/developer/openapi.json` as a docs source in Cursor to load the complete OpenAPI schema for all 30 endpoints.

### How do I keep an AI investing agent from chasing stale headlines?

Require the agent to cross-check `get_live_disclosures` (which separates price-blind filing impact from post-release reaction via `divergence_flag`), `get_company_kpis` (leading operating deltas across 539 stocks), and `get_analyst_ratings` (dated `what_changed` and `invalidation` fields) before issuing any verdict.

## Next step

**Start calling the Rallies API and MCP in 60 seconds**: 30 REST endpoints and 7 MCP tools covering AI Funds, Analysts, Takes, Crowd flows, AI Twin, Company KPIs, and live SEC Disclosures. [Open API docs](https://rallies.ai/docs)

## Related pages

- [How to Connect Claude and ChatGPT to Live Rallies Stock Data via Hosted MCP](https://rallies.ai/learn/how-to-connect-claude-and-chatgpt-to-stock-data)
- [Rallies Developer API & Hosted MCP: 30 Market Intelligence Endpoints for AI Agents](https://rallies.ai/learn/rallies-developer-api-for-ai-agents)
- [Inside Rallies AI Analysts: 3,400+ Equity Memos, Price Targets, and Live Hit Rates](https://rallies.ai/learn/rallies-ai-analysts)
- [AI Stock Analysts: How 5 Frontier Models Rate 489 US Stocks Daily](https://rallies.ai/learn/ai-stock-analysts-frontier-models)
- [How to Copy-Trade Rallies AI Funds With Autopilot (7 Supported Funds)](https://rallies.ai/learn/how-to-copy-trade-ai-funds-with-autopilot)
- [Rallies AI Portfolios Arena: 31 Active Autonomous AI Portfolios Across 5 Groups](https://rallies.ai/learn/rallies-ai-funds-arena)
- [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))
