Skip to main content
Glama
TradingAgents MCP

TradingAgents MCP

by ceharsh24

TradingAgents MCP

A local MCP server and research skill for Codex and Claude Code, built on the upstream TradingAgents Python library. Use it to research stocks and crypto, check options strategies, and save reports and decision history.

uv installs the pinned TradingAgents dependency in the project's .venv. Codex launches server.py as a local MCP server over standard input and output. The server imports TradingAgents and exposes selected capabilities as MCP tools, including market data, options calculations, and report storage. The trading-analysis skill guides the client through the research workflow. The original TradingAgents pipeline is also available with separate model sign-in.

For research. This is an independent project. See NOTICE for upstream attribution.

Install

Codex

Install the Codex CLI, sign in with your own account, and install uv. Clone this repository and run the following from its root on macOS or Linux. If you already have a trading-analysis skill link, check that it points to this checkout and skip the ln -s command if it does.

uv sync --frozen --no-dev
codex mcp add tradingagents \
  --env "TRADINGAGENTS_ENV_FILE=$PWD/.env.codex" \
  --env TRADINGAGENTS_FRONTEND=Codex \
  -- "$(command -v uv)" run --directory "$PWD" --frozen --no-dev --quiet python server.py

mkdir -p "$HOME/.codex/skills"
ln -s "$PWD/skills/trading-analysis" "$HOME/.codex/skills/trading-analysis"
codex mcp list

Open the checkout in a fresh Codex chat and ask it to use TradingAgents to fetch an NVDA market snapshot. Your existing Codex sign-in is enough for this workflow.

Optional original TradingAgents pipeline

To run the upstream pipeline with an eligible ChatGPT Plus or Pro plan, create .env.codex from the provided example and complete the separate TradingAgents sign-in. Usage counts against your plan.

test -f .env.codex || cp .env.codex.example .env.codex
.venv/bin/tradingagents login chatgpt

In ~/.codex/config.toml, add tool_timeout_sec = 660 to the existing [mcp_servers.tradingagents] section so pipeline_wait has time to finish. To require confirmation for backtests, add the following at the end of the file. Open a fresh Codex chat after setup.

[mcp_servers.tradingagents.tools.run_backtest]
approval_mode = "prompt"

Optional read-only Robinhood connection

Robinhood hosts a separate MCP server. To enable the documented read-only tools for external agents, add this entry to ~/.codex/config.toml, or update the existing robinhood entry. Trim the list to the tools you want Codex to access.

[mcp_servers.robinhood]
url = "https://agent.robinhood.com/mcp/trading"
enabled_tools = [
    # Account and portfolio
    "get_accounts",
    "get_portfolio",
    "get_realized_pnl",
    "get_pnl_trade_history",
    "search",
    "get_limited_margin_upgrade_info",
    "get_trade_approvals",
    "get_trade_approval_setting",
    # Watchlists
    "get_watchlists",
    "get_watchlist_items",
    "get_option_watchlist",
    "get_popular_watchlists",
    # Market data
    "get_equity_historicals",
    "get_equity_fundamentals",
    "get_financials",
    "get_equity_price_book",
    "get_equity_technical_indicators",
    "get_earnings_results",
    "get_earnings_calendar",
    "get_indexes",
    "get_index_quotes",
    "get_sec_filing_index",
    "get_sec_filing",
    "get_sec_filing_facts",
    "get_sec_filing_facts_catalog",
    "get_index_historicals",
    "get_politician_trades",
    "get_equity_analyst_ratings",
    # Equities
    "get_equity_positions",
    "get_equity_tax_lots",
    "get_equity_quotes",
    "get_equity_orders",
    "get_equity_tradability",
    # Options
    "get_option_level_upgrade_info",
    "get_option_chains",
    "get_option_historicals",
    "get_option_instruments",
    "get_option_quotes",
    "get_option_positions",
    "get_option_orders",
    # Crypto
    "get_currency_pairs",
    "get_crypto_quotes",
    "get_crypto_positions",
    "get_crypto_orders",
    "get_crypto_account_onboarding_info",
    "get_crypto_tax_lots",
    # Scanners
    "get_scans",
    "get_scanner_filter_specs",
    "run_scan",
    "get_scanner_datapoints",
    "preview_scan",
    # Alerts
    "get_alerts",
    "get_alert_log",
    # Advanced order history
    "get_advanced_orders",
    # Legend
    "get_legend_charts",
    "get_legend_indicators",
    "get_legend_indicator_catalog",
    "get_legend_layouts",
]

Run the login command, authorize your own Robinhood account in the browser, then open a fresh Codex chat. See Robinhood's onboarding instructions.

codex mcp login robinhood

Account-specific reads use a brokerage account number. With get_accounts enabled, Codex can look up your linked accounts. The allowlist includes portfolio and position reads, order history, market data, watchlists, scanner results, alerts, and Legend data. Actual availability depends on the tools Robinhood advertises to your signed-in session. Trade submission, cancellation, exercises, order previews, transfers, and changes to saved settings are outside this allowlist. See Robinhood's external-agent tool reference.

Claude Code

Install Claude Code and uv. In Claude Code, add the local checkout as a marketplace and install the plugin using its existing marketplace name.

/plugin marketplace add /path/to/tradingagents-mcp
/plugin install tradingagents@tradingagents-claude

Restart Claude Code. On the first start, the plugin downloads TradingAgents and its Python dependencies, which takes about a minute. If its tools are missing in that first session, run /mcp and reconnect tradingagents.

Related MCP server: Financial Risk MCP Server

Use

Analyse NVDA

Run trading analysis on RELIANCE.NS, quick depth. I hold 50 shares at ₹2,400.

Settle my past trading decisions

What's NVDA's implied move into earnings? Price a covered call for my 200 shares.

Depth options

  • quick: about 5 subagents. The main agent writes the debate, risk views, and a short fact check.

  • standard (the default): about 13 subagents

  • deep: adds a second debate round

Options

These work for listed options, mostly US, using Yahoo's live chains, so today only. Yahoo has no NSE/BSE options. Every figure is computed in code:

  • options_overview: IV term structure, implied move per expiry, 25-delta skew, put/call open interest, max pain, realized volatility, next earnings date

  • options_chain: one expiry's near-the-money strikes, with Black-Scholes deltas and the largest open-interest strikes

  • options_strategy: prices a position from the live quotes: net debit/credit, max profit/loss, breakevens, probability of profit, net delta

The Options Strategist proposes defined-risk structures only and prices each one with options_strategy.

Fact check

Before the portfolio manager decides, a Fact Checker re-fetches the 15–30 figures the decision rests on and marks each one verified, wrong (with the correct value) or unsupported. The portfolio manager ignores anything wrong or unsupported. The check is saved as its own report section.

From your phone: start a Claude Code session on your computer, turn on Remote Control, and open the session in the Claude mobile app.

Two engines

Codex or Claude Code runs the agents (default)

Original TradingAgents pipeline

How

The trading-analysis skill guides analysts, a bull/bear debate, a risk review, and a fact check using the local MCP tools.

run_pipeline runs TradingAgents' own LangGraph workflow.

Usage

Your Codex or Claude Code session

Your ChatGPT plan or configured model-provider API key

Setup

Register the MCP server and skill using the instructions above.

Follow the ChatGPT sign-in steps for Codex, or configure the provider's API key, such as ANTHROPIC_API_KEY for Claude Code.

Pipeline commands

Ask in plain words:

Run the pipeline on NVDA with 2 debate rounds

Backtest NVDA and AAPL weekly from June to September

Settle my past decisions

Tool

What it does

run_pipeline

One analysis. You can set analysts, portfolio, debate and risk rounds, quick and deep models, and report language per run. Every step is checkpointed, so a failed or interrupted run resumes when you ask again (restart=true starts over).

run_backtest

