MCP trading gateway for AI agents: IRL pre-trade policy, sealed rationale, and verifiable fills.
pip install irl-gateway Copy PIP instructions
Give your AI agent a trading account it can't misuse, and a record of every decision it can't rewrite.
IRL Gateway is an MCP server that sits between an AI agent (Claude, ChatGPT, or your own) and an exchange account. Every order the agent places goes through the IRL Engine:
When something goes wrong, you can prove what the agent was allowed to do, what it said it was doing, and what actually happened.
AI agent ── MCP ──> irl-gateway ──> IRL: authorize (policy + sealed rationale) │ ├──────> exchange: market order (client id = sealed intent) │ └──────> IRL: bind fill -> MATCHED / DIVERGENT Tools Tool What it does execute_trade(symbol, side, rationale, quantity | notional) The only tool that moves money. Spot market order through authorize → place → bind. Returns filled, denied, blocked or failed, with the IRL trace_id and verdict. get_policy() The agent's mandate as IRL enforces it, plus the local kill-switch state. get_quote(symbol) Last price on the gateway's venue. get_balances() Free balances (paper or exchange). get_trace(trace_id) IRL's sealed record of one trade. list_recent_trades(limit) Local journal: rationale, context hash, trace id and outcome per trade. Behaviour the agent can rely on:
You need an IRL server and an agent registered on it. Paper trading is the default: fills are simulated at live public Binance prices, and no exchange keys are needed.
pip install irl-gateway # or run it without installing: uvx irl-gateway Register the agent once, with its mandate:
curl -X POST "$IRL_BASE_URL/irl/agents" -H "Authorization: Bearer $IRL_API_TOKEN" \ -H "Content-Type: application/json" -d '{ "name": "my-claude-trader", "model_hash_hex": " ", "max_notional": 100, "allowed_assets": ["BTC/USDT", "ETH/USDT"], "allowed_venues": ["paper-binance"] }' Then add the gateway to your MCP client, for example Claude Code or Claude Desktop:
{ "mcpServers": { "irl-gateway": { "command": "uvx", "args": ["irl-gateway"], "env": { "IRL_BASE_URL": "https://irl.example.com", "IRL_API_TOKEN": "…", "IRL_AGENT_ID": " ", "IRL_MODEL_HASH": " ", "AGENT_MODEL_ID": "claude-opus-5-5", "PAPER_BALANCES": "USDT=1000" } } } } Ask the agent to check get_policy, then trade.
The venue IRL sees is the exchange id (binance), or paper- for paper trading, so a mandate can allow paper trading while denying the real account.
For each trade the gateway builds a context of the rationale, symbol, side, quantity, reference price, venue, model id and client order id. It hashes that context as canonical JSON (sorted keys, no whitespace) with SHA-256 and sends the hash to IRL as prompt_version = "ctx-sha256: ", which IRL seals into the trace's reasoning_hash.
The journal stores the full context next to its hash, so anyone holding a journal line can recompute the hash and match it to the sealed trace. IRL itself never sees the rationale's text.
python -m venv .venv && .venv/bin/pip install -e ".[dev]" pytest --cov=irl_gateway ruff check src tests && black --check src tests && isort --check-only src tests && mypy src Status Early (0.1). Spot market orders only. Paper trading and ccxt exchanges are supported; Alpaca is next. Not investment advice, and no strategy is included: the gateway controls and records what your agent does, it does not decide.
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 6, 2026.




