目录 / MTContext
MCP
需 API Key
未评级
已上架
MTContext
Connect Claude, Cursor, or any MCP client to a MetaTrader 4/5 terminal — no Python, no local server. Drag one Expert Advisor onto a chart, then read prices, manage positions, and place trades (dry-run by default) in plain English. Cloud-hosted, works with MT4 and MT5.
该来源不提供完整文件导出(国内平台多为平台内托管),仅存元数据与原链
接入信息
- 传输形态
- http
- 鉴权方式
- 需 API Key(需要配置:licenseKey)
- 端点
https://mtcontext--tranvietthanh.run.tools
该服务需要凭证,请按官方文档申请后替换占位符
{
"mcpServers": {
"MTContext": {
"headers": {
"Authorization": "Bearer \u003cYOUR_KEY\u003e"
},
"url": "https://mtcontext--tranvietthanh.run.tools"
}
}
}
能力清单
| 工具 | 说明 |
|---|---|
| get_tick | Returns the current bid, ask, and spread for a symbol. |
| get_bars | Returns OHLCV bars for a symbol and timeframe. |
| get_symbols | Returns all symbols available in Market Watch. |
| get_symbol_info | Returns contract spec for a symbol: lot size, swap rates, digits. |
| get_account_info | Returns account balance, equity, margin, leverage, and currency. |
| get_positions | Returns all open positions with P&L. |
| get_orders | Returns all pending orders. |
| get_trade_history | Returns closed trades with optional date range filter. |
| get_indicator | Returns raw indicator values for a symbol and timeframe. Values are deterministic and unlabelled — no directional signals or verdicts are attached; the caller interprets them. Provide either `timeframe` (single) or `timeframes` (array, returns results keyed by timeframe under `by_timeframe`) — exactly one. Supported indicators: RSI (Relative Strength Index): period 2-200 (default 14) → values: number[] MACD (Moving Average Convergence Divergence): fast 2-200 (default 12), slow 2-200 (default 26), signal 2-200 (default 9) → macd: number[], signal: number[], histogram: number[] ATR (Average True Range): period 1-200 (default 14) → values: number[] SMA (Simple Moving Average): period 1-200 (default 20), applied_price CLOSE|OPEN|HIGH|LOW|MEDIAN|TYPICAL (default CLOSE) → values: number[] EMA (Exponential Moving Average): period 1-200 (default 20), applied_price CLOSE|OPEN|HIGH|LOW|MEDIAN|TYPICAL (default CLOSE) → values: number[] BOLLINGER (Bollinger Bands): period 2-200 (default 20), deviation 0.1-10 (default 2.0), applied_price CLOSE|OPEN|HIGH|LOW|MEDIAN|TYPICAL (default CLOSE) → upper: number[], middle: number[], lower: number[] ADX (Average Directional Index / DMI): period 2-200 (default 14) → adx: number[], plus_di: number[], minus_di: number[] STOCHASTIC (Stochastic Oscillator): k_period 1-200 (default 5), d_period 1-200 (default 3), slowing 1-200 (default 3) → k: number[], d: number[] CCI (Commodity Channel Index): period 1-200 (default 14) → values: number[] PARABOLIC_SAR (Parabolic Stop and Reverse): step 0.001-1 (default 0.02), maximum 0.01-1 (default 0.2) → values: number[] ICHIMOKU (Ichimoku Kinko Hyo): tenkan 1-200 (default 9), kijun 1-200 (default 26), senkou 1-200 (default 52) → tenkan: number[], kijun: number[], senkou_a: number[], senkou_b: number[], chikou: number[] WPR (Williams %R): period 1-200 (default 14) → values: number[] MFI (Money Flow Index): period 1-200 (default 14) → values: number[] STDDEV (Standard Deviation): period 1-200 (default 20), applied_price CLOSE|OPEN|HIGH|LOW|MEDIAN|TYPICAL (default CLOSE) → values: number[] DEMARKER (DeMarker): period 1-200 (default 14) → values: number[] MOMENTUM (Momentum): period 1-200 (default 14), applied_price CLOSE|OPEN|HIGH|LOW|MEDIAN|TYPICAL (default CLOSE) → values: number[] |
| get_terminal_info | Returns MT5 terminal metadata: name, company, path, build, max_bars. |
| list_experts | Returns all Expert Advisors currently attached to open charts. |
| read_ea_logs | Returns recent lines from the EA log file. available=false when the log cannot be read (MQL5 sandbox). |
| get_journal | Returns recent lines from the MT5 Journal log. available=false when the log cannot be read. |
| get_trade_stats | Returns aggregate statistics over closed trades: total_trades, win/loss counts, win_rate, avg_profit, avg_loss, profit_factor, total_pnl, expectancy, max_drawdown_percent, sharpe_ratio, consistency_percent. |
| get_pnl_by_symbol | Returns P&L broken down per trading symbol. Result: { items: [{ symbol, pnl, trades }] } sorted by |pnl| descending. |
| get_pnl_by_time | Returns P&L bucketed into time intervals. Result: { items: [{ period_start, pnl, trades }] } sorted chronologically. |
| check_order | Checks whether an order can be placed without sending it. Supports both market and pending order types. Returns { feasible, required_margin, free_margin, estimated_cost, reason? }. |
| get_tick_history | Returns a sequence of raw ticks for a symbol. Result: { ticks: [{ time, bid, ask, last, volume }] }. |
| place_order | Places a market or pending order on MT5. Defaults to dry_run=true — set dry_run=false to execute live. Pending orders may set expiry (unix epoch seconds) for broker-side expiration; expiry is rejected on market orders. Requires the `trade` capability and inp_AllowTrading=true on the EA. |
| close_position | Closes an open position by ticket. Defaults to dry_run=true — set dry_run=false to execute live. Requires the `trade` capability and inp_AllowTrading=true on the EA. |
| modify_position | Modifies the stop_loss and/or take_profit of an open position. At least one of stop_loss or take_profit must be provided. Defaults to dry_run=true — set dry_run=false to execute live. Requires the `trade` capability and inp_AllowTrading=true on the EA. |
| cancel_order | Cancels a pending (limit or stop) order by ticket. Defaults to dry_run=true — set dry_run=false to execute live. Returns ORDER_NOT_FOUND if the ticket is not in pending orders. Requires the `trade` capability and inp_AllowTrading=true on the EA. |
| partial_close | Closes a portion of an open position. `volume` must be less than the full position volume. Defaults to dry_run=true — set dry_run=false to execute live. Returns INVALID_PARAMETER if volume >= position volume, POSITION_NOT_FOUND if position closed between dry-run and live call. Requires the `trade` capability and inp_AllowTrading=true on the EA. |
| modify_order | Modifies the price, stop_loss, take_profit, or expiry of a pending order. At least one of price, stop_loss, take_profit, or expiry must be provided. Defaults to dry_run=true — set dry_run=false to execute live. Requires the `trade` capability and inp_AllowTrading=true on the EA. |
| close_all_positions | Closes all currently open positions, optionally filtered by symbol. The EA executes all closes in a single command to avoid N round-trips and partial-disconnect risk. Returns a `results` array with per-ticket success/failure. Defaults to dry_run=true — set dry_run=false to execute live. Requires the `trade` capability and inp_AllowTrading=true on the EA. |
| set_breakeven | Moves the stop loss of a position (or all positions) to its entry price. Optional buffer_points adds N points on the safe side of entry. Returns POSITION_NOT_IN_PROFIT if the position has not yet moved favourably. Defaults to dry_run=true — set dry_run=false to execute live. Requires the `trade` capability and inp_AllowTrading=true on the EA. |
| set_trailing_stop | Registers a software trailing stop on a position. The EA updates the SL each timer cycle when price moves trailing_points in the position's favour. IMPORTANT: trailing state is lost if the EA restarts — callers should re-set after reconnect. trailing_points minimum is 10. Defaults to dry_run=true — set dry_run=false to register live. Requires the `trade` capability and inp_AllowTrading=true on the EA. |
| reverse_position | Closes an open position and opens a market order in the opposite direction as ONE EA command (single trade-context acquisition — minimises the gap between the two fills vs separate close_position + place_order calls). volume defaults to the closed volume; optional stop_loss / take_profit apply to the new position. If the close succeeds but the open fails (margin, market closed), returns REVERSE_PARTIAL with the close details and leaves the account flat — the EA never retries the open on its own. Defaults to dry_run=true — set dry_run=false to execute live. Requires the `trade` capability and inp_AllowTrading=true on the EA. |
| calculate_lot_size | Calculates the appropriate lot size for a trade based on account equity and risk parameters. Uses live account equity and symbol contract specs from the connected terminal. Returns the recommended lot size, risk amount in account currency, and pip value. Returns LOT_TOO_SMALL if the computed lots are below the symbol minimum. Available at Free+ tier (no analytics capability required). |
| get_risk_summary | Returns a portfolio risk overview: aggregate currency exposure, margin utilisation, and correlated pairs. NOTE: Currency exposure logic assumes FX symbols (e.g., EURUSD) where the base currency is the first 3 characters. Results for indices, cryptos, and stocks will be inaccurate. Requires the `analytics` capability (Team+ tier). |
| get_correlation | Returns the Pearson price correlation coefficient between two symbols over N daily bars. Ranges from -1.0 (perfect inverse) to +1.0 (perfect positive). Requires the `analytics` capability (Team+ tier). |
| get_economic_calendar | Returns upcoming and recent economic calendar events. Prefers MT5's built-in Calendar API when a terminal is connected; falls back to the server-side calendar (free feed) on MT4 or when disconnected. Response includes a `source` field ('terminal' or 'server'). Requires the `analytics` capability (Team+ tier). |
| get_market_depth | Returns Depth of Market (DOM) bid/ask levels for a symbol. Requires the broker to supply DOM data — if unavailable, returns empty arrays with a note. On MT4 terminals, returns { error: 'NOT_SUPPORTED_ON_MT4' }. Requires the `read` capability (Pro+ tier). |
| scan_symbols | Scans Market Watch symbols and filters by spread, RSI, or ATR thresholds. At least one filter criterion must be provided. Returns up to 50 symbols. If scanning takes over 10 seconds, partial results are returned with partial=true. Requires the `read` capability (Pro+ tier). |
| get_spread_alert | Returns the current spread for a symbol compared to an estimated historical average. The 30-day average is estimated from daily high-low range (not tick-level data). A spread is flagged as abnormal if it exceeds threshold_multiplier × the estimated average. Requires the `analytics` capability (Team+ tier). |
| get_market_sessions | Returns which major trading sessions (Sydney, Tokyo, London, New York) are currently open and when the next session opens/closes. Pure server-side UTC computation — no EA dispatch required. Available at Free+ tier. |
| get_interest_rates | Returns current central bank policy interest rates for major currencies, sourced from MT5's built-in Calendar API. Includes the date of the last change and next scheduled decision. On MT4 terminals, returns { error: 'NOT_SUPPORTED_ON_MT4' }. Requires the `analytics` capability (Team+ tier). |
| get_macro_indicators | Returns key macroeconomic indicators (CPI, GDP, NFP, PMI, unemployment, retail sales, trade balance) for a currency with the latest actual, previous, forecast, and surprise values. Data from MT5's built-in Calendar API. On MT4 terminals, returns { error: 'NOT_SUPPORTED_ON_MT4' }. Requires the `analytics` capability (Team+ tier). |
| get_cot_report | Returns the latest CFTC Commitments of Traders (COT) report data for a currency or commodity. Data sourced from the CFTC Socrata public API (free, no key required), cached 24 hours. Supported symbols: EUR, GBP, JPY, CHF, AUD, CAD, NZD, GOLD, OIL. Returns { error: 'COT_UNAVAILABLE' } if the feed is unreachable. Requires the `analytics` capability (Team+ tier). |
| get_rate_differential | Returns the interest rate differential between the two currencies in a pair, plus the annualised swap cost/credit for the specified volume. Computed server-side from get_interest_rates and get_symbol_info data. Requires the `analytics` capability (Team+ tier). |
| get_rate_expectations | Returns the market's expected policy path per G10 central bank: next scheduled meeting + countdown, current policy rate, last decision, and — for USD when a Fed Funds futures quote source is configured — market-implied cut/hold/hike probabilities and the implied year-end rate. Every response is labelled `data_quality: implied | calendar_only`; calendar-only entries omit probability fields entirely (never a fabricated guess). Implied values are DELAYED and APPROXIMATE (`approximate: true`, `method: ff_futures_derived`). Fully EA-independent (server-side + cache; works with no terminal connected). Pass a single G10 currency or `ALL` for the full map. Upstream failures serve cached data with `stale: true` or return { error: 'RATE_EXPECTATIONS_UNAVAILABLE' }. Requires the `analytics` capability (Team+ tier). |
| get_news | Returns recent forex/financial news articles from NewsAPI.org. Requires NEWS_API_KEY environment variable — returns NEWS_NOT_CONFIGURED if not set. Returns NEWS_UNAVAILABLE if the feed is unreachable. Results cached 5 minutes. Requires the `analytics` capability (Team+ tier). |
| get_sentiment | Returns retail trader positioning sentiment for a symbol from Myfxbook Community Outlook (free, no key required). Includes long/short percentages and a contrarian signal (when retail is >70% long, signal is SHORT). Returns SENTIMENT_UNAVAILABLE if the feed is unreachable. Results cached 15 minutes. Requires the `analytics` capability (Team+ tier). |
| explain_trade | Explains a trade: what conditions existed at entry, the risk/reward ratio, SL/ATR ratio, and whether it aligns with common strategies. Works for both open positions and closed trade history. Returns POSITION_NOT_FOUND if ticket not found. Requires the `analytics` capability (Team+ tier). |
| get_fibonacci_levels | Computes Fibonacci retracement and extension levels from swing high and low price points. Pure server-side computation — no EA dispatch required. Available at Free+ tier. |
| backtest_strategy | Runs a micro-backtest of a simple rule-based strategy over historical bars fetched from the EA. Maximum 5000 bars. Returns equity curve and basic statistics. Times out after 30 seconds and returns BACKTEST_TIMEOUT. Supported entry/exit conditions: rsi_above, rsi_below, price_above_ema, price_below_ema, macd_cross_above_zero, macd_cross_below_zero. Requires the `analytics` capability (Enterprise+ tier). |
| get_market_snapshot | Returns a single-call market snapshot for one symbol: current tick (bid/ask/spread) plus a chosen indicator set across up to 4 timeframes. Replaces 5-8 separate tool calls when analysing a symbol. Limits: 4 timeframes x 6 indicators, 10 values per indicator. Defaults: timeframes ["H1"], indicators ["RSI", "ATR", "EMA"]. Indicators use their registry default parameters (e.g. RSI 14). If the 10s deadline is hit, returns the completed components with partial: true and a missing[] list. Values are raw and unlabelled — interpretation is up to the caller. Available at Free+ tier. |
| get_currency_strength | Ranks the 8 major currencies (USD EUR GBP JPY CHF CAD AUD NZD) by normalised % change, computed from bars across up to 28 major crosses in the terminal's Market Watch. Strongest first. Symbols missing from Market Watch are skipped and listed in skipped[]; currencies with fewer than 4 contributing pairs are flagged low_confidence. Requires the `analytics` capability (Team+ tier). |
| get_key_levels | Computes support/resistance key levels for a symbol: classic + Fibonacci pivot points from the prior period, swing highs/lows (fractal detection), and psychological round numbers near the current price. Each level includes its distance from the current price. Available at Free+ tier. |
| detect_patterns | Runs deterministic rule-based candlestick pattern detection over recent bars: engulfing, hammer, shooting star, doji, inside/outside bar, morning/evening star. Detection thresholds are fixed constants echoed in the response `criteria` field. Patterns are locations in the data, not trade signals. Available at Pro+ tier. |
| get_execution_quality | Reports slippage statistics (requested vs filled price) for live market orders placed through MT-MCP: average, median, and worst slippage in points, overall and per symbol. Measurement starts from when fill auditing was enabled — earlier periods return DATA_INSUFFICIENT with the earliest measurable date. Requires the `analytics` capability (Team+ tier). |
| create_alert | Creates a persistent server-side alert, evaluated every ~30 seconds while the terminal is connected (not tick-precise). Types: price (level above/below), indicator (value or cross vs threshold), position_event (sl_hit / tp_hit / position_closed, optional ticket filter), margin_level (below %). mode=once fires a single time; mode=recurring re-arms after cooldown_seconds. Fired events are queued durably — retrieve them with poll_alerts. Active-alert caps by tier: Pro 10, Team 50, Enterprise 200. Available at Pro+ tier. |
| list_alerts | Lists all alerts for this license with status (active/fired/cancelled), condition, mode, fire count, and last_evaluated_at (stale while the terminal is disconnected — evaluation pauses). Available at Pro+ tier. |
| cancel_alert | Cancels an active alert by alert_id (from create_alert or list_alerts). Returns ALERT_NOT_FOUND if the alert does not exist, already fired, or was already cancelled. Available at Pro+ tier. |
| poll_alerts | Drains undelivered fired-alert events (oldest first) and marks them delivered. Each event carries event_id, the alert's condition echo, the triggering values, and the fired timestamp. Events are retained 7 days; pass include_delivered=true to see the retained history. Call this periodically — alerts are pull-based, nothing is pushed. Available at Pro+ tier. |
| set_equity_guard | Configures an account-level circuit breaker enforced server-side (survives this session): when equity falls max_daily_loss_percent below the daily anchor (or max_total_drawdown_percent below initial equity), the guard breaches. breach_action: close_all = close all positions then block new live trades until the daily reset; block_new = block only; notify = record an alert event only (see poll_alerts). Evaluation runs on a ~30s sampling loop while the terminal is connected; if disconnected at breach time, the trade block still applies and close_all executes on reconnect. This is best-effort protection above the broker's own stop-out, not a replacement for stop losses. One guard per license — calling again replaces it. Requires the `trade` capability. |
| get_equity_guard_status | Returns the current equity guard: config, status (armed / breached / breached_pending / none), day_start_equity anchor, current equity, daily P&L percent, and the equity level at which the guard breaches. Requires the `trade` capability. |
| remove_equity_guard | Removes the equity guard. If the guard is currently breached (or breached_pending), removal requires confirm=true — this prevents silently disabling an active safety rail; without it the call returns CONFIRM_REQUIRED. Requires the `trade` capability. |
| set_prop_firm_rules | Configures a per-terminal prop-firm ruleset evaluated server-side (survives this session). Rules: max_daily_loss_percent (vs the daily equity anchor), optional max_total_drawdown_percent with drawdown_mode (static = from initial balance; trailing = from the high-watermark) and drawdown_basis (balance or equity), optional profit_target_percent, min_trading_days, and consistency_max_day_share_percent (max share of total profit from a single day). A preset (ftmo | generic) pre-fills defaults but the stored ruleset is always fully resolved — explicit params win. reset_timezone (IANA) sets the daily boundary. initial_balance seeds the drawdown basis for mid-challenge onboarding (otherwise seeded from a live sample). One ruleset per (license, terminal); re-calling replaces rule values but preserves the watermark unless initial_balance is re-supplied. ADVISORY ONLY — this never blocks trades. Pass link_equity_guard: true to also install a matching equity guard (breach_action default block_new) for actual enforcement. Requires the `trade` capability. |
| get_prop_firm_status | Returns a decision-ready prop-firm verdict: overall status (ok | warning | critical | breached), trade_advice (proceed | reduce_risk | block), max_safe_risk_percent for the next trade, per-rule headroom (percent and account currency) with human-readable reasons, days_traded, trailing watermark, and the consistency + profit-target / min-trading-days progress. Status is driven only by loss rules and a consistency violation; profit target and min trading days never worsen it. FAIL-SAFE: if the terminal is unreachable (no fresh equity sample) the response sets stale: true and forces trade_advice: block. Evaluation runs on a ~30s server-side sampling loop, so verdicts can lag intraday spikes — treat the bands as conservative. Requires the `trade` capability. |
| remove_prop_firm_rules | Removes the prop-firm ruleset for the terminal (does not touch any linked equity guard — remove that separately with remove_equity_guard). Returns RULESET_NOT_FOUND if none exists. Requires the `trade` capability. |
| write_trade_note | Persists a trade journal entry: rationale, setup label, and tags, optionally linked to a position/order ticket. Entries are append-only and immutable — to correct one, write a new note with amends_entry_id pointing at the original. Use at order time to capture WHY a trade was taken; query later with query_journal for post-trade review and per-setup statistics. Free tier stores up to 100 entries. Available at Free+ tier. |
| query_journal | Queries trade journal entries, newest first. Filters: ticket, tag, setup, from_date/to_date (ISO), and search (case-insensitive text match). Entries linked to closed trades include realized_pnl when the terminal is connected (null otherwise). Available at Free+ tier. |
| get_behavioral_insights | Computes descriptive behavioural metrics from closed trade history: overtrading (trades/day vs the trailing 30-day baseline), revenge trading (re-entry within 15 min of a loss on the same symbol at >=1.5x volume), volume escalation across consecutive losses, and winner-vs-loser hold-time asymmetry. All thresholds are fixed constants echoed in the `criteria` field. This is descriptive coaching over trade data, NOT a psychological assessment. Returns DATA_INSUFFICIENT below 10 closed trades. Requires the `analytics` capability (Team+ tier). |
| get_event_risk | Preflight check: returns a graded verdict (proceed/caution/block) for trading a symbol based on upcoming high-impact economic events within the horizon. Uses the server-side calendar — works with no terminal connected. Includes blackout windows, resume_after time, and per-event details. Unknown symbols default to caution (fail-safe). Requires the `analytics` capability (Team+ tier). |
| get_holding_risk | Assesses risk for holding (or planning to hold) a position in a symbol for a specified duration. Reports events landing inside the hold window, weekend/market-closure gap exposure, and triple-swap day flags. Uses the server-side calendar — works with no terminal. Requires the `analytics` capability (Team+ tier). |
| get_risk_regime | Returns a composite risk-on/risk-off score in [−1, 1] from z-scored market inputs (VIX, DXY, gold, 2s10s spread, equities). Pure scoring function with transparent per-input drivers, confidence, missing_inputs, and sizing_advice. Requires at least 3 available inputs or returns REGIME_UNAVAILABLE. Requires the `analytics` capability (Team+ tier). |
| get_economic_surprise | Returns a rolling actual-vs-forecast surprise index for a currency's economic events, weighted by impact tier (high=3×, medium=1×, low ignored). Reports insufficient_history when fewer than 30 days of data exist. Uses the server-side calendar. Requires the `analytics` capability (Team+ tier). |
| get_cb_stance | Returns the central bank hawk/dove stance for a currency, scored from −1 (max dovish) to +1 (max hawkish). Reads from persisted snapshots — no LLM call in the request path. Includes recent_change indicator, source statements, and classifier provenance marker. Requires the `analytics` capability (Team+ tier). |
| set_news_guard | Configures a persistent server-side news monitor. When enabled, the guard polls news at the specified interval, classifies articles by severity and affected currencies, and triggers alerts (via poll_alerts) when articles meet the threshold. One guard per license — calling again replaces the config. Notify-only: the guard never closes positions or blocks trades. Requires the `analytics` capability. |
| get_news_guard_status | Returns the current news guard configuration, enabled state, last poll time, classifier mode (llm/heuristic), and count of alerts raised in the last 24h. Returns { status: 'none' } if no guard is configured. Requires the `analytics` capability. |
| remove_news_guard | Removes the news guard for this license. The guard stops polling immediately. Returns { removed: true } on success. Requires the `analytics` capability. |
| get_market_context | Returns live cross-asset context in one call: DXY (broad USD), VIX (equity-vol risk regime), and the US 10Y yield — each with level, short-horizon (5-day) change, asof, and source — plus a transparent risk_tone (risk_on / neutral / risk_off) derived from a documented VIX+DXY heuristic. Reads the server-side market-snapshot foundation; works with no terminal connected (incl. MT4). Degrades transparently: unavailable inputs are listed in missing_inputs, never zeroed; risk_tone is 'unknown' unless both VIX and DXY are present. Returns MARKET_CONTEXT_UNAVAILABLE only when no input can be sourced. This is the raw-feed reader that get_risk_regime (a composite score) is not. Requires the `analytics` capability (Team+ tier). |
纠错与举报(发现条目失效、署名有误或涉及侵权?)
提交举报 / 纠错
侵权举报经核验成立后,我们会即时下线该条目并删除已存的内容副本。