Runs the pipeline for every ticker on every date of a grid and scores each rating: how often it called the direction, and its mean alpha against the benchmark.

pipeline_settle

Scores due decisions in the live memory log, using TradingAgents' own reflections

pipeline_wait

Waits for the job in the current turn and returns the report when it finishes

pipeline_status, pipeline_report, pipeline_jobs

Follow and read jobs

Each pipeline job takes about 3–10 minutes. After a pipeline run, the skill uses annotate_report to add fact check and options sections.

Jobs run inside the MCP server, so keep the Codex or Claude Code session open until a job finishes. If you close it, ask again and the run resumes from its checkpoint. While a job runs, the server keeps your Mac awake with caffeinate. A closed lid still sleeps. Set TA_MCP_KEEP_AWAKE=0 to turn this off.

Backtests cost one full pipeline run per cell (tickers × dates). They are refused above max_cells (default 12), so you have to confirm a larger grid. They use a memory log of their own, never your live one.

Either engine

  • list_reports and read_report: past analyses from both engines

  • annotate_report: adds or replaces the Options and Fact Check sections of a saved report

  • backtest_results: past backtest scorecards, read at no cost

Configure (optional)

Copy .env.example to .env in this folder. It's gitignored, so keys never get committed. Settings load in this order, and the first file to set a value wins:

  1. The file named by TRADINGAGENTS_ENV_FILE (Codex uses .env.codex)

  2. <repo>/.env

  3. ~/.tradingagents/.env (use this for a plugin installed from GitHub, whose folder is replaced on update)

Useful settings:

  • SEC_EDGAR_USER_AGENT: your name and email. SEC asks callers to identify themselves.

  • FRED_API_KEY: free; adds US macro data (rates, CPI, yields).

  • ANTHROPIC_API_KEY plus the model settings: turns on the full pipeline.

Where things are saved

  • Reports: ~/.tradingagents/logs/reports/<TICKER>_<time>/complete_report.{md,html}

  • Decision memory: ~/.tradingagents/memory/trading_memory.md

  • Pipeline jobs: ~/.tradingagents/mcp_jobs/

Data

Market data comes from TradingAgents' sources:

  • Yahoo Finance

  • SEC EDGAR (US filings as originally filed)

  • StockTwits and Reddit

  • FRED

  • Polymarket

Every dated tool takes an analysis date and never returns data published after it.

Some sources only have live data: the fundamentals profile, insider trades, StockTwits, Polymarket, most news and all options data. These are withheld for past dates, so analyses dated today have the fullest data.

Stocks work on any exchange Yahoo covers (RELIANCE.NS, 0700.HK, AZN.L, …), and crypto works as BTC-USD.

Develop

From the cloned repository root, install the development dependencies and run the checks.

uv sync --frozen
uv run pytest
uv run python tests/smoke_stdio.py

File

What it is

server.py

The MCP server: data, memory and report tools

pipeline.py

Optional tools for the full LangGraph pipeline

options.py

Options data from Yahoo, plus Black-Scholes and payoff math

skills/trading-analysis/SKILL.md

The analysis workflow

hooks/ensure-env.sh

Prepares the Python environment when a session starts

.claude-plugin/plugin.json

Plugin manifest

.claude-plugin/marketplace.json

Marketplace manifest

TradingAgents is pinned to v0.7.1 in pyproject.toml and uv.lock. To upgrade, change the tag, run uv lock, run the tests, then bump the version in both manifests.

License

Apache 2.0. See LICENSE and NOTICE.

Available Tools

24 tools
annotate_reportA

Add or replace the Options and Fact Check sections of a saved report, such as one the API pipeline wrote (pipeline_report gives its report_id). Sections not passed are kept as they are. Updates both complete_report.md and .html.

Inputs: report_id (required), fact_check, options_analysis, options_strategy.

backtest_resultsA

Backtests run with run_backtest. Without run_id, lists them with their cell counts. With run_id, returns the scorecard: per rating, how often it called the direction and its mean alpha against the benchmark. Reading costs nothing; to settle cells whose window has since traded, run run_backtest again with the run_id.

