MCP memory system for AI trading agents. Store, recall, and learn from past trades.
Project description
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
- Store — Your agent records trades with context (strategy, confidence, market regime) via MCP tools
- Recall — Before the next trade, the agent retrieves similar past trades weighted by outcome (Outcome-Weighted Memory)
- 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 CLI —
tradememory setupwizard,doctorhealth 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
Three-Layer Memory
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:
- Terms acceptance — trading disclaimer and data storage policy
- Platform detection — auto-detects Claude Desktop, Claude Code, Cursor, Windsurf, Cline
- Config generation — prints the exact JSON snippet for your platform
- 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
Full theoretical foundation: OWM Framework
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
MIT — see LICENSE. For educational/research purposes only. Not financial advice.
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0c1d8e510c5d7ad134303756e0c240cea00ed3fb1c7977f3283579b3187deaf4
|
|
| MD5 |
a33cc6ffa38f0b5f14a2cc2168ae09eb
|
|
| BLAKE2b-256 |
28490c0ac1405e58c8626ec1ba2e9df215af9844085b62d8797306b42ac931b9
|
Provenance
The following attestation bundles were made for tradememory_protocol-0.5.1.tar.gz:
Publisher:
publish.yml on mnemox-ai/tradememory-protocol
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
tradememory_protocol-0.5.1.tar.gz -
Subject digest:
0c1d8e510c5d7ad134303756e0c240cea00ed3fb1c7977f3283579b3187deaf4 - Sigstore transparency entry: 1188896437
- Sigstore integration time:
-
Permalink:
mnemox-ai/tradememory-protocol@1fe738184496a3ee23ccb9018643164b99cf3ac7 -
Branch / Tag:
refs/tags/v0.5.1 - Owner: https://github.com/mnemox-ai
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@1fe738184496a3ee23ccb9018643164b99cf3ac7 -
Trigger Event:
release
-
Statement type:
File details
Details for the file tradememory_protocol-0.5.1-py3-none-any.whl.
File metadata
- Download URL: tradememory_protocol-0.5.1-py3-none-any.whl
- Upload date:
- Size: 182.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0365c2820caad2da14de543cc6cc56d24fb3f9a420bb704526deefbb9d0f9b5c
|
|
| MD5 |
7a55da894db928e89e04fe0e65a76240
|
|
| BLAKE2b-256 |
807df686c151b7f64d9eb8518d0781cb74675c980ebc2f018e81c0e06f2ca4b9
|
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
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
tradememory_protocol-0.5.1-py3-none-any.whl -
Subject digest:
0365c2820caad2da14de543cc6cc56d24fb3f9a420bb704526deefbb9d0f9b5c - Sigstore transparency entry: 1188896447
- Sigstore integration time:
-
Permalink:
mnemox-ai/tradememory-protocol@1fe738184496a3ee23ccb9018643164b99cf3ac7 -
Branch / Tag:
refs/tags/v0.5.1 - Owner: https://github.com/mnemox-ai
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@1fe738184496a3ee23ccb9018643164b99cf3ac7 -
Trigger Event:
release
-
Statement type: