Connect your AI client to LDGR.
Read balances and transactions, inspect tokens and contracts, and prepare wallet actions through Model Context Protocol (MCP). Choose the local npm package or the hosted endpoint.
Choose a connection
| Capability | Local npm package | Hosted endpoint |
|---|---|---|
| Connection | stdio on your device | Streamable HTTP |
| Public reads and unsigned requests | Mainnet and testnet | Mainnet and testnet |
| Wallet access | Selected CLI wallet's public metadata; saves requests locally | No local wallet or filesystem access |
| Faucet | Opens Chrome, with a link fallback | Returns a link to open |
| Browser swaps | Returns a wallet review link | Returns a wallet review link |
| Signing | User-run CLI approval | Save the request, then approve through the local CLI |
Public reads need no wallet, API key, or login. Each tool call selects mainnet or testnet explicitly.
Local setup with npm
Install Node.js 20.19 or newer, including npm and npx. In your AI client's MCP settings, add a stdio server with command npx and arguments -y @ldgr/mcp@latest. Clients that accept an mcpServers JSON configuration can use:
{
"mcpServers": {
"ldgr": {
"command": "npx",
"args": ["-y", "@ldgr/mcp@latest"]
}
}
}The published @ldgr/mcp package provides local wallet access. @latest selects the latest published release when the server starts; restart the server to load an update. No global installation is required. The client starts the process and communicates over stdio.
From MCP 0.1.3, local wallet operations use @ldgr/cli@latest through npx, checking npm on each operation and reusing cached downloads. This includes wallet information, request preparation, and terminal approval. No separate CLI installation is needed. CLI updates apply on the next wallet operation; the CLI must be 0.5.1 or newer. Public ledger reads do not launch the CLI.
Claude Code
claude mcp add --transport stdio ldgr -- npx -y @ldgr/mcp@latestRun this from your project directory. By default, the registration is private to you in that project. Add --scope user before --transport to make it available across your projects. Run claude mcp list to check the registration, or use /mcp inside Claude Code to check the connection. See the Claude Code MCP documentation for scope options.
Codex
codex mcp add ldgr -- npx -y @ldgr/mcp@latestRestart Codex after adding the server. Run codex mcp list to check the registration.
Choose your local wallet in chat
MCP 0.1.5 is a source candidate; verify publication and the running server version before expecting these tools. Installation and startup do not prompt for a wallet, create preference files, or read the CLI wallet. Public reads and faucet links work without a wallet choice.
On the first wallet action, an unset preference returns WALLET_SETUP_REQUIRED. The agent asks whether you want the CLI wallet or web wallet, then calls set_wallet_preferences with {"wallet":"cli"} or {"wallet":"web"} after your answer. wallet_preferences reads the current choice. No terminal or installation prompt is used; server stdout remains MCP JSON-RPC.
The local file ~/.ldgr/mcp.json stores {"version":1,"wallet":"cli"} (or web). Set LDGR_MCP_CONFIG to use another configuration path. This preference contains no keys or passphrases and is separate from the CLI wallet store.
To change it later, tell the agent “Use the web wallet” or “Use the CLI wallet.” It calls set_wallet_preferences; the next wallet action uses the saved choice without restarting. These preference tools are local only. Hosted MCP does not store local preferences.
CLI mode enables wallet_info and unsigned prepare_* requests; web mode enables prepare_swap_link. A mismatched action returns WALLET_MODE_UNSUPPORTED without falling back. Web transfer, token creation, and escrow handoffs are unsupported: deliberately change to CLI mode if you want terminal approval. Browser swaps use live quotes and default 0.5% slippage; a CLI amountOutMin is not transferred to the browser link.
Import your CLI wallet into the web wallet
The MCP 0.1.5 source candidate adds local-only prepare_wallet_import with an explicit network. It returns the selected CLI wallet's public identity, an encrypted export file path, a command for you to run, and a web-wallet URL. MCP does not export or unlock the wallet. Hosted MCP has no local file tool.
ldgr-mcp wallet export-web "/absolute/path/to/wallet-import.json" [--wallet /absolute/path/to/wallet.json]Run the returned command yourself in a private interactive terminal (TTY). CLI 0.5.3 requires explicit confirmation, source-wallet unlock when protected, and a separate transfer passphrase of at least 12 characters entered twice. It writes a new encrypted file with owner-only permissions (0600), using the shared wallet-core AES-GCM envelope. Keep the passphrase out of chat, arguments and environment variables.
Open the web wallet import screen in Google Chrome. Choose Import encrypted wallet, select the file, enter its transfer passphrase in the masked field, check the public identity and network, and explicitly select Import wallet. The imported wallet remains passphrase protected. An existing browser vault is not replaced: use an empty browser profile or deliberately back up and remove the existing vault through its settings first.
The CLI wallet is retained. Both wallets use the same key; balances do not move. Never put a raw or encoded recovery key in chat, MCP, or a URL: an encoded recovery key is still secret. The #import fragment only selects the form; it carries no wallet material. Use the file picker, without exposing the encrypted file contents to the agent.
Keep the current MCP wallet preference until the user confirms import succeeded in chat. Then call set_wallet_preferences with {"wallet":"web"} if requested. Use prepare_swap_link for browser approval afterward. Publish CLI 0.5.3 before MCP 0.1.5; this web import flow also requires deployment of the updated web wallet. Verify installed versions and the live UI before using it.
Hosted setup
Add a remote MCP server using Streamable HTTP and this URL:
https://mcp.ldgr.ltd/mcpNo authentication token or local Node.js installation is needed for the hosted connection. It serves both networks. The endpoint speaks MCP; opening it as a normal browser page returns HTTP 405. Check service health instead.
Claude Code
claude mcp add --transport http ldgr-remote https://mcp.ldgr.ltd/mcpRun from your project directory, or add --scope user before --transport for access across projects. Use /mcp inside Claude Code to check the connection. No login is required for this endpoint.
Codex
codex mcp add ldgr-remote --url https://mcp.ldgr.ltd/mcpChoose this connection if you only need public reads or portable unsigned requests. The hosted server cannot install software, open your browser, read your wallet, or sign transactions.
Check the connection
Ask your AI client:
Use LDGR MCP to read the testnet ledger configuration.
Then read the metadata for asset t0 on testnet.The results should identify ledger ID 0 and Ledra Testnet (tLEDRA). For a balance, provide the public receiving address and exact asset ID. Testnet uses ldgrt addresses and native ID t0; mainnet uses ldgr and t1. Both native IDs resolve to wire code dng. Amounts are decimal strings.
Available reads include get_balance, get_transaction, get_account_history, get_asset, get_ledger_config, get_contract, list_pools, get_pool, and get_swap_quote. Transaction lookup requires the transaction hash and exact asset. Account history comes from the Explorer projection and can lag settlement; a quote does not execute a swap.
Set up a local wallet
Public queries work immediately. For wallet actions, use an existing CLI wallet or run the following yourself in a private terminal. Wallet creation displays recovery material: keep it out of chat and captured agent output.
npx -y @ldgr/mcp@latest wallet create --testnet
npx -y @ldgr/mcp@latest addressThe default store is ~/.ldgr/wallet.json. Existing users can run npx -y @ldgr/mcp@latest wallet list and select the intended wallet. If you use a custom store, append --wallet ABSOLUTE_PATH to both the MCP server arguments and wallet commands. wallet_info is available only with the local server and returns public metadata. wallet_setup_instructions provides setup commands on either connection.
The network argument to wallet_info checks the selected wallet; it does not switch wallets or networks. WALLET_NETWORK_MISMATCH means you should request that wallet's network or run npx -y @ldgr/mcp@latest wallet list and npx -y @ldgr/mcp@latest wallet select INDEX in your terminal to choose a wallet on the intended network. MCP leaves your selection unchanged.
Review and approve wallet actions
prepare_transfer, prepare_token_creation, and prepare_escrow produce unsigned requests. Token creation supports fixed or mintable supply; contract preparation supports escrow_v1. General contract deployment and browser-wallet pairing are not supported by this MCP release.
MCP 0.1.4 and CLI 0.5.2 add prepare_swap. Check the installed versions or hosted tool list for availability. Supply network, exact assetIn and assetOut codes, and positive decimal strings for amountIn and amountOutMin. Optional maxHops accepts 1, 2, or 3 and defaults to 3. You can read get_swap_quote first; preparation only creates an unsigned request. Swap output goes to the selected wallet.
During approval, the CLI fetches a fresh quote and fixes the route for review. It never lowers your minimum output. Review the exact assets, input amount, minimum output, route, pool fees, and the single Ledra network fee. Pool fees are included in the quote. A price change can cause settlement to reject the swap if the minimum is no longer met.
The local server saves the request and returns its approval command. With the hosted server, save the returned request JSON to a local file. Use its actual path and run approval yourself in your terminal:
npx -y @ldgr/mcp@latest approve "/absolute/path/to/request.json"The CLI checks the wallet, network, expiry, balance, and fee, then shows the terms for your explicit confirmation. Keys stay in the local wallet. MCP never unlocks, signs, or submits. Do not send recovery keys or passphrases to the agent or hosted endpoint.
Preparation is not a completed transaction. If submission has an unknown outcome, preserve the request and signed submission record, and reconcile with the authoritative transaction lookup before preparing another payment.
Review a swap in the browser wallet
Call prepare_swap_link with explicit network, assetIn, assetOut, and a positive decimal string amountIn. Check your installed or hosted tool list for availability. The tool validates the network, active assets, and input precision, then returns a link to the browser wallet. Native IDs resolve to dng; the assets must differ.
Open the link in Google Chrome. The wallet fetches a live quote and opens swap review with default 0.5% slippage. Review the network, assets, input, minimum received and slippage. Unlock the intended wallet locally if needed, then explicitly select Sign and swap. Opening the link never signs or submits. MCP returns signed: false, submitted: false, and approvalRequired: true; it does not access your wallet.
Open a faucet drop
Call claim_faucet_drop with network: "testnet" and your public receiving address. Local MCP opens Chrome; hosted MCP returns the URL. The link includes ?address= to prefill the recipient.
Review the address and select Claim Ledra in the browser. Opening the link never submits a claim: the tool reports claimSubmitted: false. Wait for completion, then check the testnet balance with asset t0 before spending.