@gvnrdao/dh-mcp 0.1.1 → 0.2.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 +101 -38
- package/dist/boundary.js +1617 -485
- package/dist/index.js +1814 -534
- package/package.json +11 -4
package/README.md
CHANGED
|
@@ -6,33 +6,61 @@ lending on a user's behalf, with a human approving every fund-moving step.
|
|
|
6
6
|
|
|
7
7
|
## Install
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
Pick the row that matches your machine — the first two paths carry their own runtime,
|
|
10
|
+
so there is **nothing to install first** (no Node, no npm):
|
|
10
11
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
Claude
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
12
|
+
| You are on | Install path |
|
|
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.2.1/dh-mcp-0.2.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 with an absolute path. Pin a version: `curl -fsSL https://assets.gvnr.xyz/dh-mcp/install.sh \| DH_VERSION=0.2.1 sh` |
|
|
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
|
+
|
|
18
|
+
Downloads landing page (which file is for which system, checksums, security notes):
|
|
19
|
+
**https://assets.gvnr.xyz/dh-mcp/** — all artifacts and `SHA256SUMS` live under it
|
|
20
|
+
(`latest/` and `v<version>/` — e.g. `v0.2.1/`).
|
|
21
|
+
|
|
22
|
+
Unsigned-binary honesty: the macOS and Windows binaries are **not yet code-signed** —
|
|
23
|
+
macOS Gatekeeper may quarantine the download (right-click → Open, or
|
|
24
|
+
`xattr -d com.apple.quarantine <file>`) and Windows SmartScreen will warn. Verify the
|
|
25
|
+
`SHA256SUMS` file from the same release if in doubt. On macOS/Windows the `.mcpb` path
|
|
26
|
+
avoids this entirely.
|
|
27
|
+
|
|
28
|
+
**Troubleshooting `spawn npx ENOENT`:** your MCP host searched the system PATH and found
|
|
29
|
+
no `npx` — the machine has no Node.js (or the host, e.g. an Electron app, cannot see
|
|
30
|
+
your shell's version manager). That is the npx path's stated precondition, not a bug in
|
|
31
|
+
the server. Remedies: use the one-line installer above (the printed snippet uses an
|
|
32
|
+
absolute path to a binary that carries its own runtime), or on macOS/Windows Claude
|
|
33
|
+
Desktop install the `.mcpb`.
|
|
34
|
+
|
|
35
|
+
**Zero configuration boots the real protocol on SEPOLIA**
|
|
22
36
|
(the test network — real contracts, test funds) with public endpoints. Everything is
|
|
23
37
|
overridable by environment variables:
|
|
24
38
|
|
|
25
39
|
| Variable | Default | Meaning |
|
|
26
40
|
|---|---|---|
|
|
27
41
|
| `DH_ADAPTER` | `real` | `real` protocol, or `mock` (offline practice sandbox; needs `DH_MOCK_DB` + `DH_MOCK_LATENCY`) |
|
|
28
|
-
| `DH_NETWORK` | `sepolia` | `sepolia` or `mainnet` (mainnet
|
|
42
|
+
| `DH_NETWORK` | `sepolia` | `sepolia` or `mainnet` (mainnet reads work; mainnet writes are disabled unless the operator explicitly arms them) |
|
|
29
43
|
| `ETH_RPC_URL` | public node per network | your own RPC if preferred |
|
|
30
44
|
| `DH_SERVICE_ENDPOINT` | per network | Diamond Hands ops service |
|
|
31
45
|
| `DH_KEYSTORE_PATH` + `DH_KEYSTORE_PASSWORD` | unset | optional: encrypted keystore for automatic signing (both or neither) |
|
|
32
46
|
|
|
33
|
-
Signing is chosen **by conversation** (`signer_setup`
|
|
34
|
-
|
|
35
|
-
|
|
47
|
+
Signing is chosen **by conversation** (`signer_setup` — available on the real adapter):
|
|
48
|
+
your own wallet (MetaMask browser popup, or WalletConnect for mobile — scannable QR or
|
|
49
|
+
paste-code) or a local encrypted keystore. Safe smart-account and delegation modes are
|
|
50
|
+
**mock-only for now** (table below).
|
|
51
|
+
|
|
52
|
+
## What works where
|
|
53
|
+
|
|
54
|
+
| Network | Reads (public) | Reads (authenticated) | Writes |
|
|
55
|
+
|---|---|---|---|
|
|
56
|
+
| **sepolia** (default — the real protocol, practice money) | always, no setup | after a login: keystore env pair, or "connect my wallet" (`signer_setup`) | signer modes **keystore** and **external** (your own wallet). External-mode BTC withdrawal is not shipped yet — it refuses with that true reason; keystore withdrawal works |
|
|
57
|
+
| **mainnet** (real money) | always (indexer gaps are reported honestly) | after a login (the broker throttles logins per address) | **disabled unless the operator explicitly arms them**; PSM writes refuse regardless |
|
|
58
|
+
| **mock** (`DH_ADAPTER=mock` — offline practice sandbox) | always | always | all modes, including the simulated Safe and delegation planes |
|
|
59
|
+
|
|
60
|
+
Signer modes `safe` and `safe-module` (Safe smart-account borrower, delegation) are
|
|
61
|
+
**mock-only pending their own deliveries** — on the real adapter they refuse with that
|
|
62
|
+
true reason. **Reads never trigger wallet popups:** an authenticated read without a login
|
|
63
|
+
refuses legibly, and the user says "connect my wallet" (`signer_setup` action `connect`).
|
|
36
64
|
|
|
37
65
|
## Security posture (what this package will never do)
|
|
38
66
|
|
|
@@ -42,7 +70,8 @@ multi-owner — co-signers join through one shareable ceremony link).
|
|
|
42
70
|
- The approval bridge listens on **loopback only** (127.0.0.1, token-gated).
|
|
43
71
|
- Every fund-moving call requires your explicit confirmation AND a real signature; the
|
|
44
72
|
card you sign is decoded from the exact transaction — never re-formatted.
|
|
45
|
-
- **Mainnet writes are
|
|
73
|
+
- **Mainnet writes are disabled unless the operator explicitly arms them**; PSM mainnet
|
|
74
|
+
writes refuse regardless.
|
|
46
75
|
|
|
47
76
|
## What it solves
|
|
48
77
|
|
|
@@ -67,12 +96,22 @@ misrepresent upstream state, always answer with legible, typed results.
|
|
|
67
96
|
| `loan_extend` | Renew the position term (pro-rata fee) |
|
|
68
97
|
| `loan_withdraw` | Withdraw BTC from the vault (unrecoverable — strictest gate) |
|
|
69
98
|
| `loan_recover_stale_spend` | Clear a stale BTC withdrawal reservation (permissionless) |
|
|
99
|
+
| `loan_allowlist_destination` | Register a BTC withdrawal destination in the registry (delay-gated on live networks) |
|
|
100
|
+
| `psm_swap` | Swap USDC ↔ UCD through the PSM (quotes via the `psm_quote` read; mainnet PSM writes always refuse) |
|
|
101
|
+
| `loan_delegation_setup` / `loan_delegation_grant` | Safe delegation plane — practice (mock) only today; real refuses with that true reason |
|
|
102
|
+
|
|
103
|
+
**Authorization by conversation:** `signer_setup` — the user picks external wallet
|
|
104
|
+
(MetaMask popup / WalletConnect QR), local encrypted keystore, or the Safe modes by
|
|
105
|
+
TALKING; secrets never travel through chat. `guide` serves the walkthroughs
|
|
106
|
+
(`first-setup`, `connect-wallet`, `safe`, `delegation`, `troubleshooting`, …).
|
|
70
107
|
|
|
71
108
|
**Observability** (read tools + resources, no signer needed): position status, listings,
|
|
72
109
|
event history, pending withdrawals (`position_*`, `position://{id}`), protocol health and
|
|
73
110
|
terms (`protocol_*`, `protocol://config`, `protocol://terms`), BTC balance and oracle price
|
|
74
111
|
(`btc_*`), and `boundary://info` — which world the server is talking to (adapter, sources,
|
|
75
|
-
signer identity; never secrets)
|
|
112
|
+
signer identity; never secrets), including its `capabilities` block: network, chain id,
|
|
113
|
+
practice-vs-real money, whether reads need a login, whether writes are enabled (and the
|
|
114
|
+
true reason when not), and which signer modes this build offers.
|
|
76
115
|
|
|
77
116
|
## Architecture: the protocol boundary
|
|
78
117
|
|
|
@@ -88,26 +127,33 @@ All protocol traffic passes through one module — the `ProtocolBoundary` port
|
|
|
88
127
|
instead of presenting one side as truth.
|
|
89
128
|
- A single switch (`DH_ADAPTER=mock|real`) selects the adapter behind the port.
|
|
90
129
|
|
|
91
|
-
The **
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
130
|
+
The **real adapter** (the zero-config default) speaks to the live protocol: the Diamond
|
|
131
|
+
Hands SDK, the lit-ops service, and an Ethereum RPC. Public reads need no setup;
|
|
132
|
+
authenticated reads need a login; writes run on sepolia through the keystore or the
|
|
133
|
+
user's own wallet (capability table above). The **mock adapter** is a full protocol
|
|
134
|
+
simulator: complete position lifecycle (deposit → active → repaid → closed), LTV-checked
|
|
135
|
+
mints, fee math, event history — held in memory, persisted to a local file DB (survives
|
|
136
|
+
restarts), with deterministic operation delays and injectable fault scenarios. It enables
|
|
137
|
+
end-to-end agent development and testing with zero funds at risk, offline.
|
|
138
|
+
|
|
139
|
+
In one paragraph: tools and resources talk only to the `ProtocolBoundary` port; behind it
|
|
140
|
+
sit the two adapters, a signer layer (`signer_setup`) with a loopback-only approval
|
|
141
|
+
bridge for external wallets, and a result-envelope contract carrying data provenance and
|
|
142
|
+
typed errors — never raw upstream text. The full design docs (use cases, sequence
|
|
143
|
+
diagrams, data contracts, scenario catalog) live in the repository:
|
|
144
|
+
<https://github.com/gvnrdao/diamond-hands>.
|
|
100
145
|
|
|
101
146
|
## Reliability status
|
|
102
147
|
|
|
103
148
|
- Behavior is pinned by scenario tests that run through the genuine MCP request path
|
|
104
149
|
(in-memory client/server pair), covering happy paths and failure classes alike
|
|
105
150
|
(missing config, uncollateralized operations, source divergence, upstream outages).
|
|
106
|
-
- Current stage: **
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
151
|
+
- Current stage: **real adapter (sepolia writes, mainnet reads) + mock simulator**, both
|
|
152
|
+
behind the same boundary contract and the same scenario suites. External-wallet signing
|
|
153
|
+
runs on the real adapter; external-mode BTC withdrawal is the one remaining refusal
|
|
154
|
+
(its true reason is stated; keystore withdrawal works).
|
|
155
|
+
- Mainnet writes are disabled unless the operator explicitly arms them. Reads are
|
|
156
|
+
unrestricted, with indexer gaps reported honestly.
|
|
111
157
|
|
|
112
158
|
## Security model
|
|
113
159
|
|
|
@@ -133,15 +179,32 @@ rejected before signing — but address correctness is still the human's respons
|
|
|
133
179
|
### Signer required for writes
|
|
134
180
|
|
|
135
181
|
All write tools require a configured signer; without one they return a typed
|
|
136
|
-
`SIGNER_UNAVAILABLE` error.
|
|
182
|
+
`SIGNER_UNAVAILABLE` error. On the real adapter the two remedies are the keystore env
|
|
183
|
+
pair (`DH_KEYSTORE_PATH` + `DH_KEYSTORE_PASSWORD`) or connecting the user's own wallet
|
|
184
|
+
(`signer_setup`, mode `external`). In mock mode the signed identity is `DH_MOCK_BORROWER`.
|
|
137
185
|
|
|
138
186
|
### Supply chain (audit H-6)
|
|
139
187
|
|
|
140
188
|
Dependencies are pinned to exact versions so nothing drifts silently between installs.
|
|
141
189
|
Bump deliberately, in lockstep with sibling packages, and run `npm ci` in CI.
|
|
142
190
|
|
|
143
|
-
###
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
191
|
+
### Mainnet writes are operator-gated
|
|
192
|
+
|
|
193
|
+
Mainnet reads work out of the box. Mainnet writes are disabled unless the operator
|
|
194
|
+
explicitly arms them — an unarmed server refuses every mainnet write and names the
|
|
195
|
+
standing gate as the reason. Do not arm mainnet writes without reviewing your host's
|
|
196
|
+
approval flow and key management; PSM mainnet writes refuse regardless.
|
|
197
|
+
|
|
198
|
+
## For AI assistants
|
|
199
|
+
|
|
200
|
+
- **Read `boundary://info` FIRST.** Its `capabilities` block is the truth about the
|
|
201
|
+
session: network, chain id, practice-vs-real money, whether reads need a login, whether
|
|
202
|
+
writes are enabled (and the true reason when not), which signer modes exist, and
|
|
203
|
+
whether `signer_setup` is registered. Never promise a capability it does not list.
|
|
204
|
+
- **Use the `guide://` topics** (also served by the `guide` tool) — `guide://index` lists
|
|
205
|
+
them; `getting-started`, `first-setup`, and `connect-wallet` carry the onboarding path.
|
|
206
|
+
Narrate them in the user's language.
|
|
207
|
+
- **Never invent flows.** Every refusal names its true reason and next step — relay that,
|
|
208
|
+
don't improvise around it.
|
|
209
|
+
- Claude Code users may copy the `guide://index` content into a project skill for
|
|
210
|
+
persistent context across sessions.
|