MCP trading gateway for AI agents: IRL pre-trade policy, sealed rationale, and verifiable fills.
pip install irl-gateway==0.3.1 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:
uvx irl-gateway init That one command gets a free paper-tier token from norve.dev, registers your agent with a starter mandate (BTC/USDT and ETH/USDT, at most 1,000 USDT per order, on paper-binance), saves the credentials to ~/.irl-gateway/agent.json (or $IRL_GATEWAY_HOME, or --home), and prints:
Paste one of them, then ask the agent to call get_policy and make its first paper trade. Paper fills are simulated at live public Binance prices with Binance's real order-size rules, so no exchange keys are needed.
The server reads the token from agent.json, so neither config contains it. In the mcpServers block, command is the absolute path of uvx on your machine: desktop apps such as Claude Desktop on macOS don't inherit your shell's PATH, and a bare "uvx" fails there with spawn uvx ENOENT. init only takes uvx from absolute PATH entries other than the current directory, so a uvx dropped into the folder you run it from never ends up in your config. If it can't find one, it prints "uvx" with a warning; replace it with the output of which uvx (macOS/Linux) or where uvx (Windows).
agent.json holds your token. On macOS and Linux, init creates it with mode 600 (only you can read it). On Windows its access comes from the folder's permissions: inside your user profile (the default) other users can't read it, but with --home or IRL_GATEWAY_HOME pointing outside the profile it may be readable by others, so keep it in a private folder.
Running init again doesn't sign up again: it finds the existing agent.json and prints the config. Use --force to register a new agent. The previous file is kept as agent.json. .bak, and it still holds the old token: delete it, or revoke that token, once you no longer need it.
Options: --name, --assets BTC/USDT,SOL/USDT, --max-notional 250, --contact you@example.com (so we can reach you), --server (your own IRL engine), --home (where to keep agent.json), --force.
Run irl-gateway --help or --version at any time. If the server starts without any configuration, it says so on stderr and tells you to run uvx irl-gateway init.
Free tier limits: paper venues only, up to 3 agents and 500 authorizations a day per token. Want to trade live, or run without limits? Self-host the engine or ask for a full token.
curl -X POST https://norve.dev/irl/signup -H "Content-Type: application/json" -d '{"client_name": "my-claude-trader"}' # -> {"token": "...", "tier": "paper", ...} (shown once) curl -X POST https://norve.dev/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:
{ "mcpServers": { "irl-gateway": { "command": "uvx", "args": ["irl-gateway"], "env": { "IRL_BASE_URL": "https://norve.dev", "IRL_API_TOKEN": "…", "IRL_AGENT_ID": " ", "IRL_MODEL_HASH": " ", "AGENT_MODEL_ID": "claude-opus-5-5", "PAPER_BALANCES": "USDT=1000" } } } } Configuration Variable Default Meaning IRL_BASE_URL, IRL_API_TOKEN from agent.json IRL server and bearer token IRL_AGENT_ID, IRL_MODEL_HASH from agent.json The registered agent and its model hash AGENT_MODEL_ID unspecified-model Model name sealed into each trace (the agent can override it per trade) AGENT_CONFIG_CHECKSUM none Optional checksum of the agent's configuration, sealed into each trace IRL_L2_MODE off regime if your IRL server requires Layer 2 regime binding GATEWAY_BROKER paper paper or exchange EXCHANGE_ID binance Any ccxt exchange id; also the price source for paper trading EXCHANGE_API_KEY, EXCHANGE_API_SECRET Required for exchange EXCHANGE_TESTNET true Use the exchange's testnet PAPER_BALANCES USDT=1000 Starting paper balances (used only until paper_state.json exists; the paper account then persists across restarts) IRL_GATEWAY_HOME ~/.irl-gateway Location of agent.json, the journal (journal.jsonl), the kill switch (KILL) and the paper account (paper_state.json) Environment variables take priority over agent.json, and empty values count as unset. The identity (IRL_API_TOKEN, IRL_AGENT_ID, IRL_MODEL_HASH) is never mixed: set all three in the environment, or none of them to use the file. The file's token is only sent to the server it was issued for: if IRL_BASE_URL points elsewhere, the gateway refuses to start. agent.json can't set the broker or exchange keys, so a file on disk never switches the gateway to a live account. On macOS and Linux the gateway refuses an agent.json owned by another user or writable by group or others, and warns if it is readable by them (fix either with chmod 600 ~/.irl-gateway/agent.json).
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.
Both files in this release have provenance metadata.
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 Nov 17, 2026.
Both files in this release have been uploaded with provenance metadata.
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.
Oct 7, 2026 2 release files Change of provenance
Oct 6, 2026 2 release files Change of provenance




