For the complete documentation index, see llms.txt
Develop with the wallet CLI and MCP
How scripts, CI, and AI agents hold and move funds on Midnight without a browser extension, using the wallet CLI and its MCP server. To choose a wallet first, see the overview. For browser DApp integration, see the integration guide.
Develop and test without a wallet
The wallet CLI exposes the same ConnectedAPI over a local WebSocket, so your DApp code paths run unchanged, and users later connect with any browser wallet. The CLI is self-custody (keys in ~/.midnight, BIP-39/44, Lace-compatible) and network-agnostic, so one seed serves undeployed, preprod, and preview.
| Group | Commands |
|---|---|
| Wallet | wallet generate/list/use/info/remove, info, address, genesis-address |
| Transactions | balance, transfer, airdrop, inspect-cost |
| DUST | dust register, dust status |
| Local network | localnet up/status/stop/down/clean |
| Config / connector | config get/set/unset, cache clear, serve |
midnight localnet up orchestrates the full stack in Docker (node on 9944, indexer on 8088, proof server on 6300), so you can deploy and transact with no faucet:
midnight localnet up # node + indexer + proof server (Docker)
midnight wallet generate alice # self-custody key in ~/.midnight
midnight config set network undeployed
midnight airdrop 1000 # fund the active wallet (undeployed-only)
midnight airdrop 1000 mn_addr_undeployed1... # ...or fund ANY address directly (v0.4.1, no seed import)
midnight dust register # REQUIRED before transfers; wait ~5 min locally for DUST (else error 138)
midnight balance
midnight transfer mn_addr_undeployed1... 100 # positional: <recipient> <amount>
midnight serve --network preview # headless DApp Connector on ws://localhost:9932
midnight serve --network preview --approve-all # dev only: auto-approve every request
Run dust register before transferring, or the transfer fails with BalanceCheckOverspend (138). DUST regenerates in about 5 minutes locally (see Fees and DUST and Troubleshooting).
// A DApp connects to the CLI connector exactly like a browser wallet:
import { createWalletClient } from "midnight-wallet-connector";
const wallet = await createWalletClient({ url: "ws://localhost:9932", networkId: "Preview" });
const balances = await wallet.getUnshieldedBalances(); // same ConnectedAPI surface
Build and test against midnight serve (scriptable, no pop-ups), then deploy and let users connect with Lace or 1AM, with no code changes.
midnight airdrop can now fund any address directly: paste the recipient's address, with no seed import needed. You no longer have to import a seed to fund browser wallets on a local network. The indexer connection also moved to the v4 API, which fixes connection errors on the test networks. (repo)
(CLI README, connector, local playground)
AI and agent tooling (the MCP column)
The MCP column is agents calling tools, and it comes in two flavors.
Wallet-control MCP. The midnight-wallet-cli ships an MCP server (midnight-wallet-mcp) that exposes the CLI commands as tools, so an AI agent can operate a self-custody wallet:
| Group | MCP tools |
|---|---|
| Wallet and info | midnight_wallet_generate, _list, _use, _info, _remove, midnight_info, midnight_address, midnight_genesis_address |
| Transactions | midnight_balance, _transfer, _airdrop, midnight_inspect_cost |
| DUST | midnight_dust_register, _status |
| Local network | midnight_localnet_up, _stop, _down, _status, _clean |
| Config | midnight_config_get, _set, _unset, midnight_cache_clear |
The newest tools are the consequential ones. Beyond moving tokens, an agent can now drive the full contract lifecycle: deploy, call, and read state. A two-step confirmation tool also shows the human what the agent is about to spend before anything executes. Point any MCP client at the binary, such as Claude Code (.mcp.json), Claude Desktop, Cursor, VS Code (Copilot), or Windsurf:
{ "mcpServers": { "midnight-wallet": { "command": "midnight-wallet-mcp" } } }
This is the highest-risk cell. Scope the agent's tools, cap spend, allowlist destinations, and keep a human in the loop (see Security checklist). Walkthrough: "Multi-Language Dev Session #22: midnight-wallet-cli" (YouTube, CLI README).
Dev-assistant MCP. This is tooling that helps you build: write Compact, wire the connector, and verify claims. See the talk "Midnight for Developers: Midnight MCP, The AI Tool That Finally Understands Compact" (YouTube). Two marketplaces:
- Midnight Expert has 13 plugins (87 skills, 17 agents) across the dev lifecycle. The most relevant here are
midnight-tooling(CLI, devnet, proof server),midnight-dapp-dev(frontend and connector),midnight-wallet(wallet SDK),midnight-verify(check SDK and connector claims), andmidnight-status-codes. Install via/plugin, then addhttps://midnightntwrk.expert. (midnightntwrk.expert) - Edda Labs ships the
midnightplugin:/midnight-docs,/midnight-docs-repos,/midnight-examples,/midnight-contracts, and/midnight-starter(the sameeddalabs/midnight-starter-templateused in the React pattern). Install with/plugin marketplace add eddalabs/edda-marketplace, then/plugin install midnight.