@ldgr/mcp 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -13,7 +13,7 @@ A remote MCP connection cannot install software, access local files, unlock a wa
13
13
  Node.js 20.19 or newer is required. Install the package, then create or import a wallet in your own terminal:
14
14
 
15
15
  ```sh
16
- npm install --global @ldgr/mcp@0.1.0
16
+ npm install --global @ldgr/mcp@0.1.1
17
17
  ldgr-mcp wallet create --testnet
18
18
  # Or: ldgr-mcp wallet import --testnet
19
19
  ldgr-mcp wallet list
@@ -42,6 +42,16 @@ Configure a local MCP client:
42
42
 
43
43
  For a custom wallet store, append `--wallet` and its absolute path. Server stdout contains JSON-RPC only; startup errors go to stderr. Local `wallet_info` returns only the selected address, public key, network, ledger ID and protection mode.
44
44
 
45
+ The `network` argument to `wallet_info` checks the selected wallet; it does not
46
+ select another wallet or change its network. `WALLET_NETWORK_MISMATCH` means you
47
+ should request the selected network or use `ldgr-mcp wallet list` and
48
+ `ldgr-mcp wallet select <index>` in your terminal to choose the intended wallet.
49
+ Keep a custom `--wallet` path consistent. MCP never changes the wallet selection.
50
+
51
+ Version 0.1.1 requires `@ldgr/client@^0.6.1`, the published client release containing
52
+ the milestone escrow, atomic offer, claim distribution, and Ledra program reads.
53
+ Restart the MCP process after upgrading; a running process keeps its loaded SDK.
54
+
45
55
  ## Tools
46
56
 
47
57
  | Tool | Result |
package/dist/cli.js CHANGED
@@ -159,8 +159,11 @@ var INSTRUCTIONS = `LDGR is an independent single-authority ledger. Always speci
159
159
 
160
160
  class AssetMismatchError extends Error {
161
161
  }
162
+
163
+ class WalletNetworkMismatchError extends Error {
164
+ }
162
165
  function createLdgrMcpServer(options = {}) {
163
- const server = new McpServer({ name: "ldgr", version: "0.1.0" }, { instructions: INSTRUCTIONS });
166
+ const server = new McpServer({ name: "ldgr", version: "0.1.1" }, { instructions: INSTRUCTIONS });
164
167
  const request = readTransport(options.fetch);
165
168
  const now = options.now ?? Date.now;
166
169
  const envelope = (network, source, data) => ({ network, source, data });
@@ -171,8 +174,8 @@ function createLdgrMcpServer(options = {}) {
171
174
  const data = await run(args);
172
175
  return { content: [{ type: "text", text: JSON.stringify(data) }] };
173
176
  } catch (error) {
174
- const code = error instanceof AssetMismatchError ? "ASSET_MISMATCH" : error instanceof LdgrClientError && error.status === 404 ? "NOT_FOUND" : "OPERATION_FAILED";
175
- const message = code === "NOT_FOUND" ? "The requested record was not found on the explicit network. This is not proof that a previous submission failed; reconcile an uncertain submission before retrying." : code === "ASSET_MISMATCH" ? "The record does not match the requested exact asset code." : "LDGR operation could not complete. Check the explicit network, address, asset, values and service availability. No transaction was signed or submitted.";
177
+ const code = error instanceof WalletNetworkMismatchError ? "WALLET_NETWORK_MISMATCH" : error instanceof AssetMismatchError ? "ASSET_MISMATCH" : error instanceof LdgrClientError && error.status === 404 ? "NOT_FOUND" : "OPERATION_FAILED";
178
+ const message = code === "NOT_FOUND" ? "The requested record was not found on the explicit network. This is not proof that a previous submission failed; reconcile an uncertain submission before retrying." : code === "ASSET_MISMATCH" ? "The record does not match the requested exact asset code." : code === "WALLET_NETWORK_MISMATCH" ? "The selected CLI wallet uses a different network. The network argument checks the selected wallet; it does not switch wallets or networks. Request the selected network, or run wallet list and wallet select in your own terminal to choose a wallet on the intended network. Keep any custom --wallet path consistent. No wallet settings were changed." : "LDGR operation could not complete. Check the explicit network, address, asset, values and service availability. No transaction was signed or submitted.";
176
179
  return { isError: true, content: [{ type: "text", text: JSON.stringify({ error: { code, message } }) }] };
177
180
  }
178
181
  });
