ReadyTrader-FOREX
Allows trading on Binance exchange, including placing orders and fetching market data via API keys.
Sends trade approval notifications to Discord via webhook, enabling manual confirmation of trades.
Supports DeFi operations on Ethereum, such as interacting with Aave and Uniswap, and trading tokens on DEXes.
Fetches real-time sentiment data from Reddit for market intelligence and analysis.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@ReadyTrader-FOREXPlace a market order for 1000 EUR/USD in paper mode"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
ReadyTrader-FOREX
Important Disclaimer (Read Before Use)
ReadyTrader-FOREX is provided for informational and educational purposes only and does not constitute financial, investment, legal, or tax advice. Trading forex and CFDs involves substantial risk and may result in partial or total loss of funds. Past performance is not indicative of future results. You are solely responsible for any decisions, trades, configurations, supervision, and the security of your credentials/API keys. ReadyTrader-FOREX is provided βAS ISβ, without warranties of any kind, and we make no guarantees regarding profitability, performance, availability, or outcomes. By using ReadyTrader-FOREX, you acknowledge and accept these risks.
See also: DISCLAIMER.md.
Related MCP server: XBTFX MCP Trading Server
π The Big Picture
ReadyTrader-FOREX is an MCP server that turns your AI agent (Claude, Agent Zero, or any MCP client) into a supervised forex trading operator.
Your agent provides the Intelligence (reading rates, the economic calendar, news and its own analysis); ReadyTrader-FOREX provides the Hands (a paper FX account, market data and brokerage connections) and the Safety Brakes (a Risk Guardian every order must pass). You can delegate FX trading to an agent without giving it unchecked access to your capital.
π‘οΈ The Trust Model: Intelligence vs. Execution
The AI Agent (The Brain): decides what and when to trade. It can research history, read news and the calendar, and backtest strategies, but it has no direct power to move money.
The MCP Server (The Guardrail): owns the API keys and enforces your policies. Every order goes through the Risk Guardian, which rejects trades that are too large, too risky or against your limits.
π° Funding Model (Non-Custodial)
You keep your funds in your own brokerage account (OANDA is the default live venue).
You control the keys: give the server API keys that can trade but (recommended) not withdraw.
Agent as operator: the server sends order instructions to your broker with your keys; the broker executes and settles.
Paper Mode (the default) trades a simulated FX account instead: USD cash, one netted position per pair, margin at 30:1 and P&L converted to USD. It is kept in
data/paper.dbbetween runs.
π A Day in the Life of a Trade
Research: you ask, "Find a good entry for EUR/USD." The agent calls
get_forex_market_brief("EURUSD"),fetch_ohlcv,get_market_regimeandget_economic_calendar.Proposal: it decides to buy 4,000 EURUSD and calls
place_market_order("EUR/USD", "buy", 4000). Amounts are units of the base currency: 4,000 EUR, about 4,500 USD.Governance: the Risk Guardian judges the part of the order that opens or adds to a position (an order that reduces or closes one is an exit), at its USD notional (from the market rate, never a price the order carries) against your account: no more than 5% of the account per trade, nothing that adds exposure after a 5% daily loss or a 10% drawdown (on the paper account only: a live account has no loss history here, and live orders list both rules under
inactive_rules), no BUY into a collapsing pair, and no trade at all on a pair in a volatility halt (docs/FALLING_KNIFE.md). Live orders also pass yourMAX_BROKERAGE_ORDER_AMOUNT/ALLOW_BROKERAGE_SYMBOLSpolicy and needLIVE_TRADING_ENABLED=true.Consent: with
EXECUTION_APPROVAL_MODE=approve_eachthe order comes back as a pending proposal. You approve it through the API or the dashboard; the Risk Guardian checks it again with fresh data, and only then does it execute.
π₯οΈ Next.js Dashboard
A small dashboard backed by the API server (app/api_server.py).
How to enable:
Start the API server from the repository root:
python app/api_server.py(serves127.0.0.1:8000; setAPI_HOST/API_PORTto change it).In another terminal:
cd frontend && npm install && npm run devOpen
http://localhost:3000. If the API runs elsewhere, setNEXT_PUBLIC_API_URL(andNEXT_PUBLIC_WS_URL) before starting the dashboard; if the dashboard is served from another address, add it to the API'sAPI_CORS_ORIGINS.
What it shows:
Paper Account: equity, cash, open positions with unrealized P&L, margin used/free, today's P&L and drawdown, from
/api/portfolio(the live-account view is not implemented yet).Mode: Paper Mode or LIVE TRADING, read from
/api/health.Guard Rail: pending
approve_eachproposals with the order each would place (pair, side, amount, type, venue, paper or live); Approve and Reject ask for the proposal'sconfirm_tokenand call/api/approve-trade. When the API runs withAPI_OPERATOR_TOKEN, the dashboard asks for that token once per browser tab (kept in the tab's session storage).Live Markets: tickers pushed over the API's WebSocket (
/ws). No tool starts a market-data stream in this release, so this panel stays empty.
π Key Features
π Paper FX account: persistent USD cash, netted positions per pair (long or short), margin and leverage, P&L in the quote currency converted to USD. Market orders fill at the latest rate; limit orders fill only when marketable.
π‘οΈ Risk Guardian with market data: position sizing by USD notional, daily-loss and drawdown limits, the price-based Falling Knife rule and a volatility halt read from recent daily bars (tested on 24 pairs they had never seen;
docs/FALLING_KNIFE.md).π Calendar & news: this week's high-impact events (no key), FX headlines from free RSS feeds, the DXY trend, plus NewsAPI / Alpha Vantage / X / Reddit when you add keys. No invented sentiment scores (
docs/SENTIMENT.md).π§ Strategy research: a backtesting engine for agent-written strategies, synthetic black-swan stress tests and a market-regime detector.
β‘ 10-minute evaluation
Run both demos locally (no keys needed; Python 3.12+, dependencies installed as below):
python examples/paper_quick_demo.py # the paper FX account, offline, with self-checks
python examples/stress_test_demo.py # the synthetic stress labThe stress demo writes exportable artifacts under artifacts/demo_stress/ (gitignored).
Prompt pack (copy/paste): prompts/READYTRADER_PROMPT_PACK.md.
π οΈ Installation & Setup
Prerequisites
Docker, or Python 3.12+ for a local install (below)
1. Build & Run (Docker)
The image runs the MCP server on stdio.
cd ReadyTrader-FOREX
docker build -t readytrader-forex .
# Run interactively (to test); the named volume keeps the paper account between runs
docker run --rm -i -v readytrader-forex-data:/app/data readytrader-forexLocal development (no Docker)
Requires Python 3.12 or newer (pandas_ta has no release for older versions).
python3.12 -m venv .venv && source .venv/bin/activate
pip install -r requirements-dev.txt
python app/main.py # MCP server on stdio; an MCP client launches it the same waypython tools/setup_wizard.py checks the dependencies, the data sources and your .env.
2. Configuration (.env)
Paper mode needs no configuration. To change anything, copy env.example to .env: it lists every variable the server reads, with safe defaults.
Variable | Default | Description |
|
|
|
|
| Must be exactly |
|
| Kill switch: any value other than empty, |
|
|
|
|
| Leverage of the paper account (margin = USD notional / leverage). A value that is not a positive number stops the server at start. |
| unset | Largest live order, in units of the base currency. A value that is not a number refuses every live order ( |
| unset (all) | Comma-separated allowlists for live orders ( |
|
| The Falling Knife rule and the volatility halt. Only |
| unset | What a BUY does when the daily bars cannot be read: |
|
| The API server's address. The approval API has no login: keep it on 127.0.0.1 unless something in front of it authenticates. |
|
| Browser origins allowed to call the API. |
| unset | Operator secret for the API server only: when set, every |
| unset | Give both processes the same values so the API can approve the MCP server's proposals. |
| unset | Optional notifications when a proposal needs approval. |
Variable | Description |
| The default live venue. |
|
|
OANDA is the only connector that trades currency pairs. The Interactive Brokers, Alpaca, Tradier, Schwab, E*TRADE and Robinhood connectors are inherited from ReadyTrader-Stocks and place stock orders; their variables are in env.example.
Variable | Used by |
none |
|
|
|
|
|
|
|
A tool whose key is missing answers not_configured; a source that fails answers source_unavailable (never an empty "all clear").
Variable | Default | Description |
|
| Where the SQLite files live (paper account, insights, strategies, approvals), whatever folder the MCP client starts the server in. |
|
| The paper account alone. |
|
| Log level for the API server's JSON logs. |
RISK_PROFILE, EXECUTION_MODE, RATE_LIMIT_DEFAULT_PER_MIN and CIRCUIT_BREAKER_PCT are read but not applied: the Risk Guardian's limits are fixed and no rate limit is enforced.
Live trading
Live orders go out only with PAPER_MODE=false and LIVE_TRADING_ENABLED=true; TRADING_HALTED=true refuses them all, closing orders included (close positions on the OANDA platform while halted). Each is sized against the brokerage account's equity, and an order that adds exposure whose account cannot be read is refused. The daily-loss and drawdown limits run on the paper account only (live orders list them under inactive_rules): watch a live account's losses at the broker. Every OANDA order is fill-or-kill: a limit order is sent as a market order with a priceBound (the worst price it may fill at), so it fills now at that price or better, or not at all, and nothing rests at OANDA where later fills would escape the Risk Guardian and the kill switch. OANDA orders go to OANDA's practice API until you set OANDA_ENVIRONMENT=live, so you can test the whole live path without real money. Capabilities per brokerage: docs/EXCHANGES.md.
Order tools:
place_market_order(symbol, side, amount)andplace_limit_order(symbol, side, amount, price): OANDA in live mode.place_forex_order(symbol, side, amount, order_type='market', price=0.0, exchange='oanda'): the same with an explicit order type and brokerage.get_paper_account(),deposit_paper_funds("USD", amount),reset_paper_account(): the paper account.
β Approving trades (approve_each)
With EXECUTION_APPROVAL_MODE=approve_each, every order that passes the Risk Guardian comes back as {"status": "pending_approval", "request_id", "confirm_token"} instead of executing. To approve it through the API (or the dashboard), run the MCP server and python app/api_server.py with the same EXECUTION_DB_PATH and EXECUTION_SESSION_ID; then:
GET /api/pending-approvalslists the proposals with their orders, never their tokens (they expire after 120 s).POST /api/approve-trade {"request_id", "confirm_token", "approve": true}re-runs the Risk Guardian with fresh data and executes;"approve": falsecancels (the token is needed for both). A refusal answers409with the reason; an unknown proposal404; a wrong token403. A proposal executes only in the mode it was made in: a paper proposal approved by an API running live is refused (mode_mismatch).The agent receives each proposal's
confirm_token, so that token alone never proves a person approved. SetAPI_OPERATOR_TOKENon the API server (not on the MCP server): every/api/call but/api/healththen needsAuthorization: Bearer <token>(401without it), and a live proposal is approved only when it is set (403 operator_token_requiredotherwise). Every response carries anX-Request-IDthat matches the API's log lines.
π Integration Guide
Option A: Agent Zero
With the Agent Zero plugin: install a0-readytrader-forex-plugin (2.0.0 or later) from Agent Zero's Plugins page (Git URL or ZIP). It installs this server into the plugin's folder, registers it with Agent Zero's MCP client in paper mode, and adds a paper-trading skill.
By hand: in Agent Zero, open Settings β MCP/A2A β External MCP Servers and add the server to
the JSON there. Copy/paste file: configs/agent_zero.mcp.json.
{
"mcpServers": {
"readytrader_forex": {
"type": "stdio",
"command": "docker",
"args": [
"run",
"-i",
"--rm",
"-v",
"readytrader-forex-data:/app/data",
"-e",
"PAPER_MODE=true",
"readytrader-forex"
]
}
}
}The agent sees the tools as
readytrader_forex.<tool>(Agent Zero lowercases the server name and turns other characters into_). Saving the settings reloads Agent Zero's MCP servers.Agent Zero starts the server afresh for every call, so the
-vvolume is what keeps the paper account between calls. Agent Zero must be able to rundockerwhere it runs.Without Docker: set
"command"to the Python 3.12 interpreter of a ReadyTrader-FOREX checkout with its requirements installed (e.g./path/to/ReadyTrader-FOREX/.venv/bin/python) and"args"to["/path/to/ReadyTrader-FOREX/app/main.py"], paths Agent Zero can reach. Agent Zero passes the server only a minimal environment, so put settings in the entry's"env"(for example{"PAPER_MODE": "true"}) or in the checkout's.env.
Option B: Claude Desktop and other MCP clients
Add this to the client's MCP configuration (for Claude Desktop, claude_desktop_config.json). Copy/paste file: configs/claude_desktop.mcp-server-config.json.
{
"mcpServers": {
"readytrader_forex": {
"command": "docker",
"args": [
"run",
"-i",
"--rm",
"-v", "readytrader-forex-data:/app/data",
"-e", "PAPER_MODE=true",
"readytrader-forex"
]
}
}
}π Feature Guide
1. Strategy backtesting
Example prompt:
"Create a mean-reversion strategy for GBP/USD. Write a Python function
on_candlethat uses RSI. Backtest it on daily bars and tell me the PnL and the trades."
What happens:
The agent calls
fetch_ohlcv("GBPUSD", "1d", 100)to see the data.It writes
on_candle(close, rsi, state)returning'buy','sell'or'hold'.It calls
run_backtest_simulation(code, "GBPUSD", "1d"): the last 500 bars, from $10,000.The server runs the code with dangerous imports (such as
os) refused and returns{"pnl_percent": ..., "total_trades": ..., "trades_log": [...], ...}; a strategy that fails returnsbacktest_error.
2. Paper trading laboratory (no keys)
Fund the account:
deposit_paper_funds("USD", 100000)Research:
get_stock_price("EURUSD")(the latest rate; the name is kept for compatibility),get_multiple_prices("EURUSD,GBPUSD,USDJPY"),fetch_ohlcv,get_market_regimeRead the calendar and news:
get_economic_calendar(),get_forex_news(),get_forex_market_brief("EURUSD")Trade:
place_market_order("EUR/USD", "buy", 4000)fills at the latest rate (4,000 EUR is about 4.5% of a 100,000 USD account; more than 5% is refused);place_limit_orderfills only if marketable (resting orders are not simulated; live OANDA limits are fill-or-kill too). Selling more than you hold opens a short.Check the account:
get_paper_account()(cash, equity, positions, unrealized P&L, margin)Start over:
reset_paper_account()
3. Market regime & risk
Tool:
get_market_regime("EURUSD")Output:
{"regime": "TRENDING", "direction": "UP", "adx": 31.2, "atr_pct": 0.55, "summary": "..."}Agent logic: "The market is trending (ADX > 25). I will use my trend-following strategy."
The Guardian (passive safety): if the agent tries to put 50% of the account on one trade, the order is refused. validate_trade_risk(side, symbol, amount_usd, portfolio_value) runs the same checks without placing anything.
It also refuses a BUY into a collapsing pair (down 5%+ from its highest close of the last four days and still at its lowest close) and halts every trade on a pair whose daily move is more than 4.5x its 20-day norm. The rules, the data they read and the evidence behind the thresholds are in docs/FALLING_KNIFE.md. Not implemented yet, and reported under inactive_rules in every verdict: a news blackout around high-impact releases.
π§° Tool Reference
The complete catalog, generated from the running server: docs/TOOLS.md.
Category | Tool | Description |
Trading |
| Market order through the Risk Guardian. |
| Limit order (paper: fills only if marketable). | |
| Either, with a brokerage choice for live orders. | |
| The general order tool (kept for compatibility). | |
| Check a trade without placing it. | |
Paper account |
| Cash, equity, positions, margin. |
| Add virtual USD. | |
| Clear the paper account. | |
Market data |
| Latest rate for a pair (yfinance). |
| Latest rates for several pairs. | |
| Historical candles. | |
| Trend / range / volatility detection. | |
Calendar & news |
| Rate, DXY trend, calendar and headlines in one call. |
| This week's high-impact events (UTC). | |
| The DXY trend and the calendar (not a score). | |
| Free RSS headlines. | |
| Any public RSS/Atom feed. | |
| Alpha Vantage / NewsAPI headlines (keys). | |
| Recent X/Reddit posts for you to judge (keys). | |
Research |
| Backtest a strategy. |
| Synthetic black-swan stress test with deterministic replay. | |
| Share signals between agents. |
start_brokerage_private_ws is registered for compatibility and answers not_implemented.
π§ͺ Synthetic Stress Testing
A randomized but deterministic-by-seed market simulator: trending, ranging and volatile regimes with injected black-swan crashes and parabolic blow-off tops.
Tool: run_synthetic_stress_test(strategy_code, config_json='{}')
Returns JSON with:
a metrics summary across scenarios
replay seeds (master and per scenario)
artifacts: scenario metrics CSV, worst-case equity curve CSV and trades JSON
recommendations: suggested parameter changes (applied to
PARAMSkeys if present)
Example config_json:
{
"master_seed": 123,
"scenarios": 200,
"length": 500,
"timeframe": "1h",
"initial_capital": 10000,
"start_price": 100,
"base_vol": 0.01,
"black_swan_prob": 0.02,
"parabolic_prob": 0.02
}π Project docs
docs/TOOLS.md: the complete tool catalog (generated from the running server)docs/ERRORS.md: error codes and troubleshootingdocs/EXCHANGES.md: brokerage capability matrix (what is wired, what is not)docs/MARKETDATA.md: where market data comes fromdocs/FALLING_KNIFE.md: the Falling Knife rule and volatility halt, and the study behind the thresholdsdocs/SENTIMENT.md: why this server does not score sentiment, and how to supply your own readingdocs/THREAT_MODEL.md: operator-focused threat model (live trading)docs/CUSTODY.md: key custody and rotationdocs/POSITIONING.md: credibility-safe messagingRUNBOOK.md: operating the serverCHANGELOG.md: version-to-version changes
Built for the Agentic Future.
This server cannot be deployed
Maintenance
Related MCP Connectors
Unified financial infrastructure connecting AI agents directly to trade live/demo brokerage accounts, Web3 non-custodial wallets, real-time market data across equities, ETFs, crypto, forex, options, DeFi swaps, and prediction markets, institutional research feeds, and algorithmic strategy backtesters.
Let AI agents trade and read MetaTrader 5 accounts. Hosted β no terminal for you to run.
Live & historical FX rates and currency conversion for AI agents. No API keys.
Live & historical FX rates and currency conversion for AI agents. No API keys.
Related MCP Servers
- AlicenseNot gradedqualityBmaintenanceEnables AI agents to execute stock trading operations with built-in risk controls and human approval workflows. Supports paper trading simulation, real brokerage integration (Alpaca, Tradier), backtesting, sentiment analysis, and portfolio management while maintaining strict separation between AI intelligence and trade execution.MIT
- AlicenseAqualityCmaintenanceEnables AI agents to trade forex, metals, indices, and cryptocurrencies via the Model Context Protocol using the XBTFX Trading API. It provides comprehensive tools for managing account balances, retrieving market data, and executing trade operations like opening, modifying, or closing positions.1511 npmMIT
- AlicenseBqualityCmaintenanceProvides a safe trading toolkit for AI agents with market data, indicators, paper trading, and guarded broker integration.63MIT
- AlicenseNot gradedqualityCmaintenanceEnables AI assistants to trade on MetaTrader 5 using natural language, supporting account management, order placement, and real-time market data.1MIT