Skip to main content
Glama
trustless-ai

eip7702-rescue

by trustless-ai
README.md
# eip7702-rescue

**Forensic MCP + hardened delegate for recovering assets from EIP-7702-compromised wallets.**

When an EOA is delegated to a sweeper via EIP-7702, you can't fund it to pay for its own recovery —
the funding is swept on arrival. This tool rescues the held assets in **one atomic sponsored type-4
transaction** (re-delegate + transfer-out, no window for the attacker), and ships a forensic MCP that
is **key-free**: it diagnoses, scans, and *simulates* recoverability for any victim address without
ever holding a private key. Firing the real rescue is a deliberate, separate human step.

→ Full spec: **[SPEC.md](./SPEC.md)** · Real mainnet case (11 NFTs recovered): **[CASE.md](./CASE.md)**

## Tools (MCP, stdio)
| tool | what | keys |
|---|---|---|
| `diagnose_7702` | is an address 7702-delegated, and to what? | none (read-only) |
| `scan_nfts` | which token ids does an address still hold? | none (read-only) |
| `simulate_rescue` | prove ids land at `safe` via the atomic rescue, on a throwaway fork | none |
| `build_rescue_plan` | emit the exact tx sequence + calldata for the real run | none (no broadcast) |

## Quickstart
```bash
forge build                 # compile contracts/RescueDelegate.sol
node mcp/server.mjs          # run the MCP server over stdio
```
Register `mcp/server.mjs` as a stdio MCP server in your client. `RESCUE_RPC` overrides the RPC.

## The hardened delegate
`RescueDelegate(address SAFE)` — destination immutable at deploy. `rescue(wrap, ids)` can only ever
move assets to `SAFE`, so it's safe to leave delegated (no open-destination drain window).

## Composition
A rescue job's `asset_set` + outcome bind to an OCP/8281 `artifact_hash` → recovery-escrow receipt
(faithfulness) + scope-contestation (completeness). The MCP is the observation/action front-end of
the recovery-standards family; no trusted party at any layer.

License: **CC0-1.0**.