@gvnrdao/dh-mcp 0.5.1 → 0.5.2

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
@@ -11,13 +11,13 @@ so there is **nothing to install first** (no Node, no npm):
11
11
 
12
12
  | You are on | Install path |
13
13
  |---|---|
14
- | **Claude Desktop (macOS / Windows)** | Download the bundle and open it (double-click / drag into Settings → Extensions): `https://assets.gvnr.xyz/dh-mcp/v0.5.1/dh-mcp-0.5.1.mcpb` — Claude Desktop runs it on its own embedded runtime; network and optional keystore are configured in the extension's settings UI (the password is held by the OS credential store, never written to a config file). |
15
- | **Linux — including Claude Desktop builds on Linux — or any other MCP host** | One line, no sudo: `curl -fsSL https://assets.gvnr.xyz/dh-mcp/install.sh \| sh` — installs a self-contained binary (its own Node runtime inside) to `~/.dh-mcp/bin/dh-mcp`, verifies its SHA-256, and prints the exact `mcpServers` snippet. **Then wire the host:** Claude Code: `claude mcp add diamond-hands -- $HOME/.dh-mcp/bin/dh-mcp` (new session); Claude Desktop (Linux builds): the snippet in `~/.config/Claude/claude_desktop_config.json`, full quit + relaunch; other hosts: the snippet in their MCP config. Pin a version: `curl -fsSL https://assets.gvnr.xyz/dh-mcp/install.sh \| DH_VERSION=0.5.1 sh` |
14
+ | **Claude Desktop (macOS / Windows)** | Download the bundle and open it (double-click / drag into Settings → Extensions): `https://assets.gvnr.xyz/dh-mcp/v0.5.2/dh-mcp-0.5.2.mcpb` — Claude Desktop runs it on its own embedded runtime; network and optional keystore are configured in the extension's settings UI (the password is held by the OS credential store, never written to a config file). |
15
+ | **Linux — including Claude Desktop builds on Linux — or any other MCP host** | One line, no sudo: `curl -fsSL https://assets.gvnr.xyz/dh-mcp/install.sh \| sh` — installs a self-contained binary (its own Node runtime inside) to `~/.dh-mcp/bin/dh-mcp`, verifies its SHA-256, and prints the exact `mcpServers` snippet. **Then wire the host:** Claude Code: `claude mcp add diamond-hands -- $HOME/.dh-mcp/bin/dh-mcp` (new session); Claude Desktop (Linux builds): the snippet in `~/.config/Claude/claude_desktop_config.json`, full quit + relaunch; other hosts: the snippet in their MCP config. Pin a version: `curl -fsSL https://assets.gvnr.xyz/dh-mcp/install.sh \| DH_VERSION=0.5.2 sh` |
16
16
  | **Developers** (requires **Node ≥ 18 on PATH** — this path does NOT work on a bare machine) | Claude Code: `claude mcp add diamond-hands -- npx -y @gvnrdao/dh-mcp` · any host JSON: `{ "mcpServers": { "diamond-hands": { "command": "npx", "args": ["-y", "@gvnrdao/dh-mcp"] } } }` |
17
17
 
18
18
  Downloads landing page (which file is for which system, checksums, security notes):
19
19
  **https://assets.gvnr.xyz/dh-mcp/** — all artifacts and `SHA256SUMS` live under it
20
- (`latest/` and `v<version>/` — e.g. `v0.5.1/`).
20
+ (`latest/` and `v<version>/` — e.g. `v0.5.2/`).
21
21
 
22
22
  Local installs serve local MCP hosts only — **claude.ai web / mobile / Cowork cannot
23
23
  reach them** (a hosted remote connector is a separate, upcoming tier).
package/dist/boundary.js CHANGED
@@ -89534,10 +89534,15 @@ document.getElementById("generate").onclick = () => submit(true);
89534
89534
  // src/boundary/upstream/shared/external-bridge/bridge.ts
89535
89535
  var MAX_SESSIONS = 16;
89536
89536
  var DEFAULT_EXPIRY_MS = 5 * 60 * 1e3;
89537
+ var DEFAULT_ATTACH_GRACE_MS = 60 * 1e3;
89537
89538
  var JSON_LIMIT_BYTES = 64 * 1024;
