# mnemox-ai/tradememory-protocol [Health: Active]

**Category:** 💰 Finance & Fintech  
**Repository:** https://github.com/mnemox-ai/tradememory-protocol  
**GitHub Stars:** 1450  
**Views:** 12  
**Installs:** 0  
**Upvotes:** 0  
**Directory Page:** https://allmcps.com/mcp/mnemox-ai-tradememory-protocol

## Description
Glama 🐍 🏠 - Structured 3-layer memory system (trades → patterns → strategy) for AI trading agents. Supports MT5, Binance, and Alpaca.

## Tools
Capabilities this server exposes over MCP:

- **get_strategy_performance** — Get aggregate performance stats per strategy.

Use this to evaluate which strategies are working and which need adjustment.
- **get_trade_reflection** — Get the full context and reflection for a specific trade.

Use this to deep-dive into a particular trade's reasoning and lessons.
- **remember_trade** — Store a trade into OWM multi-layer memory with automatic updates.

Writes to episodic memory and automatically updates semantic (Bayesian),
procedural (running averages + hold time + Kelly), and affective
(EWMA confidence/streaks). Also writes to trade_records for backward
compatibility.
- **recall_memories** — Recall memories using OWM outcome-weighted scoring.

Queries episodic and semantic memories, scores them by outcome quality,
context similarity, recency, confidence, and affective modulation.
Returns ranked memories with score breakdown.

Use order="losses_first" right before placing a trade: losing trades
taken in similar conditions rank first, and the current mood (a losing
streak) no longer pushes them down.
- **get_behavioral_analysis** — Get behavioral analysis from procedural memory.

Returns aggregate trading behavior stats: hold times, disposition ratio,
lot sizing variance, and Kelly criterion comparison.
- **get_agent_state** — Get the current agent affective state (confidence, risk, drawdown).

Returns confidence level, risk appetite, drawdown percentage,
win/loss streaks, equity tracking, and a recommended action
based on current drawdown severity.
- **create_trading_plan** — Create a prospective trading plan that activates when conditions are met.

Stores a rule-based plan in prospective memory. The plan stays active
until triggered, expired, or manually cancelled.
- **check_active_plans** — Check active trading plans against current market context.

Queries all active prospective plans, expires any past their expiry date,
and matches remaining plans against the provided context.
- **evolution_fetch_market_data** — Fetch OHLCV market data from Binance for evolution analysis.

Downloads historical price bars for backtesting and pattern discovery.
Use this before discover_patterns or run_backtest to get data.
- **evolution_discover_patterns** — Discover trading patterns from market data using LLM analysis.

Uses Claude to analyze OHLCV data and generate candidate trading patterns
with entry/exit conditions. Each pattern can be backtested afterward.
- **evolution_run_backtest** — Backtest a candidate pattern against historical OHLCV data.

Takes a pattern dict (from discover_patterns) and runs a vectorized
backtest. Returns fitness metrics: Sharpe ratio, win rate, trade count,
max drawdown, total PnL.
- **evolution_evolve_strategy** — Run full evolution loop — generate, backtest, select, eliminate.

Multi-generation strategy evolution: generates candidate patterns via LLM,
backtests on in-sample data, validates survivors on out-of-sample data,
eliminates weak hypotheses. Returns graduated strategies and graveyard.
- **evolution_get_log** — Get the log of past evolution runs from this session.

Returns a list of all evolution runs with their results, including
graduated strategies, graveyard, token usage, and backtest counts.
Data is in-memory (resets on server restart).
- **export_audit_trail** — Export Trading Decision Records for audit and compliance review.

Provides a complete, tamper-evident record of trading decisions including
the memory context (similar trades, beliefs) that informed each decision.
- **verify_audit_hash** — Verify the integrity of a Trading Decision Record.

Recomputes the SHA256 data_hash from stored inputs and compares with
the hash computed at decision time. A mismatch indicates tampering.
- **verify_audit_chain** — Verify the integrity of the audit chain.

Walks the chain from `from_seq` (default: 1, the genesis record) to
`to_seq` (default: latest), checking that every record's `prev_hash`
matches the previous record's `data_hash`, and that each `data_hash`
equals SHA256(prev_hash || content_hash).

Returns a dict with `verified`, `checked_count`, `first_break_at`,
`reason`. A `first_break_at` of None with `verified=True` means the
chain is intact across the verified range.
- **get_daily_root** — Get (or rebuild) the daily Merkle root for a UTC date.

