TradeMemory Protocol

Local trade journal, outcome-weighted recall and hash-chained decision log for trading agents

By mnemox-ai Python Local · stdio Finance and paymentsKnowledge and memory

44 popularity score ★ 1.4k ↓ 884/mo

Connect your client

Local (PyPI)

Add in one click

Opens the app, which asks before it adds the server.

Or add it by command or config

Claude CodeTerminal
claude mcp add tradememory-protocol -- uvx tradememory-protocol
Claude Desktopclaude_desktop_config.json
{
  "mcpServers": {
    "tradememory-protocol": {
      "command": "uvx",
      "args": [
        "tradememory-protocol"
      ]
    }
  }
}
Cursor~/.cursor/mcp.json
{
  "mcpServers": {
    "tradememory-protocol": {
      "command": "uvx",
      "args": [
        "tradememory-protocol"
      ]
    }
  }
}
VS Code.vscode/mcp.json
{
  "servers": {
    "tradememory-protocol": {
      "type": "stdio",
      "command": "uvx",
      "args": [
        "tradememory-protocol"
      ]
    }
  }
}
Codex~/.codex/config.toml
[mcp_servers.tradememory-protocol]
command = "uvx"
args = ["tradememory-protocol"]
Gemini CLITerminal
gemini mcp add --scope user tradememory-protocol uvx -- tradememory-protocol

Settings 2

ANTHROPIC_API_KEY Optional: Anthropic key for the two LLM evolution tools; also needs the anthropic package.
TRADEMEMORY_TSA Optional: Set to off to stop sending daily audit-root hashes to an RFC 3161 timestamp service (on by default).

What it does

TradeMemory Protocol is a Python MCP server from Mnemox that keeps a record of an agent's trades and the reasoning behind them in a local SQLite database. An agent stores a trade with `remember_trade`, and before its next decision asks `recall_memories` for similar past trades, ranked by how they turned out, how alike the conditions were, how recent they are and how confident the agent was. With `order="losses_first"` the losing trades from similar conditions come back first. The server's own instructions tell connected agents to make that call before proposing a trade.

Around the memory sit planning, risk and review tools: conditional trade plans, a per-strategy check of whether there is enough history to trade at full size, behavioural and performance summaries, and a statistical strategy validator. Each recorded decision is hashed with SHA-256 and chained to the one before, with a Merkle root per UTC day, so later edits show up when the chain is verified or exported.

The package registers 20 MCP tools at version 0.5.6 (counted in `src/tradememory/mcp_server.py`). It also ships a `tradememory` command line that imports fills from Hyperliquid (public, no key) or Alpaca (read-only keys from a local file), and an optional `proxy` extra that sits in front of Alpaca's own MCP server and refuses orders that break a policy you write; that brake is marked preview. The memory server itself never places orders or asks for broker keys.

Its makers state it is for education and research only and is not financial advice.

What it needs

RuntimePython 3.10+

Python 3.10 or later; the launch command uses `uvx`, so uv must be installed. The two LLM evolution tools (`evolution_discover_patterns`, `evolution_evolve_strategy`) need the `anthropic` Python package, which the base install does not bring (add it, e.g. `uvx --with anthropic tradememory-protocol`), plus `ANTHROPIC_API_KEY`. The optional `proxy` brake needs Python 3.12+, `pip install "tradememory-protocol[proxy]"` and an Alpaca account.

Limits

It does not trade: the MCP server records, recalls and checks only. Its own LIMITATIONS.md says the integrated DQS gating behind `compute_dqs` failed the makers' Phase 5 validation and is being recalibrated, the evolution engine is research-stage, and live results so far rest on 14 trades. Storage is single-user SQLite. The audit chain is tamper-evident, not tamper-proof: whoever can rewrite the whole database can rebuild it, and records are not signed with a private key. `recall_memories` returns 10 results by default and `export_audit_trail` 50.

Who it suits

Suits someone running a trading agent who wants it to keep a local journal, see its own losing patterns before the next order, and keep a verifiable log of its decisions, without handing any broker keys to the server. Since it places no orders, it pairs with a broker's own MCP server rather than replacing one. Not a fit for anyone after market data or signals: apart from a Binance price fetch for backtests it works only on trades you record or sync, and several of its scoring parts are, by its makers' account, not yet validated.

Tools 20

remember_trade
Store a trade with its reasoning, size and conditions across the memory layers
recall_memories
Find similar past trades ranked by outcome and similarity; can put losses first
get_strategy_performance
Summary stats for each strategy
get_trade_reflection
Full context and review notes for one trade
get_behavioral_analysis
Patterns in the agent's own trading behaviour
get_agent_state
Current confidence, risk appetite, drawdown and streaks
create_trading_plan
Save a plan that triggers when given conditions are met
check_active_plans
Test saved plans against the current market context
check_trade_legitimacy
Say whether a strategy has the history to trade at full, reduced or no size
validate_strategy
Run statistical tests on a strategy's results
compute_dqs
Score decision quality before a trade
evolution_fetch_market_data
Pull price bars from Binance for research
evolution_discover_patterns
Ask an Anthropic model for candidate patterns in price data
evolution_run_backtest
Backtest one candidate pattern on historical bars
evolution_evolve_strategy
Run several rounds of generating, backtesting and culling strategies
evolution_get_log
List this session's evolution runs
export_audit_trail
Export decision records with the memory context behind them
verify_audit_hash
Check one decision record against its stored hash
verify_audit_chain
Walk the hash chain and report the first break
get_daily_root
Get or rebuild the Merkle root for one UTC day

Similar servers