89538
89539
  var SignatureBridge = class {
89539
89540
  clock;
89540
89541
  expiryMs;
89542
+ attachGraceMs;
89543
+ /** Last sweep tick that saw a live attachment — the unattended grace measures from
89544
+ * max(enqueue, this), so a page closed mid-wait gets the same grace as never-opened. */
89545
+ lastAttachedMs = 0;
89541
89546
  server = null;
89542
89547
  port = 0;
89543
89548
  token = (0, import_node_crypto6.randomBytes)(24).toString("hex");
@@ -89562,6 +89567,7 @@ var SignatureBridge = class {
89562
89567
  constructor(opts) {
89563
89568
  this.clock = opts?.clock ?? Date.now;
89564
89569
  this.expiryMs = opts?.expiryMs ?? DEFAULT_EXPIRY_MS;
89570
+ this.attachGraceMs = opts?.attachGraceMs ?? DEFAULT_ATTACH_GRACE_MS;
89565
89571
  this.urlFile = opts?.urlFile;
89566
89572
  this.network = opts?.network;
89567
89573
  this.wcConfig = opts?.wc;
@@ -89636,9 +89642,11 @@ var SignatureBridge = class {
89636
89642
  });
89637
89643
  }
89638
89644
  return new Promise((resolve) => {
89645
+ const now = this.clock();
89639
89646
  const entry = {
89640
89647
  request,
89641
- deadlineMs: this.clock() + this.expiryMs,
89648
+ deadlineMs: now + this.expiryMs,
89649
+ enqueuedMs: now,
89642
89650
  resolve,
89643
89651
  settled: false,
89644
89652
  ...handlers?.finalize ? { finalize: handlers.finalize } : {}
@@ -89661,9 +89669,11 @@ var SignatureBridge = class {
89661
89669
  requestSignatureCollection(request, collect) {
89662
89670
  if (!this.server) return Promise.resolve({ status: "invalidated", reason: "bridge is not started" });
89663
89671
  return new Promise((resolve) => {
89672
+ const now = this.clock();
89664
89673
  const entry = {
89665
89674
  request,
89666
- deadlineMs: this.clock() + this.expiryMs,
89675
+ deadlineMs: now + this.expiryMs,
89676
+ enqueuedMs: now,
89667
89677
  resolve,
89668
89678
  settled: false,
89669
89679
  collect
@@ -89733,12 +89743,32 @@ var SignatureBridge = class {
89733
89743
  }
89734
89744
  }
89735
89745
  }
89736
- /** Expire overdue requests. Runs on a real-time interval; tests call it directly with the
89737
- * injected clock advanced. */
89746
+ /** A live attachment that could still decide a request: an open approval-page SSE
89747
+ * stream (real page or headless driver) or an active WalletConnect session. */
89748
+ attachedNow() {
89749
+ if (this.wcActive) return true;
89750
+ for (const s of this.sessions.values()) if (s.sse) return true;
89751
+ return false;
89752
+ }
89753
+ /** Expire overdue requests; fail UNATTENDED requests fast. Runs on a real-time
89754
+ * interval; tests call it directly with the injected clock advanced. Order matters:
89755
+ * the deadline is checked first so expiry semantics stay pinned (T-EXT-03). */
89738
89756
  sweep() {
89739
89757
  const now = this.clock();
89758
+ const attached = this.attachedNow();
89759
+ if (attached) this.lastAttachedMs = now;
89740
89760
  for (const entry of this.pending.values()) {
89741
- if (!entry.settled && now >= entry.deadlineMs) this.settle(entry, { status: "expired" });
89761
+ if (entry.settled) continue;
89762
+ if (now >= entry.deadlineMs) {
89763
+ this.settle(entry, { status: "expired" });
89764
+ continue;
89765
+ }
89766
+ if (!attached && now - Math.max(entry.enqueuedMs, this.lastAttachedMs) >= this.attachGraceMs) {
89767
+ this.settle(entry, {
89768
+ status: "invalidated",
89769
+ reason: `no wallet approval page is attached to this bridge (it may have been closed) \u2014 open ${this.url()} in the browser, connect the wallet, and retry the operation`
89770
+ });
89771
+ }
89742
89772
  }
89743
89773
  }
89744
89774
  close() {
package/dist/index.js CHANGED
@@ -89736,10 +89736,15 @@ document.getElementById("generate").onclick = () => submit(true);
89736
89736
  // src/boundary/upstream/shared/external-bridge/bridge.ts
89737
89737
  var MAX_SESSIONS = 16;
89738
89738
  var DEFAULT_EXPIRY_MS = 5 * 60 * 1e3;
89739
+ var DEFAULT_ATTACH_GRACE_MS = 60 * 1e3;
89739
89740
  var JSON_LIMIT_BYTES = 64 * 1024;
89740
89741
  var SignatureBridge = class {
89741
89742
  clock;
89742
89743
  expiryMs;
89744
+ attachGraceMs;
89745
+ /** Last sweep tick that saw a live attachment — the unattended grace measures from
89746
+ * max(enqueue, this), so a page closed mid-wait gets the same grace as never-opened. */
89747
+ lastAttachedMs = 0;
89743
89748
  server = null;
89744
89749
  port = 0;
89745
89750
  token = (0, import_node_crypto6.randomBytes)(24).toString("hex");
@@ -89764,6 +89769,7 @@ var SignatureBridge = class {
89764
89769
  constructor(opts) {
89765
89770
  this.clock = opts?.clock ?? Date.now;
89766
89771
  this.expiryMs = opts?.expiryMs ?? DEFAULT_EXPIRY_MS;
89772
+ this.attachGraceMs = opts?.attachGraceMs ?? DEFAULT_ATTACH_GRACE_MS;
89767
89773
  this.urlFile = opts?.urlFile;
89768
89774
  this.network = opts?.network;
89769
89775
  this.wcConfig = opts?.wc;
@@ -89838,9 +89844,11 @@ var SignatureBridge = class {
89838
89844
  });
89839
89845
  }
89840
89846
  return new Promise((resolve) => {
89847
+ const now = this.clock();
89841
89848
  const entry = {
89842
89849
  request,
89843
- deadlineMs: this.clock() + this.expiryMs,
89850
+ deadlineMs: now + this.expiryMs,
89851
+ enqueuedMs: now,
89844
89852
  resolve,
89845
89853
  settled: false,
89846
89854
  ...handlers?.finalize ? { finalize: handlers.finalize } : {}
@@ -89863,9 +89871,11 @@ var SignatureBridge = class {
89863
89871
  requestSignatureCollection(request, collect) {
89864
89872
  if (!this.server) return Promise.resolve({ status: "invalidated", reason: "bridge is not started" });
89865
89873
  return new Promise((resolve) => {
89874
+ const now = this.clock();
89866
89875
  const entry = {
89867
89876
  request,
89868
- deadlineMs: this.clock() + this.expiryMs,
89877
+ deadlineMs: now + this.expiryMs,
89878
+ enqueuedMs: now,
89869
89879
  resolve,
89870
89880
  settled: false,
89871
89881
  collect
@@ -89935,12 +89945,32 @@ var SignatureBridge = class {
89935
89945
  }
89936
89946
  }
89937
89947
  }
89938
- /** Expire overdue requests. Runs on a real-time interval; tests call it directly with the
89939
- * injected clock advanced. */
89948
+ /** A live attachment that could still decide a request: an open approval-page SSE
89949
+ * stream (real page or headless driver) or an active WalletConnect session. */
89950
+ attachedNow() {
89951
+ if (this.wcActive) return true;
89952
+ for (const s of this.sessions.values()) if (s.sse) return true;
89953
+ return false;
89954
+ }
89955
+ /** Expire overdue requests; fail UNATTENDED requests fast. Runs on a real-time
89956
+ * interval; tests call it directly with the injected clock advanced. Order matters:
89957
+ * the deadline is checked first so expiry semantics stay pinned (T-EXT-03). */
89940
89958
  sweep() {
89941
89959
  const now = this.clock();
89960
+ const attached = this.attachedNow();
89961
+ if (attached) this.lastAttachedMs = now;
89942
89962
  for (const entry of this.pending.values()) {
89943
- if (!entry.settled && now >= entry.deadlineMs) this.settle(entry, { status: "expired" });
89963
+ if (entry.settled) continue;
89964
+ if (now >= entry.deadlineMs) {
89965
+ this.settle(entry, { status: "expired" });
89966
+ continue;
89967
+ }
89968
+ if (!attached && now - Math.max(entry.enqueuedMs, this.lastAttachedMs) >= this.attachGraceMs) {
89969
+ this.settle(entry, {
89970
+ status: "invalidated",
89971
+ reason: `no wallet approval page is attached to this bridge (it may have been closed) \u2014 open ${this.url()} in the browser, connect the wallet, and retry the operation`
89972
+ });
89973
+ }
89944
89974
  }
89945
89975
  }
89946
89976
  close() {
@@ -92247,7 +92277,7 @@ function registerBoundaryInfoResource(server, getB) {
92247
92277
  }
92248
92278
 
92249
92279
  // src/server.ts
92250
- var SERVER_VERSION = "0.5.1";
92280
+ var SERVER_VERSION = "0.5.2";
92251
92281
  var SERVER_INSTRUCTIONS = "Diamond Hands MCP \u2014 Bitcoin-collateralized borrowing. Before promising ANY flow, read the boundary://info resource and honor its `capabilities` block: it states which network this server is on, whether money is real (practiceWorld), whether writes are enabled (and the true reason when they are not), and which signer modes this build actually offers \u2014 never describe a flow outside it. State the network and whether funds are real when the user first acts. Authorization is chosen by conversation via the signer_setup tool (when listed); writes always require confirmed:true after showing the human-readable card. For walkthroughs consult the guide tool / guide:// resources instead of inventing steps; when a tool refuses, relay its stated reason and remedy \u2014 do not improvise alternatives. When a network_switch tool is listed, the network can change mid-session \u2014 after ANY switch, re-read boundary://info and state the new network and money reality to the user before doing anything else.";
92252
92282
  function createServer2(deps) {
92253
92283
  const server = new import_mcp2.McpServer(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gvnrdao/dh-mcp",
3
- "version": "0.5.1",
3
+ "version": "0.5.2",
4
4
  "description": "MCP server for the Diamond Hands protocol — Bitcoin-collateralized UCD lending with human-approved signing (sepolia practice by default; mainnet fully enabled)",
5
5
  "license": "UNLICENSED",
6
6
  "repository": {