@@ -309,7 +312,7 @@ function createLdgrMcpServer(options = {}) {
309
312
  }, false);
310
313
  tool("wallet_setup_instructions", "Explain user-run CLI wallet installation, creation/import and MCP connection. This tool cannot install software or access local files.", { network: networkSchema }, async (args) => ({
311
314
  network: args.network,
312
- install: "npm install --global @ldgr/mcp@0.1.0",
315
+ install: "npm install --global @ldgr/mcp@0.1.1",
313
316
  node: ">=20.19.0",
314
317
  create: `ldgr-mcp wallet create${args.network === "testnet" ? " --testnet" : ""}`,
315
318
  import: `ldgr-mcp wallet import${args.network === "testnet" ? " --testnet" : ""}`,
@@ -321,13 +324,13 @@ function createLdgrMcpServer(options = {}) {
321
324
  instructions: "Run wallet commands yourself in a terminal. Creation/import uses local interactive prompts. Keep recovery keys and passphrases out of chat and tool calls. Remote MCP cannot install on your computer. Local preparation binds a request to your selected wallet; approvals always require human terminal review."
322
325
  }));
323
326
  if (options.local)
324
- tool("wallet_info", "Read the selected local wallet's public metadata only; never returns recovery keys or passphrases.", { network: networkSchema }, async (args) => {
327
+ tool("wallet_info", "Read the selected local wallet's public metadata only; never returns recovery keys or passphrases. The network argument checks the selected wallet, not a wallet selector. A mismatch returns WALLET_NETWORK_MISMATCH without changing wallet settings.", { network: networkSchema }, async (args) => {
325
328
  const info = await options.local.walletInfo();
326
329
  if (!info || typeof info !== "object")
327
330
  throw new Error("No wallet selected");
328
331
  const record = info;
329
332
  if (record.network !== args.network)
330
- throw new Error("Selected wallet network mismatch");
333
+ throw new WalletNetworkMismatchError;
331
334
  return { network: record.network, address: record.address, publicKey: record.publicKey, ledgerId: record.ledgerId, protection: record.protection };
332
335
  });
333
336
  return server;
@@ -387,7 +390,7 @@ async function startLdgrMcpStdio(options = {}) {
387
390
  }
388
391
 
389
392
  // src/cli.ts
390
- var HELP = `LDGR MCP 0.1.0
393
+ var HELP = `LDGR MCP 0.1.1
391
394
 
392
395
  ldgr-mcp Start local MCP over stdio
393
396
  ldgr-mcp --wallet <path> Start MCP with a selected wallet store
package/dist/index.js CHANGED
@@ -117,8 +117,11 @@ var INSTRUCTIONS = `LDGR is an independent single-authority ledger. Always speci
117
117
 
118
118
  class AssetMismatchError extends Error {
119
119
  }
120
+
121
+ class WalletNetworkMismatchError extends Error {
122
+ }
120
123
  function createLdgrMcpServer(options = {}) {
121
- const server = new McpServer({ name: "ldgr", version: "0.1.0" }, { instructions: INSTRUCTIONS });
124
+ const server = new McpServer({ name: "ldgr", version: "0.1.1" }, { instructions: INSTRUCTIONS });
122
125
  const request = readTransport(options.fetch);
123
126
  const now = options.now ?? Date.now;
124
127
  const envelope = (network, source, data) => ({ network, source, data });
@@ -129,8 +132,8 @@ function createLdgrMcpServer(options = {}) {
129
132
  const data = await run(args);
130
133
  return { content: [{ type: "text", text: JSON.stringify(data) }] };
131
134
  } catch (error) {
132
- const code = error instanceof AssetMismatchError ? "ASSET_MISMATCH" : error instanceof LdgrClientError && error.status === 404 ? "NOT_FOUND" : "OPERATION_FAILED";
133
- const message = code === "NOT_FOUND" ? "The requested record was not found on the explicit network. This is not proof that a previous submission failed; reconcile an uncertain submission before retrying." : code === "ASSET_MISMATCH" ? "The record does not match the requested exact asset code." : "LDGR operation could not complete. Check the explicit network, address, asset, values and service availability. No transaction was signed or submitted.";
135
+ const code = error instanceof WalletNetworkMismatchError ? "WALLET_NETWORK_MISMATCH" : error instanceof AssetMismatchError ? "ASSET_MISMATCH" : error instanceof LdgrClientError && error.status === 404 ? "NOT_FOUND" : "OPERATION_FAILED";
136
+ const message = code === "NOT_FOUND" ? "The requested record was not found on the explicit network. This is not proof that a previous submission failed; reconcile an uncertain submission before retrying." : code === "ASSET_MISMATCH" ? "The record does not match the requested exact asset code." : code === "WALLET_NETWORK_MISMATCH" ? "The selected CLI wallet uses a different network. The network argument checks the selected wallet; it does not switch wallets or networks. Request the selected network, or run wallet list and wallet select in your own terminal to choose a wallet on the intended network. Keep any custom --wallet path consistent. No wallet settings were changed." : "LDGR operation could not complete. Check the explicit network, address, asset, values and service availability. No transaction was signed or submitted.";
134
137
  return { isError: true, content: [{ type: "text", text: JSON.stringify({ error: { code, message } }) }] };
135
138
  }
136
139
  });
@@ -267,7 +270,7 @@ function createLdgrMcpServer(options = {}) {
267
270
  }, false);
268
271
  tool("wallet_setup_instructions", "Explain user-run CLI wallet installation, creation/import and MCP connection. This tool cannot install software or access local files.", { network: networkSchema }, async (args) => ({
269
272
  network: args.network,
270
- install: "npm install --global @ldgr/mcp@0.1.0",
273
+ install: "npm install --global @ldgr/mcp@0.1.1",
271
274
  node: ">=20.19.0",
272
275
  create: `ldgr-mcp wallet create${args.network === "testnet" ? " --testnet" : ""}`,
273
276
  import: `ldgr-mcp wallet import${args.network === "testnet" ? " --testnet" : ""}`,
@@ -279,13 +282,13 @@ function createLdgrMcpServer(options = {}) {
279
282
  instructions: "Run wallet commands yourself in a terminal. Creation/import uses local interactive prompts. Keep recovery keys and passphrases out of chat and tool calls. Remote MCP cannot install on your computer. Local preparation binds a request to your selected wallet; approvals always require human terminal review."
280
283
  }));
281
284
  if (options.local)
282
- tool("wallet_info", "Read the selected local wallet's public metadata only; never returns recovery keys or passphrases.", { network: networkSchema }, async (args) => {
285
+ tool("wallet_info", "Read the selected local wallet's public metadata only; never returns recovery keys or passphrases. The network argument checks the selected wallet, not a wallet selector. A mismatch returns WALLET_NETWORK_MISMATCH without changing wallet settings.", { network: networkSchema }, async (args) => {
283
286
  const info = await options.local.walletInfo();
284
287
  if (!info || typeof info !== "object")
285
288
  throw new Error("No wallet selected");
286
289
  const record = info;
287
290
  if (record.network !== args.network)
288
- throw new Error("Selected wallet network mismatch");
291
+ throw new WalletNetworkMismatchError;
289
292
  return { network: record.network, address: record.address, publicKey: record.publicKey, ledgerId: record.ledgerId, protection: record.protection };
290
293
  });
291
294
  return server;
package/dist/stdio.js CHANGED
@@ -121,8 +121,11 @@ var INSTRUCTIONS = `LDGR is an independent single-authority ledger. Always speci
121
121
 
122
122
  class AssetMismatchError extends Error {
123
123
  }
124
+
125
+ class WalletNetworkMismatchError extends Error {
126
+ }
124
127
  function createLdgrMcpServer(options = {}) {
125
- const server = new McpServer({ name: "ldgr", version: "0.1.0" }, { instructions: INSTRUCTIONS });
128
+ const server = new McpServer({ name: "ldgr", version: "0.1.1" }, { instructions: INSTRUCTIONS });
126
129
  const request = readTransport(options.fetch);
127
130
  const now = options.now ?? Date.now;
128
131
  const envelope = (network, source, data) => ({ network, source, data });
@@ -133,8 +136,8 @@ function createLdgrMcpServer(options = {}) {
133
136
  const data = await run(args);
134
137
  return { content: [{ type: "text", text: JSON.stringify(data) }] };
135
138
  } catch (error) {
136
- const code = error instanceof AssetMismatchError ? "ASSET_MISMATCH" : error instanceof LdgrClientError && error.status === 404 ? "NOT_FOUND" : "OPERATION_FAILED";
137
- const message = code === "NOT_FOUND" ? "The requested record was not found on the explicit network. This is not proof that a previous submission failed; reconcile an uncertain submission before retrying." : code === "ASSET_MISMATCH" ? "The record does not match the requested exact asset code." : "LDGR operation could not complete. Check the explicit network, address, asset, values and service availability. No transaction was signed or submitted.";
139
+ const code = error instanceof WalletNetworkMismatchError ? "WALLET_NETWORK_MISMATCH" : error instanceof AssetMismatchError ? "ASSET_MISMATCH" : error instanceof LdgrClientError && error.status === 404 ? "NOT_FOUND" : "OPERATION_FAILED";
140
+ const message = code === "NOT_FOUND" ? "The requested record was not found on the explicit network. This is not proof that a previous submission failed; reconcile an uncertain submission before retrying." : code === "ASSET_MISMATCH" ? "The record does not match the requested exact asset code." : code === "WALLET_NETWORK_MISMATCH" ? "The selected CLI wallet uses a different network. The network argument checks the selected wallet; it does not switch wallets or networks. Request the selected network, or run wallet list and wallet select in your own terminal to choose a wallet on the intended network. Keep any custom --wallet path consistent. No wallet settings were changed." : "LDGR operation could not complete. Check the explicit network, address, asset, values and service availability. No transaction was signed or submitted.";
138
141
  return { isError: true, content: [{ type: "text", text: JSON.stringify({ error: { code, message } }) }] };
139
142
  }
140
143
  });
@@ -271,7 +274,7 @@ function createLdgrMcpServer(options = {}) {
271
274
  }, false);
272
275
  tool("wallet_setup_instructions", "Explain user-run CLI wallet installation, creation/import and MCP connection. This tool cannot install software or access local files.", { network: networkSchema }, async (args) => ({
273
276
  network: args.network,
274
- install: "npm install --global @ldgr/mcp@0.1.0",
277
+ install: "npm install --global @ldgr/mcp@0.1.1",
275
278
  node: ">=20.19.0",
276
279
  create: `ldgr-mcp wallet create${args.network === "testnet" ? " --testnet" : ""}`,
277
280
  import: `ldgr-mcp wallet import${args.network === "testnet" ? " --testnet" : ""}`,
@@ -283,13 +286,13 @@ function createLdgrMcpServer(options = {}) {
283
286
  instructions: "Run wallet commands yourself in a terminal. Creation/import uses local interactive prompts. Keep recovery keys and passphrases out of chat and tool calls. Remote MCP cannot install on your computer. Local preparation binds a request to your selected wallet; approvals always require human terminal review."
284
287
  }));
285
288
  if (options.local)
286
- tool("wallet_info", "Read the selected local wallet's public metadata only; never returns recovery keys or passphrases.", { network: networkSchema }, async (args) => {
289
+ tool("wallet_info", "Read the selected local wallet's public metadata only; never returns recovery keys or passphrases. The network argument checks the selected wallet, not a wallet selector. A mismatch returns WALLET_NETWORK_MISMATCH without changing wallet settings.", { network: networkSchema }, async (args) => {
287
290
  const info = await options.local.walletInfo();
288
291
  if (!info || typeof info !== "object")
289
292
  throw new Error("No wallet selected");
290
293
  const record = info;
291
294
  if (record.network !== args.network)
292
- throw new Error("Selected wallet network mismatch");
295
+ throw new WalletNetworkMismatchError;
293
296
  return { network: record.network, address: record.address, publicKey: record.publicKey, ledgerId: record.ledgerId, protection: record.protection };
294
297
  });
295
298
  return server;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ldgr/mcp",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "type": "module",
5
5
  "types": "./dist/index.d.ts",
6
6
  "exports": {
@@ -12,7 +12,7 @@
12
12
  "publishConfig": { "access": "public" },
13
13
  "engines": { "node": ">=20.19.0" },
14
14
  "dependencies": {
15
- "@ldgr/client": "^0.6.0",
15
+ "@ldgr/client": "^0.6.1",
16
16
  "@ldgr/cli": "^0.5.0",
17
17
  "@ldgr/protocol": "^0.5.0",
18
18
  "@modelcontextprotocol/sdk": "1.32.2",