Developers
For AI agents
Setoff ships an MCP server with 16 tools, so any AI agent can bill other agents, approve what it owes, fund its net, settle disputes, manage credit and opt in to currency netting, in plain language.
Why agents need netting
Agents that buy services from other agents run up many small bills in both directions: an agent pays for search, gets paid for summaries, pays for compute. Settling each one separately is wasteful. With Setoff, an agent records what it owes and is owed as it goes, and one cycle settles it all, moving only the net.
Tools
| Tool | What it does | Onchain? |
|---|---|---|
setoff_info | Network, contract, tokens, and this agent's wallet and limit | Read |
get_position | What an address owes and is owed, its net, its deposit, and what to deposit next | Read |
list_bills | Bills, filtered by party and status | Read |
preview_next_cycle | What would settle, and how much would move, if a cycle ran now | Read |
create_invoice | Bill someone; returns a link they approve for free | No |
approve_invoice | Sign an invoice billed to this agent; optionally post it | Free signature (+ post) |
post_invoice | Put an approved invoice onchain | Yes |
record_iou | Record a bill this agent owes | Yes |
deposit | Fund this agent's net position | Yes |
withdraw | Take this agent's balance back to its wallet | Yes |
dispute_bill | Freeze a bill this agent is part of | Yes |
propose_amount | Propose what's still owed on a disputed bill; matching offers resolve it | Yes |
set_credit_line | Let a trusted party overdraw up to a limit from this agent's deposit | Yes |
repay_credit | Repay a lender from this agent's balance | Yes |
Invoice links are the same format as the web app's, so an agent can bill a person, a person can bill an agent, and either side can open the link in the app.
Set it up
Clone the repository and install the server's dependencies (plus the solver's, which it reuses):
git clone --recursive https://github.com/Anshv784/setoff && cd setoff
(cd solver && npm install) && (cd mcp && npm install)Claude Code:
claude mcp add setoff \
-e SETOFF_NETWORK=mainnet \
-e SETOFF_AGENT_PK=0xYOUR_AGENT_KEY \
-e SETOFF_MAX_AMOUNT=10 \
-- npx tsx /path/to/setoff/mcp/src/server.tsClaude Desktop, Cursor and other MCP clients (mcpServers in the client's config file):
{
"mcpServers": {
"setoff": {
"command": "npx",
"args": ["tsx", "/path/to/setoff/mcp/src/server.ts"],
"env": {
"SETOFF_NETWORK": "mainnet",
"SETOFF_AGENT_PK": "0xYOUR_AGENT_KEY",
"SETOFF_MAX_AMOUNT": "10"
}
}
}
}| Variable | Meaning |
|---|---|
SETOFF_NETWORK | mainnet, testnet or local |
SETOFF_AGENT_PK | The agent's own wallet key. Leave it out for read-only tools. |
SETOFF_MAX_AMOUNT | Largest amount the agent may bill, approve, record or deposit in one action. Default 10. |
SETOFF_APP_URL | Where invoice links should open. Default https://setoff.anshverma.tech. |
Safety
- Give the agent its own wallet with only what it needs. Never reuse a personal key.
- Every spending action is capped by
SETOFF_MAX_AMOUNT. Anything above it is refused before a transaction is built. - An agent can only approve bills addressed to it, and transactions are simulated before they're sent.
- The contract still checks everything. An agent can't move anyone else's money or overdraw itself.
Try asking
- "Bill 0xAB…12 4.50 USDC for yesterday's 900 summarisation calls, and give me the link."
- "Approve this invoice and post it: https://…/app/bills?invoice=…"
- "What do I owe across Setoff, and how much should I deposit before the next cycle?"
- "If the next cycle ran now, how much money would actually move?"