Agents API, SDK and MCP
An agent with a wallet can rent a server, use it and stop it without a human. There is no API key and no account: the wallet that owns the lease is the credential.
HTTP API
Base URL /api/v1. Every answer is JSON. Write calls on a lease (boot, exec, stop) need proof that the caller owns it.
| Endpoint | Auth | What it does |
|---|---|---|
| GET /plans | none | Sizes, prices read from the contract, templates and regions. |
| GET /quote?size=nano&seconds=600&wallet=0x… | none | The hourly price for that wallet and the that open() will pull. |
| POST /leases/open | none | Body {size, seconds, wallet}. Returns {transactions: [{to, data, value, description}]}: the token approval if the allowance is short, then open(). Sign and send them in order. |
| POST /auth | signature | Body {message, signature}. Returns {token, expiresAt}. The token is valid 12 hours. |
| GET /github/check?repo=https://github.com/owner/repo&branch=&dir=&private= | none | Before paying: is the repo public, does the branch exist, and what will run (install, build, start, port). 422 with {error} if not. With private=1 only the address, branch and folder format are checked (Nora cannot read a private repo). |
| POST /leases/{id}/boot | owner | Body {template, region, image?, port?, command?, env?, sshKey?}, or for a repo {template: "github", repo, private?, branch?, dir?, install?, start?, port?, secrets?}, or for an app {template: "vscode" | "jupyter" | "chrome", region, env?}. Creates the server. Returns {lease, server, secrets?: {names, delivered}}. |
| GET /leases/{id}/deploy-key | owner | Private repo servers: {publicKey, title, addUrl, readOnly: true, state}. The public half of the key the server made at boot; add it on GitHub as a read-only deploy key, then POST /redeploy. |
| GET /leases/{id}/webhook | owner | Deploy on push: {webhook: {enabled, payloadUrl, contentType, secret, events, settingsUrl}}. The secret is derived for the lease and never stored. |
| POST /leases/{id}/webhook | owner | Body {enabled: true | false}. Turns Deploy on push on or off; returns the same as GET. |
| GET /leases/{id}/secrets | owner | Repo servers: {names}. Never a value. |
| POST /leases/{id}/secrets | owner | Body {set?: {NAME: value}, remove?: [NAME]}. Writes the values to root-only files on the server and returns {names}. They reach the app at the next deploy or Redeploy. |
| POST /hooks/github/{id} | signature | Where GitHub sends pushes. Checks X-Hub-Signature-256 against the lease's webhook secret, answers ping, ignores other events, branches and repos, refuses ended leases, then runs Redeploy. |
| GET /leases/{id}/app | owner | One-click apps: {app: {name, url, user, secretName, secret, open, websocket?, examples?, how}}. The login is derived for the lease on each call and never stored. |
| POST /leases/{id}/redeploy | owner | GitHub repo servers: pulls the latest commit of the same branch, reinstalls if the committed package or lock files changed, rebuilds and restarts. Returns 202 {redeploy: id}; the steps stream in /logs and end with [nora] redeploy <id> done (or failed). |
| GET /leases/{id} | none | The lease as the chain sees it, plus the server status. |
| GET /leases/{id}/logs?since= | owner | The server's recent output, oldest first: boot, clone, install and app stdout/stderr. Returns {lines: [{id, t, text, source}], cursor}. Pass cursor back as since to get only new lines. |
| POST /leases/{id}/exec | owner | Body {command, cwd?, timeout?}. Runs a command on the server. Returns {stdout, stderr, exitCode, cwd}. |
| POST /leases/{id}/stop | owner | Returns {transaction}: the close() calldata. Once close() is on-chain, the same call halts the server at once; the keeper then deletes it and settles. |
| GET /wallets/{address}/leases | none | Every lease of a wallet with its state. |
| GET /status | none | {block, liveServers, ok}. |
Wallet signature
Sign this exact message with EIP-191 (personal_sign). The address is lowercase, the time is in unix seconds and the signature is valid for 5 minutes. Lease: all covers every lease of the wallet.
Nora Cloud
Wallet: 0xyouraddressinlowercase
Lease: 42
Time: 1795102435Either exchange it once for a token (POST /auth, then Authorization: Bearer <token>), or send it with every call in three headers: x-nora-wallet, x-nora-time and x-nora-signature, with the lease id of the URL in the message.
The whole flow with curl
# 1. the transactions to sign (approve if needed, then open)
curl -s -X POST /api/v1/leases/open -H 'content-type: application/json' \
-d '{"size":"nano","seconds":600,"wallet":"0xYourWallet"}'
# 2. sign and send them with your wallet, read the lease id from the LeaseOpened event
# 3. boot it (token from POST /auth)
curl -s -X POST /api/v1/leases/42/boot -H "authorization: Bearer $TOKEN" \
-H 'content-type: application/json' -d '{"template":"node","region":"iad","env":{"MODE":"prod"}}'
# 4. run a command
curl -s -X POST /api/v1/leases/42/exec -H "authorization: Bearer $TOKEN" \
-H 'content-type: application/json' -d '{"command":"uname -a"}'
# 5. read the logs (pass the returned cursor as since for new lines only)
curl -s /api/v1/leases/42/logs -H "authorization: Bearer $TOKEN"
# 6. one-click apps: read the app's address and login
curl -s /api/v1/leases/43/app -H "authorization: Bearer $TOKEN"
# 7. GitHub repo servers: ship the latest commit
curl -s -X POST /api/v1/leases/44/redeploy -H "authorization: Bearer $TOKEN"
# 7b. private repos, deploy on push, secrets (Update 3)
curl -s /api/v1/leases/44/deploy-key -H "authorization: Bearer $TOKEN"
curl -s -X POST /api/v1/leases/44/webhook -H "authorization: Bearer $TOKEN" -d '{"enabled":true}'
curl -s -X POST /api/v1/leases/44/secrets -H "authorization: Bearer $TOKEN" -d '{"set":{"API_KEY":"..."}}'
# 8. stop: send the close() it returns, then call stop again to delete the server now
curl -s -X POST /api/v1/leases/42/stop -H "authorization: Bearer $TOKEN"SDK
One file for Node 20 or newer, served by this site. It holds the HTTP client, a small wallet signer, a CLI and the MCP server. Your key never leaves the process: it signs the transactions and the auth message locally.
curl -O /sdk/nora.mjsimport { Nora } from "./nora.mjs";
const nora = new Nora({ privateKey: process.env.NORA_KEY });
const box = await nora.rent({ size: "nano", template: "ubuntu", minutes: 10 });
console.log(await box.exec("uname -a"));
await box.stop(); // close() on-chain, server deleted, refund settled by the keeperDeploy a repo
deploy() checks the repo first (nothing is paid if it is private or missing), rents the server with the GitHub template, and follows the logs until the app answers on its HTTPS address. It throws with the reason if the clone, the install or the start fails; the server stays up so you can look around with exec().
const app = await nora.deploy({
repo: "https://github.com/owner/repo",
branch: "main", // optional
dir: "apps/web", // optional sub-folder
size: "micro", // micro or bigger
minutes: 60,
env: { NODE_ENV: "production" },
onLog: (l) => console.log(l.text),
});
console.log(app.url, app.ready);
const { lines, cursor } = await app.logs(); // recent output
const more = await app.logs({ since: cursor }); // only what is new
const r = await app.redeploy(); // latest commit of the same branch
console.log(r.ready, r.commit, r.seconds); // { ready: true, commit: "ab86951", seconds: 9 }
await app.stop();redeploy() pulls the latest commit of the branch the server runs, reinstalls only when the committed package or lock files changed, runs the build script if there is one and restarts the app, then follows the logs until it answers again. It resolves with ready: false and the reason if a step fails; the server stays up.
Private repos, deploy on push, secrets
With private: true, deploy() cannot read the repo first: it rents the server, which makes its own deploy key, and returns it in key without waiting. Add the key on GitHub (read-only), then call redeploy(). Secrets are write-only: only names come back. See Private repositories.
const app = await nora.deploy({
repo: "https://github.com/owner/private-repo",
private: true,
secrets: { API_KEY: process.env.API_KEY },
size: "micro",
minutes: 60,
});
console.log(app.key.publicKey, app.key.addUrl); // add it as a read-only deploy key
await app.redeploy(); // clones over SSH, installs, starts
await app.deployKey(); // the same key again, with the server's state
const hook = await app.webhook({ enabled: true }); // { payloadUrl, secret, contentType, settingsUrl }
await app.setSecrets({ DATABASE_URL: "postgres://...", OLD_TOKEN: null }); // null removes
console.log(await app.secrets()); // ["API_KEY", "DATABASE_URL"]One-click apps
Rent a server with an app template and read its login. Each app is locked from its first second with a password or token made for that lease; only the owner's wallet can read it. See One-click apps.
const ide = await nora.rent({ template: "vscode", size: "micro", minutes: 30 });
await ide.waitReady(); // follows the boot until the app answers behind its login
const login = await ide.app(); // { url, secret, open, how, ... }
const chrome = await nora.rent({ template: "chrome", size: "small", minutes: 30 });
await chrome.waitReady();
const { websocket } = await chrome.app(); // wss://<address>/?token=<token>
// puppeteer.connect({ browserWSEndpoint: websocket }) or chromium.connectOverCDP(websocket)CLI
NORA_KEY=0x... node nora.mjs plans
NORA_KEY=0x... node nora.mjs deploy https://github.com/owner/repo --size micro --minutes 60
NORA_KEY=0x... node nora.mjs logs 42 --follow
NORA_KEY=0x... node nora.mjs redeploy 42
NORA_KEY=0x... node nora.mjs deploy https://github.com/owner/private-repo --private --size micro --minutes 60
NORA_KEY=0x... node nora.mjs deploy-key 42
NORA_KEY=0x... node nora.mjs webhook 42 --on
NORA_KEY=0x... node nora.mjs secrets 42 set API_KEY=... DATABASE_URL
NORA_KEY=0x... node nora.mjs secrets 42
NORA_KEY=0x... node nora.mjs rent --template jupyter --size micro --minutes 30
NORA_KEY=0x... node nora.mjs app 43
NORA_KEY=0x... node nora.mjs rent --size nano --template node --minutes 30
NORA_KEY=0x... node nora.mjs exec 42 "node -v"
NORA_KEY=0x... node nora.mjs status 42
NORA_KEY=0x... node nora.mjs stop 42The key needs a little BNB on BNB Smart Chain for gas and the for the lease.
MCP server
node nora.mjs mcp runs a local MCP server over stdio. It signs with NORA_KEY and exposes twelve tools: list_plans, rent_server, deploy_repo, redeploy, deploy_key, deploy_on_push, set_secrets, app_login, exec, server_logs, server_status and stop_server. With deploy_repo an agent ships a repo in one call and gets back the URL and the last log lines (for a private repo, the deploy key to add); redeploy ships the next commit; deploy_on_push returns the webhook to add and set_secrets sets write-only env vars. With rent_server and an app template (vscode, jupyter, chrome) it waits until the app is ready and returns its address and login; app_login reads it again later. Add it to Claude Desktop, Claude Code or any MCP client:
{
"mcpServers": {
"nora": {
"command": "node",
"args": ["/path/to/nora.mjs", "mcp"],
"env": { "NORA_KEY": "0x..." }
}
}
}Give the agent a key that holds only what it may spend. The contract caps it at three live servers, and every lease is bounded by the it prepaid.
