lockout-mcp
Allows an AI agent to operate a LockoutAccount on Robinhood Chain, reading account and market state and submitting gated buy/sell transactions for listed stock tokens.
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
lockout is a stock-token account on Robinhood Chain for an owner who lets an AI agent trade. Before a session the owner calls seal() with ten rules, a bell (unlockAt) and a $LOCKOUT bond. Until the bell the rules only tighten, and every buy, the agent's or the owner's own, goes through the same buy() and its 21 gates. The buy that meets the loss limit trades nothing and halts the account; from then until the bell every buy reverts, while the account can still sell: the owner's sells under four checks, the agent's inside the feed band. contracts/ holds the factory, the account and a read-only Lens. mcp/ is lockout-mcp, the MCP server that gives an agent seven tools on one account.
rpc=https://rpc.mainnet.chain.robinhood.com
# the bond floor: $LOCKOUT base units per day sealed
cast call 0xeAD444A07f59C89Fb4454F28854245D5D8E1f456 'minBondPerDay()(uint256)' --rpc-url $rpc
# each listed stock: its feed, its pools, the chain's gates on it now, and whether an agent may buy or sell it
cast call 0xfbCAcd8748a473a4778a43B1bCd2dB3B563daA42 'markets()((address,address,bytes32[],(bool,bool,bool,bool,bool,bool,bool,uint256,uint256),bool,bool)[])' --rpc-url $rpcContracts
Robinhood Chain, chain id 4663, deployed in block 123592326.
Contract | Address | Source |
|
| |
|
| |
|
|
createAccount(agent) clones the implementation (OpenZeppelin Clones) for the caller, who becomes the account's owner, and names the agent key; the agent cannot be the owner. The factory keeps the lists every account reads live: listed stocks, their USDG pools on Uniswap v3, MetaDEX and Uniswap v4, one Chainlink feed per stock, the bond token and its per-day floor. Its usdg, registry, accountImplementation and the three venue addresses are immutable. The account enforces the rules. The Lens only reads: previewBuy and previewSell run the account's own simulateBuy and simulateSell and return the gate that would stop an order, and accountState and markets gather a page's or an agent's reads into one call. Nothing upgrades, and the factory owner has no function that reaches into an account.
Related MCP server: rhc-mcp
The seal
seal(rules, unlockAt, bond) opens a session:
function seal(Rules calldata next, uint64 bell, uint256 bond) external locked onlyOwner {
if (sealed_) revert AlreadySealed();
address token = factory.token();
if (token == address(0)) revert TokenNotSet();
if (bell < block.timestamp + MIN_SEAL_DURATION || bell > block.timestamp + MAX_SEAL_DURATION) {
revert BadDuration();
}
if (next.maxDailyLossUsdg == 0 || next.maxPerTradeUsdg == 0 || next.maxOpenCostBasisUsdg == 0) {
revert ZeroLimit();
}
if (next.maxDailyLossUsdg > uint256(type(int256).max)) revert LimitTooLarge();
if (next.maxSlippageBps > MarketChecks.BPS) revert RuleOutOfRange();
uint256 required = factory.minBondPerDay() * Math.ceilDiv(bell - block.timestamp, 1 days);
if (bond < required) revert InsufficientBond(bond, required);
uint256 received = _receive(IERC20(token), bond);
if (received < required) revert InsufficientBond(received, required);
...
}The bell is at least
MIN_SEAL_DURATION(1 hours) and at mostMAX_SEAL_DURATION(7 days) away.The bond is
minBondPerDay × ceil((unlockAt − now) / 1 day)in $LOCKOUT, counted as the balance the account actually received.The session uses the feeds the factory had set when it was sealed; a feed set later counts from the next session (
sessionFeed).While sealed,
setAgentcan only clear the agent, never name a new one.
The ten rules, and what tighten(rules) accepts while sealed. Anything else reverts with CannotLoosenWhileSealed(), and every accepted call runs the halt check at once.
Rule | Limits | 0 means |
|
| realized loss plus the open positions' mark loss, net of realized gains | refused by | equal or lower |
| USDG spent in one buy | refused ( | equal or lower |
| cost basis of everything held | refused ( | equal or lower |
| losing sells in a row before the halt | off | switched on, or lower; never back to 0 |
| buys in the session; the last one halts | off | switched on, or lower; never back to 0 |
| pause on buys after a losing sell | no pause | equal or longer |
| oldest feed answer a buy accepts | no limit on owner buys; the agent's is 90,000 s | switched on, or lower; never back to 0 |
| fill against the feed price, at most 10,000 | no band, and the agent cannot trade | equal or lower, never 0 |
| a buy of a stock that has a feed needs that feed live | switched on, never off | |
| buys only from Monday 02:00 to Saturday 02:00 Central European time ( | switched on, never off |
Gates
Every buy runs _buy and _buyOrderChecks: 21 gates, the owner's buys and the agent's alike, in this order: 01 to 05, 06 to 19, the swap, then 20 and 21. Gate 13 applies only to the agent key. A failing gate reverts with its error. The numbers are the @gate tags in the source and contracts/gate-lines.json.
Gate | Stops when | Error | Line |
01 |
|
| |
02 |
|
| |
03 |
|
| |
04 |
|
| |
05 |
| the latch, or | |
06 |
|
| |
07 |
|
| |
08 |
|
| |
09 |
|
| |
10 |
|
| |
11 |
|
| |
12 |
|
| |
13 |
|
| |
14 |
|
| |
15 |
|
| |
16 |
|
| |
17 |
|
| |
18 |
|
| |
19 |
|
| |
20 |
|
| |
21 |
|
|
Gate 05 has two outcomes. If the effective loss has reached maxDailyLossUsdg, the buy does not revert: it latches the halt and returns with nothing bought (next section). Otherwise, if a held stock's feed cannot be read, the buy reverts with MarkUnavailable(address).
The agent key's buys and sells also need, for that stock (agentEligible): a feed answer no older than maxFeedAgeSec, capped at AGENT_MAX_FEED_AGE (90,000 s, which also stands in for 0); the token's oracle not paused; and maxSlippageBps above 0. So the agent cannot trade a stock that has no feed.
A sell runs _sell: seven gates. The owner's sells meet four of them: an amount, a tracked balance, a listed pool and the owner's own minimum. The agent's meet all seven: a sealed session, a live feed and a fill inside maxSlippageBps of the feed price.
Gate | Stops when | Error | Line | Owner's sells |
01 |
|
| yes | |
02 |
|
| yes | |
03 |
|
| yes | |
04 |
|
| no | |
05 |
|
| no | |
06 |
|
| yes | |
07 |
|
| no |
The latch
FIG. 1. One session, from the state changes in LockoutAccount.sol. A diagram of the rules: the spacing is not to scale and it shows no amounts.
The loss check runs inside every buy, ahead of the order's own gates (L352-L357):
address unavailable = _rebasePending();
Mark memory mark = _marks();
if (_effectiveLoss(mark.unrealized) >= rules.maxDailyLossUsdg) {
_halt(REASON_MTM_LOSS, mark.unrealized);
return (0, 0, REASON_MTM_LOSS);
}The effective loss is the open positions' loss at their feed prices plus any realized loss, less any realized gain (
_effectiveLoss).The buy that finds it at the limit trades nothing. Its transaction succeeds, sets
haltedand emitsLockoutTriggered(sessionId, 2, …).From then until the bell every buy, the owner's included, stops at gate 03 with
AccountHalted(). Nothing clearshaltedbeforerelease().The same check runs after every trade and every
tighten()(_trip). Its reasons: realized loss at the limit (1), effective loss at the limit (2),maxConsecutiveLosseslosing sells in a row (3),maxTradesPerSessionbuys (4). The owner can halt by hand withmanualHalt()(5);emergencyWithdraw()halts with 6.tripIfBreached()lets anyone run that check, so a breach left by a price move alone is recorded without waiting for the next trade.
Ending a session
After the bell anyone can call release(). The session ends, halted clears, and the bond goes back to the owner in full, whether or not the account halted.
Before the bell the owner's only way out is emergencyWithdraw(token, amount):
if (!sessionBroken) {
uint256 amountToBurn = bondAmount;
bondAmount = 0;
sessionBroken = true;
uint256 supply = IERC20(bondToken).totalSupply();
IBurnable(bondToken).burn(amountToBurn);
uint256 remaining = IERC20(bondToken).totalSupply();
if (remaining > supply || supply - remaining != amountToBurn) revert BurnNotVerified();
emit SessionBrokenAndBurned(sessionId, amountToBurn);
_halt(REASON_EMERGENCY_BROKEN, _marks().unrealized);
}
_withdraw(token, amount);The first call burns the whole bond with the $LOCKOUT token's own burn and reverts unless the total supply fell by exactly that amount. It marks the session broken and halts with reason 6. Later calls before the bell only move funds to the owner. withdraw and sweep work only outside a session (SessionNotEnded() while sealed); sweep returns tokens that reached the account outside its ledger.
Who moves what
FIG. 2. From the access checks in LockoutAccount.sol and LockoutFactory.sol: solid gold arrows move tokens, thin arrows call, dashed arrows read.
Owner (
onlyOwner):depositUsdg,seal,tighten,manualHalt,setAgent,buy,sell,emergencyWithdraw, and outside a sessionwithdrawandsweep. The account pays out only to the owner.Agent key:
buyandsell. Every other function reverts withNotOwner(), and tokens never move to the agent.Anyone:
tripIfBreached(), andrelease()once the bell has passed.Factory owner (
Ownable2Step), on the factory only:setToken, once: the bond token. The bond floor's cap becomes a thousandth of its supply at that moment.setMinBondPerDay: at or under that cap. A raise waits 24 hours after the last raise and at most doubles the floor; a cut takes effect at once. It applies to later seals.listAsset,setFeedOnceandlistPool: an 18-decimal stock, at most one 8-decimal feed for it, and USDG pools on Uniswap v3, MetaDEX, or Uniswap v4 without hooks or a dynamic fee. Nothing is ever unlisted or replaced.
Agent tools
mcp/ is lockout-mcp, an MCP server over stdio that trades one account with its agent key.
Run npx -y lockout-mcp init to create a local agent key and print client setup and a lock page link that fills in the agent address.
claude mcp add lockout -e LOCKOUT_FACTORY=0xeAD444A07f59C89Fb4454F28854245D5D8E1f456 -e LOCKOUT_LENS=0xfbCAcd8748a473a4778a43B1bCd2dB3B563daA42 \
-e LOCKOUT_ACCOUNT=<your account> -e LOCKOUT_AGENT_KEY_FILE=<absolute path of the key file> -- npx -y lockout-mcpTool | Does |
| Reads the session's rules, balances and lockout state |
| Reads listed stocks, pools and feed conditions |
| Simulates an order on every listed pool, best output first |
| Reads the account's verdict on one order, with no transaction |
| Sends the order with the agent key and reports the verdict from its receipt |
config.ts reads LOCKOUT_FACTORY, LOCKOUT_LENS and LOCKOUT_ACCOUNT; LOCKOUT_AGENT_KEY_FILE, an absolute path, is needed only to trade; LOCKOUT_RPC_URL replaces the public endpoint. A trade comes back EXECUTED, REJECTED_HALT_LATCHED or REJECTED_REVERT. mcp/README.md covers the settings, FIG. 3 and how to read the three; mcp/skill/SKILL.md is the procedure for the agent.
Verify the bytes
You need Foundry, Node.js 20 or newer, git, curl and jq.
bash contracts/script/install-deps.sh # forge-std and OpenZeppelin at the commits it names
(cd contracts && forge build && forge test --no-match-path 'test/fork/*')
(cd mcp && npm ci && npm test)forge build compiles with solc 0.8.35, Cancun, 200 optimizer runs and no IR (foundry.toml). Sourcify holds the verified source of the three contracts; the bytes forge build writes are the bytes it recompiled:
cd contracts
sourcify=https://sourcify.dev/server/v2/contract/4663
forge inspect LockoutAccount deployedBytecode > account.hex
curl -s "$sourcify/0x451725A29F3Fa20d075CC171991b746d3406A757?fields=runtimeBytecode" \
| jq -r .runtimeBytecode.recompiledBytecode | cmp - account.hex # silent if equal
curl -s "$sourcify/0xeAD444A07f59C89Fb4454F28854245D5D8E1f456" | jq '{match, runtimeMatch, creationMatch}'
curl -s "$sourcify/0xfbCAcd8748a473a4778a43B1bCd2dB3B563daA42" | jq '{match, runtimeMatch, creationMatch}'lockout-mcp is published from this repository by publish.yml, which runs npm ci, the build and the tests before npm publish --provenance. The registry keeps the provenance; this prints the repository, workflow and commit a release was built from:
curl -s "$(npm view lockout-mcp dist.attestations.url)" \
| jq -r '.attestations[] | select(.predicateType | startswith("https://slsa.dev/provenance")) | .bundle.dsseEnvelope.payload' \
| base64 -d \
| jq '.predicate.buildDefinition | {repository: .externalParameters.workflow.repository,
workflow: .externalParameters.workflow.path, commit: .resolvedDependencies[0].digest.gitCommit}'What it relies on
You rely on | For |
Each listed stock's Chainlink feed | The loss mark, the agent's eligibility and band, and |
Each stock token's issuer |
|
The listed pools | Fill prices. The feed band bounds a fill; it never sets one. A MetaDEX pool's swap hook can raise that pool's fee, up to 10% on each side, or refuse its swaps; it cannot move the account's tokens. |
The factory owner | Which stocks, pools and feeds are listed (only ever added) and the bond floor for later seals |
| The emergency burn. The account checks the total supply after the call. |
Robinhood Chain's sequencer | Block time: the bell, the cooldown, feed age and the mint window are all measured against it |
License
MIT
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
This server cannot be deployed
Maintenance
Related MCP Connectors
Stock token prices, P&L and trades you sign on Robinhood Chain, plus 300+ AI models on one key.
Hear of public changes to Robinhood Chain tokens as they happen and read their history at any block.
Robinhood Chain stock token data — price, split-adjusted supply, DeFi, corporate actions, movers.
Free stock token checks: address lookups across issuers, supply and events on Robinhood Chain
Related MCP Servers
- AlicenseAqualityDmaintenanceEnables agents to query live Robinhood Chain data including tokens, wallets, Chainlink feeds, heat scores, and tracking error on tokenized equities, all read-only without API keys.41MIT
- AlicenseAqualityDmaintenanceEnables AI agents to read Robinhood Chain stock-token positions, quote swaps, and execute swaps through the Model Context Protocol, bridging on-chain assets that Robinhood's own off-chain MCP cannot reach.4MIT

fingersofficial
AlicenseNot gradedqualityDmaintenanceRead-only checks on tokens, NFTs, wallets, contracts and tokenized stocks before an agent acts. Honeypot, peg, copycat, wallet risk. Deep Robinhood Chain coverage. Never your keys.MIT
Stocklayer MCPofficial
AlicenseNot gradedqualityBmaintenanceEnables AI agents to discover tokenized Stock Tokens, read reference prices and wallet balances on Robinhood Chain, create quotes, simulate transactions, and build policy-checked trade plans that return an explainable verdict plus unsigned transactions for a wallet to sign.MIT