Inputs: run_id. Returns: result

company_newsC

News about the company from the days before as_of.

Inputs: ticker (required), days, as_of. Returns: result

financial_statementC

One financial statement as it stood on as_of (no later restatements or filings).

Inputs: ticker (required), statement (required), freq, as_of. Returns: result

fundamentalsB

Company fundamentals as of the date: valuation, profitability, growth, balance sheet strength. US filers come from SEC EDGAR as originally filed.

Inputs: ticker (required), as_of. Returns: result

global_newsB

Global macro and market news from the days before as_of.

Inputs: days, as_of, limit. Returns: result

insider_transactionsC

Insider buys and sells. Withheld for past dates, since they are dated by trade rather than by filing.

Inputs: ticker (required), as_of. Returns: result

instrument_profileA

Identify the instrument: company name and classification, the exact ticker to use, and whether it is a stock or crypto. Call this first, and give the result to every agent so none of them confuse the company with another.

Args: ticker: Yahoo Finance symbol with exchange suffix, e.g. NVDA, RELIANCE.NS, 0700.HK, AZN.L, BTC-USD. as_of: Analysis date YYYY-MM-DD (default today).

Inputs: ticker (required), as_of. Returns: result

list_reportsA

List saved analysis reports, newest first, from both engines (the trading-analysis skill and the API pipeline), with ticker, date and rating. Read one with read_report.

Inputs: limit, ticker. Returns: result

macro_indicatorB

A macro series from FRED up to as_of. Aliases: cpi, core_pce, unemployment, fed_funds_rate, 10y_treasury, yield_curve, real_gdp, vix, ecb_deposit_rate, euro_hicp, eur_usd, or any raw FRED series ID. Needs FRED_API_KEY (free).

Inputs: indicator (required), as_of, look_back_days. Returns: result

market_snapshotA

Verified market snapshot: the latest OHLCV row on or before as_of, common indicators (moving averages, RSI, MACD, Bollinger, ATR) and recent closes. Treat it as the source of truth for any exact price or indicator figure you state.

Inputs: ticker (required), as_of, look_back_days. Returns: result

memory_lessonsB

Lessons from past decisions to give the Portfolio Manager: recent decisions on this ticker plus lessons from other tickers, limited to outcomes known by as_of.

Inputs: ticker (required), as_of. Returns: result

options_chainA

One expiry in detail: the near-the-money strikes (bid/ask, IV, Black-Scholes delta, open interest, volume for calls and puts), implied move, 25-delta skew, put/call ratios, the biggest open-interest strikes and max pain. Default expiry: the first at least 21 days out. Today only.

Inputs: ticker (required), as_of, expiry, strikes_each_side. Returns: result

options_overviewA

Options market overview, computed in code from Yahoo's live chains: implied volatility term structure, market-implied move per expiry (from the at-the-money straddle), 25-delta skew, put/call open interest, max pain, recent realized volatility and the next earnings date. Today only; mostly US listings.

Inputs: ticker (required), as_of. Returns: result

options_strategyA

Price an options position from the live chain and compute its payoff at expiry in code: net debit/credit, max profit, max loss, breakevens, probability of profit and net delta. Use it for every structure you propose; never do this math yourself.

legs: list of {"type": "call"|"put"|"stock", "side": "buy"|"sell", "strike": number (options), "expiry": "YYYY-MM-DD" (options), "quantity": contracts for options or shares for stock (default 1), "price": optional per-share override}. All option legs must share one expiry. Examples: covered call = buy 100 stock + sell 1 call; bull call spread = buy call K1 + sell call K2; cash-secured put = sell 1 put. Prices default to the mid quote (else last trade).

Inputs: legs (required), ticker (required), as_of. Returns: result

past_decisionsB

The raw memory log: past decisions and, once settled, their realised return, alpha and reflection. Optionally filtered to one ticker.

Inputs: ticker, max_chars. Returns: result

