Open Source MCP Server

AI Trading Memory for MT5/Forex Traders

Your AI agent forgets every trade after each session. TradeMemory gives it persistent memory — store decisions, discover patterns, evolve strategy automatically via MCP.

Get Started View on GitHub
claude desktop — tradememory session
You: Store my XAUUSD trade: long 0.10 lots, +$1,175
Trade stored: MT5-2350458751 | strategy=VolBreakout
 
You: Run a reflection on my last 73 trades
Analyzing 73 trades across 4 strategies...
Pattern: IntradayMomentum BUY  PF=2.11 return=+166% n=73
Pattern: MeanReversion     SELL PF=0.79 return=−21%  n=36
 
L3 Adjustment: MeanReversion SELL → disable (consistent losses)
L3 Adjustment: IntradayMomentum BUY → increase size 1.2x
Memory updated. 3 layers synced. 10,169 trades analyzed.
399
Tests Passing
5
Memory Types
10
MCP Tools
MIT
Licensed

Everything your trading agent needs to remember.

Six capabilities that turn a stateless AI into a learning trading partner.

OWM Architecture

Outcome-Weighted Memory

5 cognitive memory types: Episodic, Semantic, Procedural, Affective, Prospective. Each trade scored by outcome quality, context similarity, recency, and confidence.

Score = Q × Sim × Rec × Conf × Aff
AI Reflection

Reflection Engine

Rule-based analysis finds patterns in your trade history — win rates by session, strategy, confidence level. Optional LLM layer for deeper insights.

reflection: london_session WR=73% ✓ strong
reflection: asia_session WR=38% ✗ weak
Pattern Discovery

Automatic Pattern Mining

L2 discovers which strategies, sessions, and conditions produce winners. L3 generates actionable adjustments: disable losers, size up winners.

pattern: IntradayMomentum BUY +47% n=73
pattern: MeanReversion     SELL -21% n=36
📋
Daily Reports

Automated Daily Reflection

Schedule daily_reflection.py to run at market close. Summarizes P&L, flags anomalies, and updates memory layers automatically.

$ python daily_reflection.py
Daily P&L: +$1,175.09 (1 trade)
Patterns updated. Report saved.
📊
Behavioral Analysis

Bias Detection

Procedural memory tracks trading behaviors. Detects overtrading, revenge trading, and session-specific biases from your trade history.

overtrading: 3 trades in 12min flag
revenge: loss→re-entry 2min flag
Position Sizing

Kelly-from-Memory

Context-weighted Kelly Criterion using recalled win rates and payoff ratios. Quarter-Kelly default with risk appetite adjustment.

kelly_fraction: 0.12
recommended_size: 0.03 lots

Dual Architecture

Legacy L1→L2→L3 pipeline plus OWM cognitive memory. Both work side by side.

L1
LAYER 1 — RAW TRADES

Trade Storage

Every trade recorded with full context: instrument, direction, lots, entry/exit prices, P&L, strategy name, session, reasoning, and confidence score.

"instrument": "XAUUSD"
"direction": "long"
"pnl": +1175.09
"strategy": "VolBreakout"
L2
LAYER 2 — PATTERNS

Pattern Discovery

Reflection engine analyzes L1 data to find statistically significant patterns. Groups by strategy, session, direction, and confidence level.

london_breakout: WR 73% n=41
asia_reversal: WR 38% n=12
high_confidence: WR 68% n=55
L3
LAYER 3 — ADJUSTMENTS

Strategy Tuning

Auto-generates actionable adjustments from L2 patterns. Disable losing strategies, prefer winning sessions, adjust position sizes, restrict directions.

asia_reversal: size × 0.5
mean_reversion: disable SELL
london_breakout: full size
OWM
OWM — COGNITIVE MEMORY

Outcome-Weighted Recall

5 memory types scored by outcome quality, context similarity, recency, confidence, and affective state. Based on ACT-R cognitive architecture.

Score = Q × Sim × Rec × Conf × Aff

Install in 60 seconds.

Works with Claude Desktop, Claude Code, Cursor, Windsurf, and any MCP client.

Recommended

Claude Desktop

Add to your claude_desktop_config.json and restart Claude Desktop.

uvx tradememory-protocol click to copy
CLI

Claude Code

One command to add TradeMemory as an MCP server.

claude mcp add tradememory -- uvx tradememory-protocol click to copy
PyPI

pip install

Install from PyPI for custom integrations or development.

pip install tradememory-protocol click to copy
claude_desktop_config.json
{
  "mcpServers": {
    "tradememory": {
      "command": "uvx",
      "args": ["tradememory-protocol"]
    }
  }
}

10 tools. Full cognitive memory pipeline.

Core tools for storage and analysis. OWM tools for cognitive recall, behavioral analysis, and position sizing. Your AI agent calls these tools via the Model Context Protocol.

store_trade
Record a trade with full context: instrument, direction, lots, prices, P&L, strategy, reasoning.
recall_trades
Query trade history with filters: date range, instrument, strategy, session, direction.
get_performance
Calculate win rate, profit factor, average P&L, max drawdown, and Sharpe ratio.
run_reflection
Analyze trade history, discover patterns (L2), and generate strategy adjustments (L3).
OWM Tools (v0.4.0)
remember_trade
Store trade as episodic memory, auto-update semantic/procedural/affective layers.
recall_memories
Outcome-weighted recall with score breakdown per component.
get_behavioral_analysis
Procedural memory bias detection: overtrading, revenge trading, disposition effect.
get_agent_state
Affective state: confidence, risk appetite, drawdown tracking, recommended action.
create_trading_plan
Prospective memory: conditional plans triggered by market conditions.
check_active_plans
Match active plans against current market context, auto-expire old plans.
Coming Soon

Hosted API. Zero infrastructure.

Self-host free forever. Or let us handle the infrastructure — cloud API with guaranteed uptime, auto-scaling, and team dashboards.

Trader
$29/mo

For individual traders running 1–2 strategies on a single account.

  • 1,000 API credits/month
  • 1 trading account
  • Full L1–L3 memory pipeline
  • Daily reflection reports
  • 7-day data retention
  • Community support
Coming Soon
Fund
$299/mo

For prop firms and funds managing multiple traders and strategies.

  • 25,000 API credits/month
  • Unlimited trading accounts
  • Full L1–L3 memory pipeline
  • Team dashboard & role management
  • Unlimited data retention
  • Dedicated support & SLA
Coming Soon

Pay-as-you-go credits

Need more? Buy additional credits anytime. No commitment, no expiry. Every API call — store, recall, reflect — costs 1 credit.

Pack
Credits
Price
Starter
1,000
$10
Growth
5,000
$40
Scale
25,000
$150

Get early access pricing

Join the waitlist. Early bird subscribers get 50% off the first 3 months.

No spam. We'll only email you when the hosted API launches.

✓ You're on the list! We'll notify you at launch.

Stop trading without memory.

Install TradeMemory Protocol and let your AI agent learn from every trade.

View on GitHub PyPI Package Mnemox Home