Agents
Connect over MCP
The Mortise MCP server lets an AI agent work inside one vault. Every action goes through the vault's Gate, which enforces the owner's limits on chain. The server adds no permissions of its own and can do nothing the Gate would refuse.
1. Add the agent to the vault
In the app, open Agents and plug in the agent's address. Choose its expiry, the adapters and markets it may use, and a cap per token. A token without a cap cannot be spent.
2. Store the agent's key
Create a file only you can read, then write the agent's private key into it with an editor. Never paste the key into a chat or a command line. Give the agent's address a little ETH for gas: it pays for its own transactions.
install -m 600 /dev/null ~/.mortise-agent.keyThe server refuses to start if the file is readable or writable by other users, or if the key is one of the vault's root keys or guardians.
3. Add the server to your MCP client
Use the absolute path of the key file. MCP clients pass the value as it is written, so ~ is not expanded.
{
"mcpServers": {
"mortise": {
"command": "npx",
"args": ["-y", "@mortiseagentvault/mcp"],
"env": {
"MORTISE_VAULT": "0xYourVault",
"MORTISE_AGENT_KEY_FILE": "/home/you/.mortise-agent.key"
}
}
}
}The server needs Node.js 20 or later. It is one bundled file with no runtime dependencies.
Settings
| Variable | What it is |
|---|---|
| MORTISE_VAULT | The vault's address. Required. |
| MORTISE_AGENT_KEY_FILE | File with the agent's private key, mode 600. Required. |
| MORTISE_RPC_URL_FILE | File with an RPC URL that carries an API key, mode 600. Optional. |
| MORTISE_RPC_URL | RPC URL. Optional; defaults to the public Robinhood Chain RPC. |
Neither the key nor the RPC URL ever appears in the server's output or errors. The server also refuses to start if the vault does not exist or the RPC serves another chain.
Tools
| Tool | What it does |
|---|---|
| mortise_permissions | Whether the agent is live and until when, the adapters it may use, the cap left per token. |
| mortise_vault | Gate and pause state, timelock delay, family, ETH balance. |
| mortise_balances | The vault's balances of ETH and the tokens given. |
| mortise_min_rate | The owner's price floor for selling one token for another. |
| mortise_simulate | Runs actions without sending them; returns the markets used or the reason for a refusal. |
| mortise_execute | Sends actions to the Gate in one transaction, after simulating them. |
| mortise_trigger | Runs a due step of the DCA, automation, rebalance or auto-compound module, as its keeper. |
| mortise_pay_x402 | Pays an x402 resource from the vault through the escrow, refusing a price above maxValue or a seller the owner did not list. |
| mortise_x402_reclaim | Sends a payment the seller never collected back to the vault, once its deadline has passed. |
Actions cover every adapter Mortise ships: swaps on Uniswap v2, v3 and v4, PancakeSwap v3 and Infinity, Aero, 1inch and Sushi; Pons and Flap; positions on Uniswap v3 and v4 and Aero; Morpho Blue lending and borrowing, Kaskad, Lista, Priors, ERC-4626, Beefy and Pendle; Across, LayerZero and CCIP; Lighter; the vault's ERC-8004 identity; WETH, listed transfers and family transfers. Amounts are integer strings in the token's smallest unit. x402 payments have their own tool, described in Pay for x402 resources.