Skip to main content

MCP memory system for AI trading agents. Store, recall, and learn from past trades.

Project description

TradeMemory Protocol


TradeMemory Protocol is an MCP server that gives AI trading agents persistent memory across sessions. Instead of forgetting every trade after each conversation, your agent stores decisions, discovers patterns, and adjusts strategy automatically — using a three-layer architecture inspired by ACT-R cognitive science.

When to use this: You're building an AI agent that trades forex, crypto, or equities via MT5, Binance, Alpaca, or any platform — and you want it to remember what worked, what didn't, and why.

How it works

  1. Store — Your agent records trades with context (strategy, confidence, market regime) via MCP tools
  2. Recall — Before the next trade, the agent retrieves similar past trades weighted by outcome (Outcome-Weighted Memory)
  3. Evolve — The Evolution Engine discovers patterns across trades and generates new strategy hypotheses, validated with Deflated Sharpe Ratio

When to use TradeMemory vs alternatives

TradeMemory Raw Mem0/Qdrant LangChain Memory Custom SQLite
Trade-specific schema ✅ L1→L2→L3 pipeline ❌ Generic vectors ❌ Chat-oriented ❌ DIY everything
Outcome weighting ✅ Kelly + ACT-R ❌ Cosine only ❌ Recency only ❌ Manual
Strategy evolution ✅ Built-in engine ❌ Not included ❌ Not included ❌ Not included
MCP native ✅ 15 tools ❌ Custom wrapper ❌ Custom wrapper ❌ Custom wrapper
Statistical validation ✅ DSR + walk-forward ❌ None ❌ None ❌ None

News

  • [2026-03] Onboarding CLItradememory setup wizard, doctor health check, 8-platform config generator
  • [2026-03] v0.5.0 — Evolution Engine + OWM 5 memory types. 1,087 tests. Release Notes
  • [2026-03] Statistical Validation — Strategy E passes P100% random baseline, Sharpe 3.24 walk-forward
  • [2026-03] Live Paper Trading — Strategy E running on Binance via GitHub Actions (hourly)
  • [2026-02] v0.4.0 — OWM Framework, 15 MCP tools, Smithery + Glama listed

Architecture

Architecture

Three-Layer Memory

L1 L2 L3 Memory Pipeline

Quick Start

pip install tradememory-protocol

Add to claude_desktop_config.json:

{
  "mcpServers": {
    "tradememory": {
      "command": "uvx",
      "args": ["tradememory-protocol"]
    }
  }
}

Then tell Claude: "Record my BTCUSDT long at 71,000 — momentum breakout, high confidence."

Claude Code / Cursor / Docker
# Claude Code
claude mcp add tradememory -- uvx tradememory-protocol

# From source
git clone https://github.com/mnemox-ai/tradememory-protocol.git
cd tradememory-protocol && pip install -e . && python -m tradememory

# Docker
docker compose up -d

Setup & Configuration

First-time guided setup:

tradememory setup

This walks you through:

  1. Terms acceptance — trading disclaimer and data storage policy
  2. Platform detection — auto-detects Claude Desktop, Claude Code, Cursor, Windsurf, Cline
  3. Config generation — prints the exact JSON snippet for your platform
  4. Health check — verifies database, MCP tools, and core functionality

Platform Configs

Generate config for any supported platform:

tradememory config              # interactive menu
tradememory config claude_code  # direct: auto-installs via CLI
tradememory config cursor       # prints .cursor/mcp.json snippet
tradememory config windsurf     # prints Windsurf config
tradememory config raw_json     # generic MCP JSON

Supported: Claude Desktop · Claude Code · Cursor · Windsurf · Cline · Smithery · Docker

Health Check

tradememory doctor        # core checks (~3s)
tradememory doctor --full # + REST API, MT5, Anthropic API

MCP Tools (15)

Category Tools
Core Memory store_trade_memory · recall_similar_trades · get_strategy_performance · get_trade_reflection
OWM Cognitive remember_trade · recall_memories · get_behavioral_analysis · get_agent_state · create_trading_plan · check_active_plans
Evolution evolution_run · evolution_status · evolution_results · evolution_compare · evolution_config
REST API (30+ endpoints)

Trade recording, outcome logging, history, reflections, risk constraints, MT5 sync, OWM, evolution.

Full reference: docs/API.md

OWM — Outcome-Weighted Memory

OWM 5 Factors

Full theoretical foundation: OWM Framework

Evolution Engine

Evolution Engine

Methodology & data: Research Log

Documentation

Doc Description
Architecture System design & layer separation
OWM Framework Full theoretical foundation
Tutorial Install → first trade → memory recall
API Reference All REST endpoints
MT5 Setup MetaTrader 5 integration
Research Log 11 evolution experiments
Roadmap Development roadmap
中文版 Traditional Chinese

Contributing

See Contributing Guide · Security Policy

Star History

MIT — see LICENSE. For educational/research purposes only. Not financial advice.

Built by Mnemox

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

tradememory_protocol-0.5.1.tar.gz (279.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

tradememory_protocol-0.5.1-py3-none-any.whl (182.1 kB view details)

Uploaded Python 3

File details

Details for the file tradememory_protocol-0.5.1.tar.gz.

File metadata

  • Download URL: tradememory_protocol-0.5.1.tar.gz
  • Upload date:
  • Size: 279.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for tradememory_protocol-0.5.1.tar.gz
Algorithm Hash digest
SHA256 0c1d8e510c5d7ad134303756e0c240cea00ed3fb1c7977f3283579b3187deaf4
MD5 a33cc6ffa38f0b5f14a2cc2168ae09eb
BLAKE2b-256 28490c0ac1405e58c8626ec1ba2e9df215af9844085b62d8797306b42ac931b9

See more details on using hashes here.

Provenance

The following attestation bundles were made for tradememory_protocol-0.5.1.tar.gz:

Publisher: publish.yml on mnemox-ai/tradememory-protocol

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file tradememory_protocol-0.5.1-py3-none-any.whl.

File metadata

File hashes

Hashes for tradememory_protocol-0.5.1-py3-none-any.whl
Algorithm Hash digest
SHA256 0365c2820caad2da14de543cc6cc56d24fb3f9a420bb704526deefbb9d0f9b5c
MD5 7a55da894db928e89e04fe0e65a76240
BLAKE2b-256 807df686c151b7f64d9eb8518d0781cb74675c980ebc2f018e81c0e06f2ca4b9

See more details on using hashes here.

Provenance

The following attestation bundles were made for tradememory_protocol-0.5.1-py3-none-any.whl:

Publisher: publish.yml on mnemox-ai/tradememory-protocol

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page