Skip to content
Back to search

isolated-mcp-trading-floor

Project 25: Four-persona autonomous MCP trading floor with isolated per-trader memory namespaces, market-hours gates, tick_run_id idempotency, and transactional SQLite accounts.

Safety scan

A static text scan, not a guarantee. Select the badge to see what was scanned and every finding.

Checked today
Badge for your README
findsafeskills safety rating

Markdown

[![findsafeskills safety rating](/api/listings/pra986--isolated-mcp-trading-floor/badge.svg)](/listings/pra986--isolated-mcp-trading-floor)

HTML

<a href="/listings/pra986--isolated-mcp-trading-floor"><img src="/api/listings/pra986--isolated-mcp-trading-floor/badge.svg" alt="findsafeskills safety rating" /></a>

Install

i

Install instructions from the README

As written by the repo's author. findsafeskills has not verified these steps.

python -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
cp .env.example .env
pytest

---

What was scanned

The files the safety scan read, as written by the repository's author and shown as plain text. Lines with a finding are marked.

README.md · README · 73 lines
  1. # Isolated MCP Trading Floor (Project 25)
  2. **A8: Agentic Track — MCP Trading Floor**
  3. Four-persona autonomous Model Context Protocol (MCP) trading floor with isolated per-trader memory namespaces, market-hours gates, `tick_run_id` idempotency, and transactional SQLite accounts.
  4. ---
  5. ## Architecture
  6. The system coordinates four distinct autonomous trading personas over standardized MCP tool servers while guaranteeing strict state, memory, and ledger isolation between traders:
  7. - **Trader Personas (4):**
  8. - **Value (`warren`)** — Fundamental long-term value investing.
  9. - **Macro (`george`)** — Global macro, rates, and currency-driven positioning.
  10. - **Systematic (`ray`)** — Risk-parity and diversified factor allocation.
  11. - **Innovation (`cathie`)** — High-conviction disruptive growth equities.
  12. - **MCP Server Topology:**
  13. - **Accounts MCP Server** — Exposes `get_account`, `buy_shares`, `sell_shares`, `get_holdings`, and `get_transactions` backed by transactional SQLite.
  14. - **Market Data MCP Server** — Exposes `lookup_share_price`, `is_market_open`, and historical/snapshot quotes with deterministic offline fallback.
  15. - **Memory MCP Server** — Namespaced per-trader SQLite/graph memory (`memory_<trader_id>`) preventing cross-persona memory leakage.
  16. - **Audit & Notification MCP Server** — Records structured tick logs and trade alerts keyed by `tick_run_id`.
  17. ---
  18. ## 6-Stage Workflow
  19. 1. **Market-Hours Gate:** Evaluates exchange calendar and market-hours rules (with configurable override for backtest/paper simulation). Halts trade execution cleanly when the market is closed.
  20. 2. **Idempotent Tick Initialization (`tick_run_id`):** Registers a unique `tick_run_id` per `(trader_id, schedule_slot)` in SQLite. Duplicate or retried triggers with an already-committed `tick_run_id` short-circuit without re-executing orders.
  21. 3. **Isolated Context & Memory Hydration:** Loads only the active trader's account state, open positions, and isolated memory namespace (`namespace=trader_id`).
  22. 4. **Persona Research & Decision Loop:** The trader agent queries Market Data and Memory MCP tools within a bounded turn budget to formulate buy/sell/hold decisions.
  23. 5. **Transactional SQLite Settlement:** Executes `buy_shares` / `sell_shares` inside an atomic SQLite transaction (`BEGIN IMMEDIATE ... COMMIT` / `ROLLBACK` on insufficient funds or shares), updating cash, holdings, and `transactions` together.
  24. 6. **Valuation, Reflection & Audit Commit:** Computes mark-to-market portfolio value, persists post-trade reflections to the trader's isolated memory namespace, and marks `tick_run_id` as `committed`.
  25. ---
  26. ## Data Contract
  27. | Entity | Key Fields | Guarantees |
  28. | --- | --- | --- |
  29. | `Account` | `name`, `balance`, `strategy`, `holdings_json`, `portfolio_value_time_series` | Non-negative cash balance; atomic updates |
  30. | `Transaction` | `id`, `account_name`, `symbol`, `quantity`, `price`, `timestamp`, `rationale` | Append-only ledger tied to settled trades |
  31. | `TickRun` | `tick_run_id`, `trader_id`, `status` (`started`/`committed`/`skipped`), `created_at` | Primary-key uniqueness enforces idempotency |
  32. | `MemoryEntry` | `namespace` (`trader_id`), `entity`, `observation`, `updated_at` | Strict `WHERE namespace = ?` isolation |
  33. ---
  34. ## Production Controls
  35. - **Isolated Per-Trader Memory Namespaces:** Every memory read/write requires an explicit `trader_id` namespace; cross-trader queries are rejected at the storage layer.
  36. - **Market-Hours Gates:** Prevents live or simulated order placement outside configured trading windows unless `FORCE_MARKET_OPEN=true` is explicitly set for testing.
  37. - **`tick_run_id` Idempotency:** Safely handles scheduler retries and crash recovery without double-buying or double-selling.
  38. - **Transactional SQLite Accounts:** Uses WAL mode and `BEGIN IMMEDIATE` transactions with rollback on validation or constraint errors.
  39. - **No Unaudited Side Effects:** Secrets and API keys are loaded strictly from environment variables (`.env`), never hardcoded.
  40. ---
  41. ## Local Setup
  42. ```bash
  43. python -m venv .venv
  44. source .venv/bin/activate
  45. pip install -r requirements.txt
  46. cp .env.example .env
  47. pytest
  48. ```
  49. ---
  50. ## Attribution
  51. Architecture and domain foundation adapted with pinned attribution from `ed-donner/agents` (`6_mcp/backend`).
  52. gates, tick_run_id idempotency, and transactional SQLite accounts.

Ratings and comments

Sign in to rate this skill.

Sign in

Free to use. If it’s helped, pass it on.