prediction_marketsB

Polymarket implied probabilities for events matching the topic, e.g. 'Fed rate cut', 'recession 2026', or a company event.

Inputs: topic (required), as_of, limit. Returns: result

price_historyB

Daily OHLCV prices from start_date (YYYY-MM-DD) up to as_of.

Inputs: ticker (required), start_date (required), as_of. Returns: result

read_reportA

Read a saved report (from list_reports) in full: every analyst report, the bull/bear debate, the trader plan, the risk debate and the final decision.

Inputs: report_id (required), max_chars. Returns: result

save_analysisA

Save a finished analysis as TradingAgents' report tree (markdown sections plus one complete_report.html page) and log the decision to the memory log so it is scored once its holding window has traded. Pass each agent's full text in markdown. final_decision is the Portfolio Manager's write-up, starting with the rating line. options_analysis, options_strategy and fact_check add the Options and Fact Check sections when given.

Inputs: rating (required), ticker (required), trade_date (required), final_decision (required), +15 more.

settle_decisionA

Record a decision's outcome and your reflection in the memory log. Returns are recomputed here from prices, so only the reflection comes from you. Keep it to a few sentences: was the call right, why, and the lesson for next time.

Inputs: ticker (required), reflection (required), trade_date (required). Returns: result

social_sentimentA

Recent StockTwits messages and Reddit posts about the ticker from the days before as_of. Posts are screened for relevance when TYPESAFE_API_KEY is set.

Inputs: ticker (required), days, as_of. Returns: result

technical_indicatorsA

Daily values of technical indicators over the look-back window ending at as_of.

Choose up to 8 that complement each other (avoid redundant pairs): close_50_sma, close_200_sma (trend); close_10_ema (short-term momentum); macd, macds, macdh (momentum, crossovers, divergence); rsi (overbought/oversold, 70/30); boll, boll_ub, boll_lb (volatility bands, breakouts); atr (volatility, stop distances); vwma (volume-confirmed trend); mfi (money flow).

Inputs: ticker (required), indicators (required), as_of, look_back_days. Returns: result

unsettled_decisionsA

Logged decisions whose holding window has now traded, with their realised raw return and alpha against the regional benchmark. For each, write a short reflection (what the call got right or wrong, and the lesson) and record it with settle_decision. Decisions still inside their window are listed as waiting.

Inputs: no named parameters. Returns: result

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    B3.3/5.0

    Scored across 24 tools

    Disambiguation4/5

    Most tools target clearly distinct resources or analysis stages, and descriptions make boundaries explicit. There is some overlap between market_snapshot, price_history, and technical_indicators, and between fundamentals and financial_statement, but these are differentiated enough for an agent to choose correctly.

    Naming Consistency3/5

    All names use snake_case, so the casing convention is consistent. However, the naming style is mixed between noun phrases such as market_snapshot and fundamentals and verb_noun actions such as list_reports and save_analysis, so there is no single predictable verb_noun pattern.

    Tool Count3/5

    The 24-tool surface is broad and mostly justified by the trading-analysis domain, but it is heavy and includes several related data-access tools that could be consolidated. It sits at the borderline where the count starts to feel large for one server.

    Completeness5/5

    The set covers the full trading-analysis workflow: instrument identification, market and technical data, fundamentals, statements, news, social sentiment, macro data, options analysis and strategy pricing, report saving/annotation, backtest review, and decision memory/settlement. No major dead ends are apparent for the stated purpose, with portfolio or order execution likely out of scope.

    Maintenance

    ActivityMaintained
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      C
      quality
      D
      maintenance
      Enables querying real-time and historical financial market data for stocks, options, forex, and crypto, including quotes, trades, technical indicators, and reference data through a set of MCP tools.
      71
      3
      MIT
    • A
      license
      Not graded
      quality
      B
      maintenance
      Provides market intelligence tools for crypto, Korean market, US equities, options, and backtests, as well as personal trading journal access, through MCP.
      19 PyPI
      MIT