The Merkle root summarises every audit_chain entry whose `chained_at`
falls inside the UTC day. Verifying this single 32-byte root proves
the integrity of every TDR for that day without re-walking each one.
- **validate_strategy** — Validate a trading strategy using statistical tests (DSR + Walk-Forward + Regime + CPCV).

For educational and research purposes only. Not financial advice.

Upload a trade log CSV (QuantConnect format) or daily returns CSV.
The tool runs four statistical tests:
1. Deflated Sharpe Ratio (DSR) — detects overfitting from multiple testing
2. Walk-Forward Validation — checks out-of-sample consistency
3. Regime Analysis — performance across bull/bear/crisis markets
4. CPCV — cross-validated Sharpe stability across time periods
- **check_trade_legitimacy** — Check if the agent has sufficient data and confidence to trade.

Call this before making any trade decision. Evaluates sample size,
memory quality, regime experience, streak state, and drawdown to
determine whether the agent has earned the right to trade at full size.
- **compute_dqs** — Compute Decision Quality Score before executing a trade.

Evaluates the quality of the decision *process* (not outcome) across
5 factors: regime match, position sizing vs Kelly, process adherence
(OWM similarity), risk state, and historical pattern.

## Claude Desktop Quick Installation
Install path detected from listing signals. Uses `uvx` (confidence: high):

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

## Documentation

## What mnemox-ai/tradememory-protocol MCP server does

The mnemox-ai/tradememory-protocol MCP server provides a memory and governance layer for trading agents. It records trade details, outcomes, reasoning, market conditions, and related state so an agent can retrieve relevant prior decisions instead of relying only on its current context window.

The system is designed for stocks, forex, crypto, futures, and other markets. The repository describes use with MT5, Binance, and Alpaca, while also stating that the server does not place orders or manage funds. Execution remains the responsibility of a separate broker or trading system.

Trade records update episodic, semantic, procedural, affective, and trade-oriented memory. The server also supports trading plans, strategy performance, reflections, behavioral analysis, confidence tracking, drawdown and losing-streak checks, and pre-trade legitimacy decisions.

## How it works

A typical workflow has four stages. Before a trade, `recall_memories` retrieves prior experiences using factors including outcome quality, context similarity, recency, confidence, and emotional state. The agent can then use `check_trade_legitimacy` as a five-factor pre-trade gate that returns a full, reduced, or skip decision.

Afterward, `remember_trade` records the decision and updates the memory layers. Scheduled reviews can use reflection and behavioral tools to identify trading mistakes, behavioral drift, or strategy decay. Planning tools support prospective decisions with conditional triggers.

Audit records receive SHA-256 content hashes when created. The repository also describes a forward-linked audit chain and daily Merkle roots, with tools for checking individual hashes, validating chain ranges, retrieving daily roots, and exporting records for review.

## Setup and configuration

The mnemox-ai/tradememory-protocol MCP server can be installed from PyPI:

```bash
pip install tradememory-protocol
```

For a local MCP client, the documented launch command is:

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

The README specifically shows configuration for Claude Desktop and a corresponding `claude mcp add` command for Claude Code. It also documents running from a source checkout with editable installation, plus a Docker Compose option. The project is self-hosted; no hosted service is planned according to its stated maintenance status.

## Tools and capabilities

The documented MCP tool groups include:

- Memory: `remember_trade`, `recall_memories`, `get_strategy_performance`, and `get_trade_reflection`
- State and behavior: `get_agent_state` and `get_behavioral_analysis`
- Planning: `create_trading_plan` and `check_active_plans`
- Risk and governance: `check_trade_legitimacy`, `validate_strategy`, and `compute_dqs`
- Evolution: market-data retrieval, pattern discovery, backtesting, strategy evolution, and evolution logs
- Audit: `export_audit_trail`, `verify_audit_hash`, `verify_audit_chain`, and `get_daily_root`

The repository also describes a REST API with more than 35 endpoints covering trade records, reflections, risk, MT5 synchronization, OWM functions, evolution, and audit operations.

## Limitations and notes

The mnemox-ai/tradememory-protocol MCP server is in feature-complete maintenance mode. It records and analyzes trading decisions; it is not an execution server, investment-advice system, or source of trade signals.

The repository’s audit documentation includes maturity limitations for some planned audit features, including TSA timestamping. Review `LIMITATIONS.md` before treating the audit output as sufficient for a particular regulatory process. The paid offering described by the maintainer is separate statistical analysis of user-provided trading records, not a required component of the self-hosted server.

_Full upstream README: https://allmcps.com/mcp/mnemox-ai-tradememory-protocol/readme_

